How to Run a Regular Node

What is a Node and Its Role?

In the hybrid Commit-RevealĀ² protocol, nodes are participants that generate and reveal secrets to securely contribute to random number generation. Regular nodes handle off-chain commitments, reveals, and final secret disclosures, while the leader node coordinates the process and interacts with the blockchain.

This hybrid model reduces on-chain operations, ensuring efficiency while maintaining security and transparency through proofs and verifiable smart contract interactions. Regular nodes also manage deposits and adhere to protocol rules to uphold fairness and correctness.

Preparations

  • Add Thanos Sepolia on MetaMask: Follow the guide here: Add Thanos Sepolia on MetaMask
  • Get TON from Faucet: Request Sepolia testnet tokens from the faucet: Go to Faucet

    (Connect your testnet wallet and send a transaction by clicking on "requestTokens")

  • Faucet will send you:

    • 1200 TON
    • 100 USDC
    • 100 USDT
    Faucet accepts one request every 24 hours per account. If you have leftover tokens or ETH, you can send it directly to the Faucet contract.
  • Deposit TON to Thanos Sepolia: Visit the bridge at https://trh-op-bridge.vercel.app/bridge

Step 1: Project Link

  • Github URL: DRB Node Repository
  • Branch: libp2p-communication
  • Commit Hash: fc35ab415b0f6294113fb84f847061561f23403e

Step 2: Ensure Sufficient Wallet Balance

Make sure your wallet has enough balance to operate the node effectively. You may need some TON for gas fees and other transactions.

Step 3: Set Up the .env Variables

First, create a .env file in your project directory. This file will contain the necessary environment variables to connect to the network and run the node. Here are the variables you'll need to set:

LEADER_IP=13.49.228.201 # IP address of the leader node
LEADER_PORT=61280 # Port for the leader node
LEADER_PEER_ID=12D3KooWG5QNHzBv2BghpZ4ZGDa9pHWKzEHi6bEsE5kMCsnR2XSZ # Peer ID of the leader node
LEADER_EOA=0x1723C153e86D589ce1c7478295bba783a2df9dd7 # Ethereum address (EOA) of the leader node

PEER_ID=regularNode # Your node's peer ID (this can be any unique name)
EOA_PRIVATE_KEY=your_private_key # Your Ethereum private key for signing transactions
PORT=61281 # Port for your regular node
NODE_TYPE=regular # Node type, should be set to "regular"

CHAIN_ID=111551119090 # Chain ID for the network
ETH_RPC_URL=https://rpc.thanos-sepolia.tokamak.network # URL for Ethereum RPC
CONTRACT_ADDRESS=0x7d12f3421E6ae1D2668Ed10C25873aF3B1b7449f # Address of the smart contract
SUBGRAPH_URL=https://graph-node.thanos-sepolia.tokamak.network/subgraphs/name/commitreveal22 # Subgraph URL for data queries

Leader Node Details

  • IP: 13.49.228.201
  • Port: 61280
  • Peer ID: 12D3KooWG5QNHzBv2BghpZ4ZGDa9pHWKzEHi6bEsE5kMCsnR2XSZ
  • Wallet Address: 0x1723C153e86D589ce1c7478295bba783a2df9dd7

These details are required for connecting your regular node to the leader node.

Step 4: Running the Node

Once you have set the necessary environment variables, you can run the node in two ways:

Option 1: Run Directly with Go

You can run the node directly using the go command:

go cmd/main.go

Option 2: Run with Docker

Alternatively, you can use Docker to run the node. To do so, update the container name and ports in the docker-compose.yml file:

ports:
    - "61280:61280" # Adjust this as per your choice

Then, build and start the container:

docker-compose up --build