sudoapt-getinstalldocker-cedocker-ce-clicontainerd.iodocker-buildx-plugindocker-compose-plugin# Test docker is workingsudodockerrunhello-world# Install docker composesudoapt-getupdatesudoapt-getinstalldocker-compose-plugin# Test the docker versiondockercomposeversion
Setup Rootstock Node
Make and switch to the working directory for the Rootstock node
mkdirrootstock&&cdrootstock
Create and edit the configuration file:
nanonode.conf
Paste the following content into the file You can find all the configuration options here
If you are interested in running the config for other networks, you can find the configs here
In this Docker Compose file, we are utilizing the prebuilt Rootstock node image available on dockerhub, where you can also find other prebuilt images.
services:rsk-node:image:rsksmart/rskj:ARROWHEAD-6.3.1container_name:rsk-nodeports:-5050:5050-4444:4444volumes:-rsk-data:/var/lib/rsk/.rsk-./node.conf:/etc/rsk/node.confrestart:unless-stoppedvolumes:rsk-data:```This section mounts the host's data directory for blockchain storage and the node.conf file for configuration into the container,
```bashvolumes:-./data:/var/lib/rsk/.rsk-./node.conf:/etc/rsk/node.conf
Run the node
dockercomposeup-d
Monitor the node
Use docker logs to monitor the rootstock node. The -f flag ensures you are following the log output.
dockerlogs-frsk-node
You should see a response similar to this once your node starts syncing
2024-09-16-21:23:20.0646 INFO [blockchain] [message handler] [blockHash=c6225969d4795419027f98269b1c5c0f2a6afc2a0a5f399fcaa607c27a2c484a, peerMsgId=iCvIT12JZvyWvki, peerSID=8dfb1d6268b4b13, blockHeight=1309986] block: num: [1309986] hash: [c6225969d4795419027f98269b1c5c0f2a6afc2a0a5f399fcaa607c27a2c484a], processed after: [0.005189]seconds, result IMPORTED_BEST
2024-09-16-21:23:20.0676 INFO [blockchain] [message handler] [blockHash=39a7299155cebca0b4f22ddbf49ce1c39f7d230e21aa7061874f2894d43b4847, peerMsgId=g7k643wFWTOWBfZ, peerSID=8dfb1d6268b4b13, blockHeight=1309987] block: num: [1309987] hash: [39a7299155cebca0b4f22ddbf49ce1c39f7d230e21aa7061874f2894d43b4847], processed after: [0.005022]seconds, result IMPORTED_BEST
2024-09-16-21:23:20.0706 INFO [blockchain] [message handler] [blockHash=9c5b971fb0094e922c5e517f11324e17babed9c14a33e426a5f7984b1701fe37, peerMsgId=akXn9XtqflGiK4y, peerSID=8dfb1d6268b4b13, blockHeight=1309988] block: num: [1309988] hash: [9c5b971fb0094e922c5e517f11324e17babed9c14a33e426a5f7984b1701fe37], processed after: [0.005072]seconds, result IMPORTED_BEST
2024-09-16-21:23:20.0735 INFO [blockchain] [message handler] [blockHash=53677df4e16affaf09da709a42a288e4df376ee16c97d76f25e862113f59680d, peerMsgId=n5RGPtCFbshskYG, peerSID=8dfb1d6268b4b13, blockHeight=1309989] block: num: [1309989] hash: [53677df4e16affaf09da709a42a288e4df376ee16c97d76f25e862113f59680d], processed after: [0.004886]seconds, result IMPORTED_BEST
Query the node
To get the web3 client version
curl http://localhost:4444 -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}'
Output
{"jsonrpc":"2.0","id":67,"result":"RskJ/6.3.1/Mac OS X/Java1.8/ARROWHEAD-202f1c5"}
To check the block number
curl -X POST http://localhost:4444/ -H "Content-Type: application/json" --data '{"jsonrpc":"2.0", "method":"eth_blockNumber","params":[],"id":1}'