These instructions describe getting started with soterd using the docker and/or docker-compose tools, as an alternative to compiling/installing with the golang tooling.
-
If soteria-dag projects aren't publicly available yet, you need to clone the private dependencies of soteria-dag before building the container image.
mkdir soteria-dag git clone https://github.com/soteria-dag/soterwallet.git soteria-dag/soterwallet
-
Clone the soteria-dag soterd git repository
git clone https://github.com/soteria-dag/soterd.git soteria-dag/soterd
-
Build the docker image for soteria-dag/soterd
Run this command the
soteria-dag
directory, not thesoterd
directory. When building a container image for a private project, we need to run thedocker build
command from a directory that has access to the private project and all of its private dependencies.cd soteria-dag docker build --tag soteria-dag/soterd:latest -f soterd/Dockerfile .
-
Run dagviz to generate a sample dag and step through its creation
docker run --rm --volume=`pwd`/demo:/srv/demo soteria-dag/soterd:latest dagviz -duration 10 -output /srv/demo
-
Open the
./demo/dag_0.html
file in your browser, and navigate through the dag (if-stepping
was specified for thedagviz
run).
-
Blocks are colored based on the node that generated them.
-
You can hover your mouse over a block to see more information about it.
-
You can step forward/backward through snapshots of dag-generation with prev and next hyperlinks (if
-stepping
was specified for thedagviz
run)./opt/google/chrome/chrome --new-window file://`pwd`/demo/dag_0.html
docker run --rm --publish "5070-5071/tcp" soteria-dag/soterd:latest soterd --testnet --datadir=/srv/soterd/data --logdir=/srv/soterd/logs --listen=0.0.0.0:5070 --rpclisten=0.0.0.0:5071 --rpcuser=USER --rpcpass=PASS --miningaddr=mrqvnRT17uBvozaaZXZJb2LSeWiWadx96N
After the docker instance is started, you can use docker ps
to see which ports on the host are mapped to listen
and rpclisten
, then publish the host ports to other nodes so they can connect to your node.
These steps show how we can use docker-compose
to run and control 2 simnet nodes. Simnet is used in these steps instead of testnet, to demonstrate block generation without having to wait very long for results.
-
Spin up simnet and testnet soterd nodes with
docker-compose
cd soterd docker-compose up -d
-
Check the dag tips on simnet1
docker-compose exec simnet1 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify getdagtips
-
Create a connection between simnet1 and simnet2
docker-compose exec simnet1 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify addnode simnet2:18565 add
-
Show that simnet1 is now connected to simnet2
docker-compose exec simnet1 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify getpeerinfo
-
Start mining on simnet
docker-compose exec simnet1 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify setgenerate true 1 docker-compose exec simnet2 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18566 --skipverify setgenerate true 1
-
You can see if it's generated blocks by repeating the
getdagtips
rpc call or by tailing soterd logs withdocker-compose
docker-compose logs --follow --tail=10 simnet1 simnet2
-
Once it has, stop mining on simnet
docker-compose exec simnet1 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify setgenerate false 0 docker-compose exec simnet2 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18566 --skipverify setgenerate false 0
-
Check dag state on each node
# Check simnet1 tips docker-compose exec simnet1 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify getdagtips # Check simnet2 tips docker-compose exec simnet2 soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18566 --skipverify getdagtips
-
Render the dag as an SVG file
docker-compose exec simnet1 /bin/bash -c "soterctl --simnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:18556 --skipverify renderdag | jq --raw-output .dot | dot -Tsvg" > dag.svg
-
We can open the SVG file in our browser
/opt/google/chrome/chrome --new-window file://`pwd`/dag.svg
-
Stop the nodes
docker-compose down
The docker-compose.yml
file contains a testnet
node definition, which you can target with:
docker-compose up -d testnet
Control of this node works the same as with simnet, except that you're likely to want to connect the node to Soteria's testnet:
docker-compose exec testnet soterctl --testnet --rpcuser=USER --rpcpass=PASS --rpcserver=127.0.0.1:5071 --skipverify addnode 134.209.59.43:5070 add