15 Jan 2020
Starting a passive node
In order to start the node, you first need to gather the blockchain information you need to connect to.
- the hash of the genesis block of the blockchain, this will be the source of truth of the blockchain. It is 64 hexadecimal characters.
- the trusted peers identifiers and access points.
This information are essentials to start your node in a secure way.
The genesis block is the first block of the blockchain. It contains the static parameters of the blockchain as well as the initial funds. Your node will utilise the Hash to retrieve it from the other peers. It will also allow the Node to verify the integrity of the downloaded genesis block.
The trusted peers are the nodes in the public network that your Node will trust in order to initialise the Peer To Peer network.
The node configuration
Your node configuration file may look like the following:
This config shouldn't work as it is, the ip address and port for the trusted peer should be those of an already running node. Also, the public_address ('u.x.v.t') should be a valid address (you can use an internal one, eg: 127.0.0.1). Furthermore, you need to have permission to write in the path specified by the storage config.
storage: "/mnt/cardano/storage" rest: listen: "127.0.0.1:8443" p2p: trusted_peers: - address: "/ip4/22.214.171.124/tcp/8299" id: ad24537cb009bedaebae3d247fecee9e14c57fe942e9bb0d
Description of the fields:
storage: (optional) Path to the storage. If omitted, the blockchain is stored in memory only.
log: (optional) Logging configuration:
level: log messages minimum severity. If not configured anywhere, defaults to "info". Possible values: "off", "critical", "error", "warn", "info", "debug", "trace".
format: Log output format,
output: Log output destination. Possible values are:
stdout: standard output
stderr: standard error
syslog: syslog (only available on Unix systems)
journald: journald service (only available on Linux with systemd, (if jormungandr is built with the
gelf: Configuration fields for GELF (Graylog) network logging protocol (if jormungandr is built with the
backend: hostname:port of a GELF server
log_id: identifier of the source of the log, for the
hostfield in the messages.
file: path to the log file.
rest: (optional) Configuration of the REST endpoint.
listen: address:port to listen for requests
tls: (optional) enables TLS and disables plain HTTP if provided
cert_file: path to server X.509 certificate chain file, must be PEM-encoded and contain at least 1 item
priv_key_file: path to server private key file, must be PKCS8 with single PEM-encoded, unencrypted key
cors: (optional) CORS configuration, if not provided, CORS is disabled
allowed_origins: (optional) allowed origins, if none provided, echos request origin
max_age_secs: (optional) maximum CORS caching time in seconds, if none provided, caching is disabled
p2p: P2P network settings
trusted_peers: (optional) the list of nodes's multiaddr with their associated
public_idto connect to in order to bootstrap the P2P topology (and bootstrap our local blockchain);
public_id: (optional) the node's public ID that will be used to identify this node to the network.
public_address: multiaddr string specifying address of the P2P service. This is the public address that will be distributed to other peers of the network that may find interest in participating to the blockchain dissemination with the node.
listen_address: (optional) multiaddr specifies the address the node will listen to to receive p2p connection. Can be left empty and the node will listen to whatever value was given to
topics_of_interest: The dissemination topics this node is interested to hear about:
messages: Transactions and other ledger entries. Typical setting for a non-mining node:
low. For a stakepool:
blocks: Notifications about new blocks. Typical setting for a non-mining node:
normal. For a stakepool:
max_connections: The maximum number of simultaneous P2P connections this node should maintain.
explorer: (optional) Explorer settings
enabled: True or false
Starting the node
jormungandr --config config.yaml --genesis-block-hash 'abcdef987654321....'
The 'abcdef987654321....' part refers to the hash of the genesis, that should be given to you from one of the peers in the network you are connecting to.
In case you have the genesis file (for example, because you are creating the network) you can get this hash with jcli.
cat block-0 | jcli genesis hash
or, in case you only have the yaml file
cat genesis.yaml | jcli genesis encode | jcli genesis hash