Get started with RChain®

Build DApps with RChain

RChain is a platform for developers to build confidently and rapidly. With just a few lines of code, your first RChain DApp can be up and transacting on the blockchain.

Quick development setup

Let's setup rnode for development, we will install rnode on the operating system, you can get the installer from github/rchain, also check full documentation if something is missing.

on ubuntu/debian

$ apt install ./rnode_0.x.x_all.deb

on macOS

  • Prerequisites:
  • Java - We recommend Open JDK 11, https://openjdk.java.net/projects/jdk/11/
  • Libsodium - https://download.libsodium.org/doc/ installed in a standard prefix (/user or /user/local)
tar -xvf rnode-0.x.x.tgz
cd rnode-0.x.x
./macos_install.sh

If you have another operating system or want to use docker please consult full documentation

Configuration files

Two configuration files are necessary, ~/.rnode/genesis/bonds.txt file and ~/.rnode/genesis/wallets.txt 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
mkdir ~/.rnode && mkdir ~/.rnode/genesis
echo "04be064356846e36e485408df50b877dd99ba406d87208add4c92b3c7d4e4c663c2fbc6a1e6534c7e5c0aec00b26486fad1daf20079423b7c8ebffbbdff3682b58 100000000000" > ~/.rnode/genesis/bonds.txt
echo "0x7f847d40c3ec604fe3d4263bfdd04111eb9b4e32,1000000000000000,0" > ~/.rnode/genesis/wallets.txt

Running the blockchain

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

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

You should see "hello world" pop up in the logs, it means that your deploy has been included into a block, and the transaction has been executed.

You can check the full documentation to go further, also check the rchain-toolkit javascript SDK

Please reach out to us on Discord if you encounter any issue.

Rholang

More information for validators is coming soon!

Mainnet is currently running with 30 coop run validator nodes plus. This is expected to change around Q2 2021 with the POS developments.