Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.
/ pontem Public archive

πŸš€ Pontem Parachain node with Move VM onboard.

License

Notifications You must be signed in to change notification settings

pontem-network/pontem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pontem

Warning: The repository contains a very out-of-date Move VM version. It can contain bugs or security issues. Use at your own risk.

Pontem parachain node with Move VM pallet on board.

  • Pontem docs - if you want to learn about Pontem network.
  • Validator docs - if you want to launch a validator node.
  • Bootstrap - if you want to up node quickly (not for development).

Local Relaychain & Parachain Launch

Current version built with Nimbus consensus and Parachain Staking implementation. Requires relay chain to work correctly.

Requirements

Build

To build Pontem node run the following commands:

cd pontem
make init
make build

See built binary at:

./target/release/pontem

There are several options to launch Pontem local parachain:

Using polkadot-launch

Install polkadot-launch.

Note: you must have polkadot node v0.9.18 compiled and built placed in ../polkadot/target/release/. To use different localion you can modify ./launch-config.json.

Create keystore path for Pontem:

mkdir -p ~/.pontem/keystore-1 # Base path

Add Nimbus key:

# Use "//Alice" for URI.
./target/release/pontem key insert --keystore-path ~/.pontem/keystore-1 --key-type nmbs --scheme sr25519
# run pontem-node
polkadot-launch ./launch-config.json

Wait for an minute.

Observe 9946.log to verify that the node was launched successfully and is producing blocks, also you can use Web UI.

tail -f ./9946.log

Using polkadot-launch via docker-compose

Build container:

cd pontem
docker-compose build

Launching services:

docker-compose up -d

Log files are in folder docker-launch.

In the docker-compose.yml file, you can set the required versions of polkadot and pontem by specifying them in POLKADOT_VERSION and PONTEM_VERSION, respectively. (note: if you change versions in docker-compose.yaml or change the .build/launch.Dockerfile, you need to rerun the docker-compose build command).

You can connect using the following ports:

127.0.0.1:9944 # Alice relaychain
127.0.0.1:9946 # Alice parachain

Manually

Build Polkadot:

git clone https://github.com/paritytech/polkadot.git
cd polkadot
git fetch origin
git checkout release-v0.9.18
cargo build --release

Launch Polkadot Relay Chain:

./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json
./target/release/polkadot --chain rococo-local-cfde.json --alice --tmp
./target/release/polkadot --chain rococo-local-cfde.json --bob --tmp --port 30334 # In a separate terminal

Build Pontem node and then create keystore path for Pontem:

mkdir -p ~/.pontem/keystore-1 # Base path

Add Nimbus key:

# Use "//Alice" for URI.
./target/release/pontem key insert --keystore-path ~/.pontem/keystore-1 --key-type nmbs --scheme sr25519

Launch parachain node as collator:

./target/release/pontem export-genesis-state --chain=local 2000 > genesis-state
./target/release/pontem export-genesis-wasm > genesis-wasm
./target/release/pontem --collator --tmp --keystore-path ~/.pontem/keystore-1 --chain=local --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335

Register the parachain:

  1. Navigate to sudo UI in Relay Chain.
  2. Choose parasSudoWrapper.
  3. Choose sudoScheduleParaInitialize(id, genesis) method.
  4. Change id to 2000.
  5. Upload genesis-state to genesisHead field.
  6. Upload gensis-wasm to validationCode field.
  7. Change parachain field to Yes.
  8. Send transaction.
  9. Restart pontem-node.

Metadata

Metadata for Polkadot JS can be found in repository containing types.

  • Current amount of top collator is 8.
  • Block time is 12 seconds.
  • There is 1 hour rounds.

Connect as a new collator

Create keystore path for the new key:

mkdir ~/.pontem/keystore-2 # Base path

Add new Nimbus key:

# Use "//Bob" for URI.
./target/release/pontem key insert --keystore-path ~/.pontem/keystore-2 --key-type nmbs --scheme sr25519

Get your public key:

# Use "//Bob" for dev purposes URI.
./target/release/pontem key inspect

You will see something like:

Secret Key URI `//Bob` is account:
Secret seed:       0x02ca07977bdc4c93b5e00fcbb991b4e8ae20d05444153fd968e04bed6b4946e7
Public key (hex):  0xb832ced5ca2de9fe76ef101d8ab1b8dd778e1ab5a809d019c57b78e45ecbaa56
Public key (SS58): 5GEDm6TY5apP4bhwuTtTzA7z9vHbCL1V2D5nE8sPga6WKhNH
Account ID:        0xb832ced5ca2de9fe76ef101d8ab1b8dd778e1ab5a809d019c57b78e45ecbaa56
SS58 Address:      5GEDm6TY5apP4bhwuTtTzA7z9vHbCL1V2D5nE8sPga6WKhNH

Copy Public key (hex) as your public key, it's going to be your validator public key. Now you need to map your public key with your account.

Send new transaction to map your public key with your account:

  1. Navigate to extrinsics.
  2. Choose authorMapping pallet.
  3. Choose addAssociation(author_id) function.
  4. Put your public key in author_id field.
  5. Send transaction from your account.

Now create your validator:

  1. Navigate to extrinsics.
  2. Choose parachainStaking pallet.
  3. Choose joinCandidates(bond, candidate_count) function.
  4. Put amount to bond in PONT tokens.
  5. For candidate_count use 1.
  6. Send transaction.

Now time to launch your node.

If you used polkadot-launch to launch everything:

/target/release/pontem --collator \
     --tmp \
    --keystore-path ~/.pontem/keystore-2  \
    --chain=local \
    --port 40338 \
    --ws-port 9947 \
    --bootnodes <bootnode> \
    -- --execution wasm --chain ./rococo-local.json --port 40336

Replace bootnode with peer address from result of following command:

cat 9946.log | grep 40335 # Something like: /ip4/127.0.0.1/tcp/40335/p2p/12D3KooWM1a6mBNyvZwbN5T3sDuYuxgxmNoj83CnFqaHJzaB8GYV

If you used manual method:

/target/release/pontem --collator \
    --tmp \
    --keystore-path ~/.pontem/keystore-2  \
    --chain=local \
    --port 40338 \
    --ws-port 9947 \
    --bootnodes <bootnode> \
    -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 40336

Good documentation also can be found in Moonriver/Moonbeam Docs.

Running in dev-mode

There is a possibility to run a single node in development mode, without any consensus involved.

Add --dev-service flag to cargo run command to run a single node with disabled consensus:

IMPORTANT NOTE: the node with enabled --dev-service flag generating blocks when needed (e.g. when a new transaction appears).

./target/release/pontem --dev --dev-service --tmp

Use --sealing argument to select sealing mode:

  1. instant (default). Blocks a produced automatically for each transaction
  2. <number>. Blocks are produced once per number milliseconds

Documentation

See Move VM Pallet documentation.

XCM

The XCM implemented includes assets transferring between Parachains and Relaychain using XTokens pallet.

  • Transfers from Relaychain to Parachain happens with reserveTransferAssets.
  • XCM teleport and executions are currently disabled.
  • Supports PONT and KSM tokens.

Dev Relaychain

In case you want to run node with dev Relaychain (e.g. using polkadot-launch), after launching Relaychain send transaction using sudo account:

  1. Navigate to sudo.
  2. Choose xcmPallet pallet.
  3. Choose forceDefaultXcmVersion(maybeXcmVersion) function.
  4. Enable option maybeXcmVersion.
  5. Put 2 into the maybeXcmVersion field.
  6. Send transaction.

Now you can use XCM.

LICENSE

See LICENSE.