U2U Network Documentations
  • Introduction
    • Our Vision
    • Litepaper
      • Overview
        • U2U Network Diagram
        • U2U Network with DEPIN and Web3 Eco System
      • Consensus
  • Services
    • RPC
      • RPC Endpoints
      • Ethereum API Methods
        • eth_blockNumber
        • eth_call
        • eth_chainId
        • eth_estimateGas
        • eth_feeHistory
        • eth_gasPrice
        • eth_getBalance
        • eth_getBlockByHash
        • eth_getBlockByNumber
        • eth_getBlockTransactionCountByHash
        • eth_getBlockTransactionCountByNumber
        • eth_getCode
        • eth_getLogs
        • eth_getProof
        • eth_getStorageAt
        • eth_getTransactionByBlockHashAndIndex
        • eth_getTransactionByBlockNumberAndIndex
        • eth_getTransactionByHash
        • eth_getTransactionCount
        • eth_getTransactionReceipt
        • eth_getUncleByBlockHashAndIndex
        • eth_getUncleByBlockNumberAndIndex
        • eth_getUncleCountByBlockHash
        • eth_getUncleCountByBlockNumber
        • eth_maxPriorityFeePerGas
        • eth_sendRawTransaction
        • eth_subscribe
        • eth_unsubscribe
        • net_version
        • net_listening
        • net_peerCount
        • web3_clientVersion
        • web3_sha3
        • debug_traceTransaction
      • DAG API Methods
        • dag_getEvent
        • dag_getEventPayload
        • dag_getHeads
        • eth_currentEpoch
      • Trace API Methods
        • trace_block
        • trace_get
        • trace_transaction
        • trace_filter
    • Explorer
      • Explorer URLs
      • Explorer API
        • Account
        • Block
        • Contract
        • Logs
        • Stats
        • Token
        • Transaction
      • GraphQL
      • Explorer RPC API
      • Smart Contract Verification
        • Via explorer
        • Via hardhat plugin
      • Testnet Faucet
    • Wallets
      • Metamask
      • Wallet Connect
      • Coinbase Wallet
      • U2U Super App
        • Policy
    • Staking
      • How To Stake?
      • FAQ
    • The Graph
      • Deploy a Graph Node
      • Deploy a Subgraph
    • Bridge
      • Smart Contracts & EOA
    • Oracle
      • Smart Contracts & EOA
  • Network
    • Node Types
    • Requirements
    • Build Dependencies
    • Run Normal Node
      • Mainnet Normal Node
      • Testnet Normal Node
      • Run via Docker
    • Run Validator Node
      • Mainnet Validator Node
      • Testnet Validator Node
    • Run A Local Test Network
    • Troubleshooting
  • SUBNET
    • Overview
    • Subnet Node Type
    • Requirements
    • NFT Digital License
    • Subnet Node Setup
      • Master Node
      • Verifier Node
      • Edge Node CLI
  • For Developers
    • SDK
    • Smart Contract Development
      • What are smart contracts?
      • What is gas?
      • Structure of a smart contract
      • Your first smart contract
      • Test your smart contract
      • Deploy your smart contract
      • Submit your contract to explorer
      • Interact With Your Smart Contract
      • Integrate Your Smart Contract With a Frontend
      • Additional Resources
    • Smart Contract Deployment
      • Deploy with Remix
      • Deploy with Hardhat
Powered by GitBook
On this page
  • Prerequisites
  • Docker and Docker compose
  • Pulling sources
  • Dockerfile
  • docker-compose.yaml
  • Run
  1. Network
  2. Run Normal Node

Run via Docker

PreviousTestnet Normal NodeNextRun Validator Node

Last updated 10 months ago

Prerequisites

Docker and Docker compose

and are required to run node.

Pulling sources

First off, create a directory to store source codes and files for next steps (feel free to name it):

mkdir u2u_node

Change to created directory u2u_node:

cd u2u_node

Repository u2u-genesis

Clone the u2u-genesis repository to u2u_node:

git clone https://github.com/unicornultrafoundation/u2u-genesis.git
cd u2u-genesis
git checkout main

Repository go-u2u

Clone the go-u2u repository to u2u_node:

git clone https://github.com/unicornultrafoundation/go-u2u.git
cd go-u2u
git checkout stable

Dockerfile

Create a file Dockerfile inside u2u_node. Below is the sample Dockerfile:

FROM golang:1.20-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

WORKDIR /go/go-u2u
COPY ./go-u2u .

ARG GOPROXY
RUN go mod download
RUN make u2u

FROM alpine:latest

RUN apk add --no-cache ca-certificates

COPY --from=builder /go/go-u2u/build/u2u /

EXPOSE 8545 8546 8547 30303

ENTRYPOINT ["/u2u"]

docker-compose.yaml

Create a file docker-compose.yaml inside u2u_node. Below is sample docker-compose.yaml file:

version: "3"
services:
  u2u_node:
    build: .
    image: go-u2u:stable
    restart: always
    volumes:
      - u2u_node:/root/.u2u
      - ./u2u-genesis/mainnet.g:/genesis.g
    ports:
      - 8545:8545
      - 8546:8546
      - 30303:30303
    command: --genesis /genesis.g
      --genesis.allowExperimental
      --http
      --http.addr="0.0.0.0"
      --http.port=8545
      --http.corsdomain="*"
      --http.api="eth,debug,net,admin,web3,personal,txpool,dag"
      --ws
      --ws.addr "0.0.0.0"
      --ws.port=8546
      --ws.api "eth,debug,net,web3,txpool,dag"
      --ws.origins "*"
      --enabletxtracer
      --gcmode full
      --port 30303
    network_mode: host
volumes:
  u2u_node:

Note that:

  • To run node on Solaris mainnet: you need to replace genesis file to ./u2u-genesis/mainnet.g.

  • To run node on Nebulas testnet: you need to replace genesis file to ./u2u-genesis/testnet.g.

Run

Now your u2u_node folder will look like this:

docker-compose.yaml
Dockerfile
go-u2u/
u2u-genesis/

To run a node with Docker compose, open Terminal at u2u_node folder:

docker-compose up

Since we have not published the testnet yet for external nodes to join. However, we are working on it, hang tight

🎉
Docker
Docker Compose