Navigation Structure

Table of contents

  1. Multi Node
    1. Automated Localnet with Docker
      1. Build & Start
      2. Stop Localnet
      3. Logging
      4. Interact with the Localnet
        1. Ethereum JSON-RPC and Websocket Interface
      5. Key and Accounts

Multi Node

Automated Localnet with Docker

Build & Start

Build and start a testnet with 4 nodes.

make localnet-start

The ports for each node are found in the following table:

Node ID P2P Port REST/Ethereum JSON-RPC Port Websocket Port
node0 26656 8545 8546
node1 26659 8547 8548
node2 26661 8549 8550
node3 26663 8551 8552

To update the binaries, you need to rebuild and restart the node

To start the container and create the network using Docker Compose, you can use the following command:

...
Creating network "treasurenet_localnet" with driver "bridge"
Creating node0 ... done
Creating node2 ... done
Creating node1 ... done
Creating node3 ... done

Stop Localnet

make localnet-stop

Logging

# node0:daemon logs
docker exec node0 tail treasurenetd.log

Interact with the Localnet

Ethereum JSON-RPC and Websocket Interface

To interact with testnet via Websocket or RPC/API, you need to send a request to the appropriate port:

You can try to send a request via curl:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}' -H "Content-Type: application/json" 127.0.0.1:8545

Key and Accounts

To interact with treasurenetd and start querying status or creating transactions, you can use the treasurenetd directory of any given node as your home directory:

treasurenetd keys list --home ./build/node0/treasurenetd