Install dependencies:
$ sudo apt install protobuf-compiler base58
Install go packages:
$ go install google.golang.org/protobuf/cmd/protoc-gen-go
$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
Increase UDP size to optimize P2P communication:
$ sudo sysctl -w net.core.rmem_max=7500000
$ sudo sysctl -w net.core.wmem_max=7500000
Default configuration:
seed-nodes: # List of seed nodes
- address: "seed-1.chainnet.yago.ninja"
peer-id: "QmNXM4W7om3FdYDutuPjYCgTsazRNWhNn6fNyimf7SUHhR"
port: 9100
- address: "seed-2.chainnet.yago.ninja"
peer-id: "peerID-2"
port: 8081
- address: "seed-3.chainnet.yago.ninja"
peer-id: "peerID-3"
port: 8082
storage-file: "bin/miner-storage" # File used for persisting the chain status
miner:
pub-key-reward: # Public wallet key encoded in base58, used for receiving mining rewards
"aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTJVEyUnnaMDSRgUZKJzwFAdWKhSv8HTtbQbecee5xew2DPfqm467oef3KEW7bT54WdDWbvEqEhFv1YT3aPZZVqgKc"
mining-interval: "10m" # Interval between block creation
adjustment-interval: 6 # Number of blocks before adjusting the difficulty
chain:
max-txs-mempool: 10000 # Maximum number of transactions allowed in the mempool
prometheus:
enabled: true # Enable or disable prometheus metrics
port: 9091 # Port exposed for prometheus metrics
path: "/metrics" # Path for prometheus metrics endpoint
p2p:
enabled: true # Enable or disable network communication
#identity-path: "identity.pem" # ECDSA peer private key path in PEM format (leave empty to generate a random identity)
peer-port: 9100 # Port used for network communication with other peers
http-api-port: 8080 # Port exposed for the router API (required for nespv wallets)
min-conn: 5 # Minimum number of connections
max-conn: 100 # Maximum number of connections
conn-timeout: "60s" # Maximum duration of a connection
write-timeout: "20s" # Maximum duration of a write stream
read-timeout: "20s" # Maximum duration of a read stream
buffer-size: 4096 # Read buffer size over the network
wallet:
wallet-key-path: priv-key.pem # ECDSA wallet private key path in PEM format
server-address: "seed-1.chainnet.yago.ninja"
server-port: 8080
Building the chainnet-nespv
wallet:
$ make nespv
Building the chainnet-node
:
$ make node
Building the chainnet-miner
node:
$ make miner
Building a chainnet-nespv
wallet:
$ make nespv
Here's the corrected documentation:
First, create a wallet by generating a private key with OpenSSL
:
$ openssl ecparam -name prime256v1 -genkey -noout -out <wallet.pem>
This wallet.pem
file will contain both the private and public keys.
You can use this wallet by running the chainnet-nespv
wallet to send transactions as follows:
$ ./bin/chainnet-nespv send --config default-config.yaml --address random --amount 1 --fee 10 --wallet-key-path <wallet.pem>
To receive rewards, you'll need to extract the public key from the wallet in base58
format. This can be done as follows:
$ openssl ec -in <wallet.pem> -pubout -outform DER 2>/dev/null | base58
Once you have the public key, paste it into the config.yaml
file of the miner to receive mining rewards:
miner:
pub-key-reward: # Public wallet key encoded in base58, used for receiving mining rewards
"aSq9DsNNvGhYxYyqA9wd2eduEAZ5AXWgJTbTJVEyUnnaMDSRgUZKJzwFAdWKhSv8HTtbQbecee5xew2DPfqm467oef3KEW7bT54WdDWbvEqEhFv1YT3aPZZVqgKc"
mining-interval: "10m" # Interval between block creation
adjustment-interval: 6 # Number of blocks before adjusting the difficulty
This ensures your mining rewards will be sent to the public key generated from your wallet.
Running the chainnet-node
:
$ ./bin/chainnet-node --config default-config.yaml
Running the chainnet-miner
:
$ ./bin/chainnet-miner --config default-config.yaml
Running the chainnet-node
:
$ mkdir /path/to/data
$ cp config/examples/docker-config.yaml /path/to/data/config.yaml
$ docker run -v ./path/to/data:/data -e CONFIG_FILE=/data/config.yaml -p 8080:8080 yagoninja/chainnet-node:latest
Running the chainnet-miner
:
$ mkdir /path/to/data
$ cp config/examples/docker-config.yaml /path/to/data/config.yaml
$ docker run -v ./path/to/data:/data -e CONFIG_FILE=/data/config.yaml -p 8080:8080 yagoninja/chainnet-miner:latest
Running the chainnet-node
on a remote node:
$ ansible-playbook -i ansible/hosts.ini ansible/deploy.yml -e "target=node config=../config/examples/seed-node-config.yaml"
Running the chainnet-miner
on a remote node:
$ ansible-playbook -i ansible/hosts.ini ansible/deploy.yml -e "target=miner config=../config/examples/seed-node-config.yaml"
Deploy the helm chart:
$ helm install chainnet-release ./helm --set-file configFile=config/examples/kubernetes-config.yaml
Uninstall the helm chart:
$ helm uninstall chainnet
Generate a ECDSA secp256r1
private key in PEM format:
$ openssl ecparam -name prime256v1 -genkey -noout -out ecdsa-priv-key.pem
┌──────────────────┐ ┌──────────────────┐
│ │ │ │
│ ChainNet Node ├────────────────►│ ChainNet Miner │
│ │ │ │
└──────────────────┘ └──────────────────┘