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.
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.
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.
- Configuration
- Testing Upgrades
- Chain Specifications
- Rust Installation
- Block Weights
- Actionlint Guide
- rustup installed
- For any docker steps: Docker and Docker Compose (or podman).
- Earthly - containerized build system
- Direnv - manages environment variables
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 docFor 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-chainspecsIf 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.jsonThe mock file can be regenerated by running:
$ earthly +generate-keys
# Output: /res/testnet/initial-authorities.json and /res/mock-bridge-data/testnet-mock.jsonTo 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-02If you want to regenerate the genesis seeds, run:
$ earthly +generate-testnet-02-genesis-seedsSee this document
These are built in CI. See the workflow files for the latest earthly commands:
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 30338earthly +build
cp ./artifacts-amd64/midnight-node-runtime/target/wasm32-unknown-unknown/release/midnight_node_runtime.wasm .- For generating single keys:
- Build node and then run:
./target/release/midnight-node key generateSee 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 Rustenums for easy pasting into chain spec files, in the order:(aura, grandpa, cross_chain)
- Run the following script to generate
python ./scripts/generate-keys.py --helpSee fork-testing.md