How to start a ScaleChain peer - ScaleChain/scalechain GitHub Wiki
Preparation Steps
Supported platforms
- OSX, Linux platforms are supported.
- ScaleChain should run on Unix platforms without any error, but did not test it yet. Unix platforms will be supported in the future.
- Windows platform is not supported and we don't have any plan to support it.
Install prerequisites.
ScaleChain node requires Oracle Java 8 and sbt.
For linux, build rocksdb v4.8
For linux machines, you need to build rocksdb v4.8 and copy the rocksdb jar file into scalechain-storage/lib
git clone https://github.com/facebook/rocksdb
git checkout v4.8
make rocksdbjava
# Copy the jar file. <ScaleChain folder> is where you cloned scalechin source code from github.
cp target/rocksdbjni-4.8.0-linux64.jar <ScaleChain folder>/scalechain-storage/lib
Installation Steps
Download source code
git clone https://github.com/scalechain/scalechain
Edit the scalechain configuration file.
You can edit IP address of peers and also the account name, where a receiving address is generated to get the reward of mining. For testing purpose, we do not recommend to change these configurations, as shell scripts such as run.sh depends on the configuration.
scalechain-cli/src/main/resources/scalechain.conf
scalechain {
general {
regtest=1
}
api {
port = 8080
user = "user"
password = "pleasechangethispassword123@.@"
}
p2p {
port = 7643
peers = [
{ address:"127.0.0.1", port:"7643" },
{ address:"127.0.0.1", port:"7644" },
{ address:"127.0.0.1", port:"7645" },
{ address:"127.0.0.1", port:"7646" },
{ address:"127.0.0.1", port:"7647" }
]
}
network {
name = "testnet"
}
mining {
max_block_size = 131072
account = "_FOR_TEST_ONLY"
address = "n3KyfQbGr6bDRbyZMTb3x69npriXotyhd3"
}
# If private is defined, the is a permissioned node in a private blockchain.
private = 1
storage {
cassandra.ignore {
address = "127.0.0.1"
port = 9042
}
}
}
Build ScaleChain.
# Go to the directory where you cloned scalechain source code.
cd scalechain
sbt compile
(Optional) Run sanity tests.
# Go to the directory where you cloned scalechain source code.
cd scalechain
sbt test
Start a ScaleChain node.
Using the following command, start a ScaleChain node. Use -p command parameter to specify the incoming port for P2P communication.
The command line parameter -p is the inbound port for the P2P communication, -c is the inbound port for the RPC service.
sbt "project scalechain-cli" "run-main io.scalechain.blockchain.cli.ScaleChainPeer -p 7643 -c 8080"
You may see info-level logs printed on your console, saying that it failed to connect to other peers. It is ok, as other nodes specified by the above default configuration file is not up and running.
00:18:59.480 [nioEventLoopGroup-120-1] INFO i.s.b.net.p2p.RetryingConnector - Connection to 127.0.0.1:7645 failed. Will try in a second.
To run other nodes as well, follow the instruction on running five sample nodes.
Running five sample nodes.
To run the five nodes described in the scalechain.conf, you need to open five console window, and run each of the following commands in a console window.
Caution : You need to run these commands in all five consoles within 3 seconds ;-)
Copy the environment template to .env
# Go to the directory where you cloned scalechain source code.
cd scalechain
cp .env-template .env
After copying the .env file, you may want to change the base port P2P_PORT_BASE. If so, you also have to change ports in the list of peers in scalechain.conf.
Console 0
# Go to the directory where you cloned scalechain source code.
cd scalechain
./run.sh 0
Console 1
# Go to the directory where you cloned scalechain source code.
cd scalechain
./run.sh 1
Console 2
# Go to the directory where you cloned scalechain source code.
cd scalechain
./run.sh 2
Console 3
# Go to the directory where you cloned scalechain source code.
cd scalechain
./run.sh 3
Console 4
# Go to the directory where you cloned scalechain source code.
cd scalechain
./run.sh 4
List of supported RPCs
In data/scripts/jsonrpc folder, there are sample shell scripts calling RPCs. The followings are the list of supported RPCs.
GetBestBlockHash
GetBlock
GetBlockHash
Help
GetPeerInfo
DecodeRawTransaction
GetRawTransaction
SendRawTransaction
ImportAddress
GetAccount
GetAccountAddress
GetNewAddress
GetReceivedByAddress
ListTransactions
ListUnspent
SignRawTransaction
Bitcoin Compatibility
Peer-to-Peer protocol, block/transaction data format, RPC interfaces, script operations are compatible to Bitcoin.
Project status
Under heavy construction. Current project status is experimental.