ScaleChain / scalechain

A customizable blockchain for altcoins.
236 stars 65 forks source link

Release scalechain embedded edition #122

Closed Kangmo closed 7 years ago

Kangmo commented 7 years ago

What

Release ScaleChain embedded edition

Why

Need to make ScaleChain run under embedded systems to experiment virtual currencies in small devices such as lego mindstorms ev3, rcx2.0, rp II, and Intel edison

How

  1. Make sure that tests passed under leJos
  2. create a tag v0.8
  3. Upload a release with a release node.
Kangmo commented 7 years ago

Introduction

ScaleChain Embedded Edition runs on small devices such as Lego Mindstorm ev3, Intel Edision, RP II, enabling them to issue and transfer assets and virtual currencies.

17 RPC(remote procedure call)s

  1. Help
  2. GetBestBlockHash
  3. GetBlock
  4. GetBlockHash
  5. SubmitBlock
  6. GetPeerInfo
  7. DecodeRawTransaction
  8. GetRawTransaction
  9. SendRawTransaction
  10. ImportAddress
  11. GetAccount
  12. GetAccountAddress
  13. GetNewAddress
  14. GetReceivedByAddress
  15. ListTransactions
  16. ListUnspent
  17. SignRawTransaction

Example

curl --data-binary '{"jsonrpc": "1.0", "id":1, "method": "getbestblockhash", "params": [] }' -H 'Content-Type: application/json' http://127.0.0.1:8080/

17 CLI(command line interface)s

All RPCs have corresponding CLIs.

Example :

cd bin
# Specify RPC port as PORT environment variable.
PORT=8080 ./scalechain-cli getbestblockhash

How to run

  1. Connect your device to your desktop using either Wi-Fi or Bluetooth PAN.
  2. copy scalechain-embedded-v0.8.tar.gz to your device scp -oKexAlgorithms=+diffie-hellman-group1-sha1 ../scalechain-package.tar.gz root@10.0.1.1:scalechain.tar.gz
  3. (in your device) unzip tar.gz
    gunzip scalechain.tar.gz
  4. (in your device) untar tar
    tar xvf scalechain.tar
  5. (in your device) execute run-ev3.sh
    cd scalechain-package
    ./run-ev3.sh

    Running with two nodes

    The default configuration files work when you run only one node for testing purpose. If you want to run two nodes, you need to change the following sections in the following files.

config/scalechain.conf

scalechain {
  ...
  p2p {
    ...
    peers = [
       # List ip addresses and ports for the nodes you want to create in your blockchain network.
      { address:"127.0.0.1", port:"7643" },
      { address:"127.0.0.1", port:"7643" }
    ]
  }
  ...
}

config/hosts.config

#server id, address and port (the ids from 0 to n-1 are the service replicas)
0 127.0.0.1 11000
1 127.0.0.1 11001
7001 127.0.0.1 11100

config/system.config

#Number of servers in the group
system.servers.num = 2

#Maximum number of faulty replicas
system.servers.f = 0

...

#Replicas ID for the initial view, separated by a comma.
# The number of replicas in this parameter should be equal to that specified in 'system.servers.num'
system.initial.view = 0,1

...

#This sets if the system will function in Byzantine or crash-only mode. Set to "true" to support Byzantine faults
system.bft = false
Kangmo commented 7 years ago

done