Skip to content

midnightntwrk/midnight-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Nightly Build Status

Midnight Node

This is an implementation of the Midnight blockchain. This node houses the Midnight Ledger, allowing participants of Midnight to come to consensus on the public and their private state.

Quick Start

If you just want to run midnight-node, the easiest option is to git clone https://github.com/midnightntwrk/midnight-node-docker and run the docker compose script.

Note on Open Sourcing Progress

While this repository is open source, it depends on some repositories that we are still in the process of being release. As such:

  • It's not possible to compile midnight-node independently.
  • If you raise a PR, the CI will be able to compile it.
  • We're actively working to open-source dependencies in the coming months.

Documentation

Proposals Decisions

Prerequisites

Contributing

Guide lines on contributing.

Development Workflow

Ensure you're using direnv, or source .envrc manually. (For RustRover you can use https://plugins.jetbrains.com/plugin/15285-direnv-integration )

Common development commands are kept in the Earthfile prefixed with 'local-'. To see them all, run:

$ earthly doc

How-To Guides

Rebuilding preprod/prod genesis

For preprod and prod chains, node keys and wallet seeds used in genesis are stored as secrets.

It's possible to rebuild the chainspecs for preprod and prod chains without access to the secrets, since the public keys for the initial authority nodes are stored in /res/$NETWORK_NAME/initial-authorities.json. To rebuild chainspecs without rebuilding the genesis, run:

$ earthly +rebuild-chainspecs

If you need to re-generate the mock file for a preprod or prod chain, you'll need access to the secrets. These can be copied from AWS into the /secrets directory. For example, for testnet these files would be:

secrets/testnet-seeds-aws.json
secrets/testnet-keys-aws.json

The mock file can be regenerated by running:

$ earthly +generate-keys
# Output: /res/testnet/initial-authorities.json and /res/mock-bridge-data/testnet-mock.json

To rebuild the genesis for a preprod environment, copy the keys from AWS into the /secrets directory and run:

# secrets copied from /secrets/testnet-02-genesis-seeds.json
$ earthly +rebuild-genesis-testnet-02

If you want to regenerate the genesis seeds, run:

$ earthly +generate-testnet-02-genesis-seeds

How to use transaction generator in the midnight toolkit

See this document

Build Docker images

These are built in CI. See the workflow files for the latest earthly commands:

Start bootstrapped local network

Start a local network with 5/7 authority node using the existing chain specification local

CFG_PRESET=dev SEED=//Alice ./target/release/midnight-node --base-path /tmp/node-1 --node-key="0000000000000000000000000000000000000000000000000000000000000001" --validator --port 30333
CFG_PRESET=dev SEED=//Bob ./target/release/midnight-node --base-path /tmp/node-2 --node-key="0000000000000000000000000000000000000000000000000000000000000002" --bootnodes "/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp"  --validator --port 30334
CFG_PRESET=dev SEED=//Charlie ./target/release/midnight-node --base-path /tmp/node-3 --node-key="0000000000000000000000000000000000000000000000000000000000000003" --bootnodes "/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" --validator --port 30335
CFG_PRESET=dev SEED=//Dave ./target/release/midnight-node --base-path /tmp/node-4 --node-key="0000000000000000000000000000000000000000000000000000000000000004" --bootnodes "/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" --validator --port 30336
CFG_PRESET=dev SEED=//Eve ./target/release/midnight-node --base-path /tmp/node-5 --node-key="0000000000000000000000000000000000000000000000000000000000000005" --bootnodes "/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" --validator --port 30337
CFG_PRESET=dev SEED=//Ferdie ./target/release/midnight-node --base-path /tmp/node-6 --node-key="0000000000000000000000000000000000000000000000000000000000000006" --bootnodes "/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp" --validator --port 30338

How to build runtime in Docker

earthly +build
cp ./artifacts-amd64/midnight-node-runtime/target/wasm32-unknown-unknown/release/midnight_node_runtime.wasm  .

How to generate node public keys

  • For generating single keys:
    • Build node and then run:
./target/release/midnight-node key generate

See the --help flag for more information on other arguments, including key schemes.

  • For generating multiple keys for bootstrapping:
    • Run the following script to generate $n$ number of key triples and seed phrases. The triples are formatted as Rust enums for easy pasting into chain spec files, in the order: (aura, grandpa, cross_chain)
python ./scripts/generate-keys.py --help