Dev run rnode os

From RChain Developer Resource

Download and install[edit | edit source]

Download rnode :[edit | edit source]

Download installer from github.com/rchain

Prerequisites (OS)[edit | edit source]

  • Linux and macOS : rnode only implementation is currently in Scala, therefore it needs java to run, we recommend Open JDK 11, openjdk.java.net
  • macOS only : libsodium installed in a standard prefix (/user or /user/local)

Installation macOS[edit | edit source]

tar -xvf rnode-0.x.x.tgz cd rnode-0.x.x ./macos_install.sh

Installation linux[edit | edit source]

tar -xvf rnode-0.x.x.tgz cd rnode-0.x.x ./macos_install.sh

Configuration files[edit | edit source]

Two configuration files are necessary, ~/.rnode/genesis/bonds.txt (the POS validators) file and ~/.rnode/genesis/wallets.txt (the initial wallets) file. We will use the following key pair.

Do not use this private key for any other purpose than development

private key 28a5c9ac133b4449ca38e9bdf7cacdce31079ef6b3ac2f0a080af83ecff98b36
public key 04be064356846e36e485408df50b877dd99ba406d87208add4c92b3c7d4e4c663c2fbc6a1e6534c7e5c0aec00b26486fad1daf20079423b7c8ebffbbdff3682b58

Now let's create the two files :

mkdir ~/.rnode && mkdir ~/.rnode/genesis echo "04be064356846e36e485408df50b877dd99ba406d87208add4c92b3c7d4e4c663c2fbc6a1e6534c7e5c0aec00b26486fad1daf20079423b7c8ebffbbdff3682b58 100000000000" > ~/.rnode/genesis/bonds.txt echo "1111Wbd8KLeWBVsxByF9iksJ4QRRjEF3nq1ScgAw7bMbtomxHsqqd,1000000000000000,0" > ~/.rnode/genesis/wallets.txt

Running the blockchain[edit | edit source]

Now the configuration files are set up, there is one validator allowed to deploy, and only one address that has REV. We can run the node.

rnode run -s --validator-private-key 28a5c9ac133b4449ca38e9bdf7cacdce31079ef6b3ac2f0a080af83ecff98b36 --dev-mode

This node is standalone, it is a one node blockchain network, therefore it does not download any block and starts at block height 0. It is executed with the --dev-mode option, so the API is an extended API with explore deploy available.

Do a first deploy and propose block[edit | edit source]

Now in another shell let's deploy our first rholang file and propose the block.

echo "new stdout(\`rho:io:stdout\`) in { stdout!(\"hello world\") }" > hello.rho rnode deploy --valid-after-block-number 0 --phlo-price 1 --phlo-limit 10000000 --private-key 28a5c9ac133b4449ca38e9bdf7cacdce31079ef6b3ac2f0a080af83ecff98b36 hello.rho rnode --grpc-port 40402 propose