-
Notifications
You must be signed in to change notification settings - Fork 9
Beacon chain node
Mikhail Kalinin edited this page May 28, 2019
·
18 revisions
A tiny command line utility to run beacon chain node.
To run a node you need to install Java 8 or later. There are many guidelines in Internet, even the official one, from Oracle.
Clone the repo and execute build command:
git clone --v0.2.0 https://github.com/harmony-dev/beacon-chain-java.git
cd beacon-chain-java
./gradlew clean build -x test
Unpack the distribution:
unzip start/node/build/distributions/node-0.2.0.zip
Use default config to check it out:
cd node-0.2.0/bin
./node default --validators=0-15
./node --help
Usage: node [-hV] [--genesis-time=time] [--listen=port] [--loglevel=level]
[--name=node-name] [--connect=URL[,URL...]]... [--validators=key[,
key...]]... config.yml
Beacon chain node
config.yml A path to a file containing node config in YAML format.
Use 'default' to run a node with default setup.
--connect=URL[,URL...]
Peers that node is actively connecting to.
URL format: tcp://<host>:<port>
--genesis-time=time Genesis time in GMT+0 timezone. In either form:
'2019-05-24 11:23'
'11:23' (current day is taken)
Defaults to the beginning of the current hour.
--listen=port TCP port to listen for inbound connections.
--loglevel=level Log verbosity level: all, debug, info, error.
info is set by default.
--name=node-name Node identity for logs output
Useful when several nodes are running
--validators=key[,key...]
Validator registry. Entry is either:
private key in a hex format prepended with '0x'
an index or a range specifying a keypair(s) in
emulated deposit contract
Example: --validators=1,2,5-9,0x1234567[...]ef
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
In order to start building a chain you have to run a node with several validators. There is a built-in default
config that can be used for a quick start.
To run a node that carries 16
validators use following command:
./node default --listen=40001 --validators=0-15 --name=V
Let's add a couple of nodes and connect them with validators:
./node default --listen=40002 --connect=tcp://localhost:40001,tcp://localhost:40003 --name=1
./node default --listen=40003 --connect=tcp://localhost:40001,tcp://localhost:40002 --name=2
Check out logs:
#V:
15:33:55.007 #V INFO - validator 8: attested to head: Block[6d2ae3fe <~ f7f11046, @slot 203, state=a48c35cc, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/0/f7f11046/0+1+2+3]] in a slot: #203
15:33:55.009 #V INFO - validator 11: attested to head: Block[6d2ae3fe <~ f7f11046, @slot 203, state=a48c35cc, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/0/f7f11046/0+1+2+3]] in a slot: #203
15:33:55.010 #V INFO - validator 14: attested to head: Block[6d2ae3fe <~ f7f11046, @slot 203, state=a48c35cc, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/0/f7f11046/0+1+2+3]] in a slot: #203
15:33:55.012 #V INFO - validator 13: attested to head: Block[6d2ae3fe <~ f7f11046, @slot 203, state=a48c35cc, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/0/f7f11046/0+1+2+3]] in a slot: #203
15:34:00.048 #V INFO - validator 7: proposed a Block[5c631e0d <~ 6d2ae3fe, @slot 204, state=84a7b69d, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000]:
Attestation[AttestationData[shard=1, beaconBlock=6d2ae3fe, targetEpoch=50, targetRoot=cc142219, shardBlock=00000000, previousCrosslinkRoot=11a86088, sourceEpoch=49, sourceRoot=617a935b], attesters=0+1+2+3, cusodyBits=0b00000000, sig=c000...0000]
in 0.001s
15:34:00.077 #V INFO - new block inserted: Block[5c631e0d <~ 6d2ae3fe, @slot 204, state=84a7b69d, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/1/6d2ae3fe/0+1+2+3]] in 0.029s
15
#1:
15:34:00.125 #1 INFO - new block inserted: Block[5c631e0d <~ 6d2ae3fe, @slot 204, state=84a7b69d, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/1/6d2ae3fe/0+1+2+3]] in 0.039s
#2:
15:34:00.125 #2 INFO - new block inserted: Block[5c631e0d <~ 6d2ae3fe, @slot 204, state=84a7b69d, randao=c000...0000, Eth1Data{depositRoot=b3f59c3f, depositCount=16, block=078cbf50}, sig=c000...0000, atts: [epoch=50/1/6d2ae3fe/0+1+2+3]] in 0.036s
config:
# location of database
db: file://db
# the list of networks
networks:
# Simple proprietary protocol base on Netty TCP stack
- type: netty
# TCP port the node should listen for incoming connections
listenPort: 40001
# list of remote peers this peer will be actively connecting to
activePeers:
- tcp://localhost:40002
- tcp://localhost:40003
# Config for a validator service
validator:
# emulates the deposit contract with a list of initial validators and genesis time
contract: !emulator
# genesis time. Should be not too far from the current time (e.g. 30 mins)
genesisTime: 2018-05-20 16:55:00
# Initial deposit value for all validators
balance: 55
# the list of initial validators specified via random seed or explicit private keys
keys:
# generates [count] of validator private keys from a given random [seed]
- !generate
count: 16
seed: 0
# explicit list of private keys
- !private
- 0x1111111111111111111111111111111111111111111111111111111111111111
- 0x2222222222222222222222222222222222222222222222222222222222222222
# validator signer config
signer: !insecure
# the list of validator keys specified via random seed or explicit private keys
keys:
# take validator keys #8 and #9 from the same seed and range used in the emulate contract
- !generate
count: 2
startIndex: 8
seed: 0
# explicit list of private keys (should exist in the emulate contract config)
- !private
- 0x1111111111111111111111111111111111111111111111111111111111111111
- 0x2222222222222222222222222222222222222222222222222222222222222222
chainSpec:
specConstants:
initialValues:
GENESIS_SLOT: 1000000
miscParameters:
SHARD_COUNT: 4
TARGET_COMMITTEE_SIZE: 2
timeParameters:
SECONDS_PER_SLOT: 10
MIN_ATTESTATION_INCLUSION_DELAY: 1
SLOTS_PER_EPOCH: 4
SLOTS_PER_HISTORICAL_ROOT: 64
honestValidatorParameters:
ETH1_FOLLOW_DISTANCE: 1
stateListLengths:
LATEST_RANDAO_MIXES_LENGTH: 64
LATEST_ACTIVE_INDEX_ROOTS_LENGTH: 64
LATEST_SLASHED_EXIT_LENGTH: 64
specHelpersOptions:
blsVerify: false
blsVerifyProofOfPossession: false
blsSign: false