Integritee Worker: SubstraTEE Worker for SubstraTEE Node

integritee-worker

Integritee worker for Integritee node or parachain

This is part of Integritee

Build and Run

Please see our Integritee Book to learn how to build and run this.

To start multiple worker and a node with one simple command: Check out this README.

Tests

environment

Unit tests within the enclave can't be run by cargo test. All unit and integration tests can be run by the worker binary

first, you should run ipfs daemon because it is needed for testing

ipfs daemon

second, you'll need a integritee-node running

./target/release/integritee-node --dev --execution native

then you should make sure that the sealed_state is empty (but exists)

worker/bin$ rm sealed_stf_state.bin
worker/bin$ touch sealed_stf_state.bin

execute tests

Run these with

integritee-service/bin$ ./integritee-service test_enclave --all

End-to-end test with benchmarking

Including cleanup between runs:

run node

./target/release/integritee-node purge-chain --dev
./target/release/integritee-node --dev --ws-port 9979

run worker

export RUST_LOG=debug,substrate_api_client=warn,sp_io=warn,ws=warn,integritee_service=info,enclave_runtime=info,sp_io::misc=debug,runtime=debug,enclave_runtime::state=warn,ita_stf::sgx=info,light_client=warn,rustls=warn
rm -rf shards/ light_client_db.bin
./integritee-service -r 2002 -p 9979 -w 2001 run 2>&1 | tee worker.log

wait until you see the worker synching a few blocks. then check MRENCLAVE and update bot-community.py constants accordingly

./integritee-cli -p 9979 list-workers

now bootstrap a new bot community

./bot-community.py init
./bot-community.py benchmark

now you should see the community growing from 10 to hundreds, increasing with every ceremony

Download Details:
Author: capsule-corp-ternoa
Source Code: https://github.com/capsule-corp-ternoa/worker
License: View license

#rust  #blockchain #parachain #polkadot 

Integritee Worker: SubstraTEE Worker for SubstraTEE Node

Substrate Parachain Template: A New Cumulus-based Substrate Node

Substrate Cumulus Parachain Template

A new Cumulus-based Substrate node, ready for hacking :cloud:

This project is a fork of the Substrate Node Template modified to include dependencies required for registering this node as a parathread or parachain to an established relay chain.

👉 Learn more about parachains here, and parathreads here.

Build & Run

Follow these steps to prepare a local Substrate development environment :hammer_and_wrench:

Setup of Machine

If necessary, refer to the setup instructions at the Substrate Developer Hub.

Build

Once the development environment is set up, build the Cumulus Parachain Template. This command will build the Wasm Runtime and native code:

cargo build --release

Relay Chain

NOTE: In the following two sections, we document how to manually start a few relay chain nodes, start a parachain node (collator), and register the parachain with the relay chain.

We also have the polkadot-launch CLI tool that automate the following steps and help you easily launch relay chains and parachains. However it is still good to go through the following procedures once to understand the mechanism for running and registering a parachain.

To operate a parathread or parachain, you must connect to a relay chain. Typically you would test on a local Rococo development network, then move to the testnet, and finally launch on the mainnet. Keep in mind you need to configure the specific relay chain you will connect to in your collator chain_spec.rs. In the following examples, we will use rococo-local as the relay network.

Build Relay Chain

Clone and build Polkadot (beware of the version tag we used):

# Get a fresh clone, or `cd` to where you have polkadot already:
git clone -b v0.9.7 --depth 1 https://github.com/paritytech/polkadot.git
cd polkadot
cargo build --release

Generate the Relay Chain Chainspec

First, we create the chain specification file (chainspec). Note the chainspec file must be generated on a single node and then shared among all nodes!

👉 Learn more about chain specification here.

./target/release/polkadot build-spec \
--chain rococo-local \
--raw \
--disable-default-bootnode \
> rococo_local.json

Start Relay Chain

We need n + 1 full validator nodes running on a relay chain to accept n parachain / parathread connections. Here we will start two relay chain nodes so we can have one parachain node connecting in later.

From the Polkadot working directory:

# Start Relay `Alice` node
./target/release/polkadot \
--chain ./rococo_local.json \
-d /tmp/relay/alice \
--validator \
--alice \
--port 50555

Open a new terminal, same directory:

# Start Relay `Bob` node
./target/release/polkadot \
--chain ./rococo_local.json \
-d /tmp/relay/bob \
--validator \
--bob \
--port 50556

Add more nodes as needed, with non-conflicting ports, DB directories, and validator keys (--charlie, --dave, etc.).

Reserve a ParaID

To connect to a relay chain, you must first _reserve a ParaId for your parathread that will become a parachain. To do this, you will need sufficient amount of currency on the network account to reserve the ID.

In this example, we will use Charlie development account where we have funds available. Once you submit this extrinsic successfully, you can start your collators.

The easiest way to reserve your ParaId is via Polkadot Apps UI under the Parachains -> Parathreads tab and use the + ParaID button.

Parachain

Select the Correct Relay Chain

To operate your parachain, you need to specify the correct relay chain you will connect to in your collator chain_spec.rs. Specifically you pass the command for the network you need in the Extensions of your ChainSpec::from_genesis() in the code.

Extensions {
    relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
    para_id: id.into(),
},

You can choose from any pre-set runtime chainspec in the Polkadot repo, by referring to the cli/src/command.rs and node/service/src/chain_spec.rs files or generate your own and use that. See the Cumulus Workshop for how.

In the following examples, we will use the rococo-local relay network we setup in the last section.

Export the Parachain Genesis and Runtime

We first generate the genesis state and genesis wasm needed for the parachain registration.

# Build the parachain node (from it's top level dir)
cd substrate-parachain-template
cargo build --release

# Folder to store resource files needed for parachain registration
mkdir -p resources

# Build the chainspec
./target/release/parachain-collator build-spec \
--disable-default-bootnode > ./resources/template-local-plain.json

# Build the raw chainspec file
./target/release/parachain-collator build-spec \
--chain=./resources/template-local-plain.json \
--raw --disable-default-bootnode > ./resources/template-local-raw.json

# Export genesis state to `./resources`, using 2000 as the ParaId
./target/release/parachain-collator export-genesis-state --parachain-id 2000 > ./resources/para-2000-genesis

# Export the genesis wasm
./target/release/parachain-collator export-genesis-wasm > ./resources/para-2000-wasm

NOTE: we have set the para_ID to be 2000 here. This must be unique for all parathreads/chains on the relay chain you register with. You must reserve this first on the relay chain for the testnet or mainnet.

Start a Parachain Node (Collator)

From the parachain template working directory:

# NOTE: this command assumes the chain spec is in a directory named `polkadot`
# that is at the same level of the template working directory. Change as needed.
#
# It also assumes a ParaId of 2000. Change as needed.
./target/release/parachain-collator \
-d /tmp/parachain/alice \
--collator \
--alice \
--force-authoring \
--ws-port 9945 \
--parachain-id 2000 \
-- \
--execution wasm \
--chain ../polkadot/rococo_local.json

Output:

2021-05-30 16:57:39 Parachain Collator Template
2021-05-30 16:57:39 ✌️  version 3.0.0-acce183-x86_64-linux-gnu
2021-05-30 16:57:39 ❤️  by Anonymous, 2017-2021
2021-05-30 16:57:39 📋 Chain specification: Local Testnet
2021-05-30 16:57:39 🏷 Node name: Alice
2021-05-30 16:57:39 👤 Role: AUTHORITY
2021-05-30 16:57:39 💾 Database: RocksDb at /tmp/parachain/alice/chains/local_testnet/db
2021-05-30 16:57:39 ⛓  Native runtime: template-parachain-1 (template-parachain-0.tx1.au1)
2021-05-30 16:57:41 Parachain id: Id(2000)
2021-05-30 16:57:41 Parachain Account: 5Ec4AhPUwPeyTFyuhGuBbD224mY85LKLMSqSSo33JYWCazU4
2021-05-30 16:57:41 Parachain genesis state: 0x0000000000000000000000000000000000000000000000000000000000000000000a96f42b5cb798190e5f679bb16970905087a9a9fc612fb5ca6b982b85783c0d03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400
2021-05-30 16:57:41 Is collating: yes
2021-05-30 16:57:41 [Parachain] 🔨 Initializing Genesis block/state (state: 0x0a96…3c0d, header-hash: 0xd42b…f271)
2021-05-30 16:57:41 [Parachain] ⏱  Loaded block-time = 12s from block 0xd42bb78354bc21770e3f0930ed45c7377558d2d8e81ca4d457e573128aabf271
2021-05-30 16:57:43 [Relaychain] 🔨 Initializing Genesis block/state (state: 0xace1…1b62, header-hash: 0xfa68…cf58)
2021-05-30 16:57:43 [Relaychain] 👴 Loading GRANDPA authority set from genesis on what appears to be first startup.
2021-05-30 16:57:44 [Relaychain] ⏱  Loaded block-time = 6s from block 0xfa68f5abd2a80394b87c9bd07e0f4eee781b8c696d0a22c8e5ba38ae10e1cf58
2021-05-30 16:57:44 [Relaychain] 👶 Creating empty BABE epoch changes on what appears to be first startup.
2021-05-30 16:57:44 [Relaychain] 🏷 Local node identity is: 12D3KooWBjYK2W4dsBfsrFA9tZCStb5ogPb6STQqi2AK9awXfXyG
2021-05-30 16:57:44 [Relaychain] 📦 Highest known block at #0
2021-05-30 16:57:44 [Relaychain] 〽️ Prometheus server started at 127.0.0.1:9616
2021-05-30 16:57:44 [Relaychain] Listening for new connections on 127.0.0.1:9945.
2021-05-30 16:57:44 [Parachain] Using default protocol ID "sup" because none is configured in the chain specs
2021-05-30 16:57:44 [Parachain] 🏷 Local node identity is: 12D3KooWADBSC58of6ng2M29YTDkmWCGehHoUZhsy9LGkHgYscBw
2021-05-30 16:57:44 [Parachain] 📦 Highest known block at #0
2021-05-30 16:57:44 [Parachain] Unable to listen on 127.0.0.1:9945
2021-05-30 16:57:44 [Parachain] Unable to bind RPC server to 127.0.0.1:9945. Trying random port.
2021-05-30 16:57:44 [Parachain] Listening for new connections on 127.0.0.1:45141.
2021-05-30 16:57:45 [Relaychain] 🔍 Discovered new external address for our node: /ip4/192.168.42.204/tcp/30334/ws/p2p/12D3KooWBjYK2W4dsBfsrFA9tZCStb5ogPb6STQqi2AK9awXfXyG
2021-05-30 16:57:45 [Parachain] 🔍 Discovered new external address for our node: /ip4/192.168.42.204/tcp/30333/p2p/12D3KooWADBSC58of6ng2M29YTDkmWCGehHoUZhsy9LGkHgYscBw
2021-05-30 16:57:48 [Relaychain] ✨ Imported #8 (0xe60b…9b0a)
2021-05-30 16:57:49 [Relaychain] 💤 Idle (2 peers), best: #8 (0xe60b…9b0a), finalized #5 (0x1e6f…567c), ⬇ 4.5kiB/s ⬆ 2.2kiB/s
2021-05-30 16:57:49 [Parachain] 💤 Idle (0 peers), best: #0 (0xd42b…f271), finalized #0 (0xd42b…f271), ⬇ 2.0kiB/s ⬆ 1.7kiB/s
2021-05-30 16:57:54 [Relaychain] ✨ Imported #9 (0x1af9…c9be)
2021-05-30 16:57:54 [Relaychain] ✨ Imported #9 (0x6ed8…fdf6)
2021-05-30 16:57:54 [Relaychain] 💤 Idle (2 peers), best: #9 (0x1af9…c9be), finalized #6 (0x3319…69a2), ⬇ 1.8kiB/s ⬆ 0.5kiB/s
2021-05-30 16:57:54 [Parachain] 💤 Idle (0 peers), best: #0 (0xd42b…f271), finalized #0 (0xd42b…f271), ⬇ 0.2kiB/s ⬆ 0.2kiB/s
2021-05-30 16:57:59 [Relaychain] 💤 Idle (2 peers), best: #9 (0x1af9…c9be), finalized #7 (0x5b50…1e5b), ⬇ 0.6kiB/s ⬆ 0.4kiB/s
2021-05-30 16:57:59 [Parachain] 💤 Idle (0 peers), best: #0 (0xd42b…f271), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 16:58:00 [Relaychain] ✨ Imported #10 (0xc9c9…1ca3)

You see messages are from both a relaychain node and a parachain node. This is because a relay chain light client is also run next to the parachain collator.

Parachain Registration

Now that you have two relay chain nodes, and a parachain node accompanied with a relay chain light client running, the next step is to register the parachain in the relay chain with the following steps (for detail, refer to the Substrate Cumulus Worship):

  • Goto Polkadot Apps UI, connecting to your relay chain.
  • Execute a sudo extrinsic on the relay chain by going to Developer -> sudo page.
  • Pick paraSudoWrapper -> sudoScheduleParaInitialize(id, genesis) as the extrinsic type, shown below.

Polkadot Apps UI

  • Set the id: ParaId to 2,000 (or whatever ParaId you used above), and set the parachain: Bool option to Yes.
  • For the genesisHead, drag the genesis state file exported above, para-2000-genesis, in.
  • For the validationCode, drag the genesis wasm file exported above, para-2000-wasm, in.

Note: When registering to the public Rococo testnet, ensure you set a unique paraId larger than 1,000. Values below 1,000 are reserved exclusively for system parachains.

Restart the Parachain (Collator)

The collator node may need to be restarted to get it functioning as expected. After a new epoch starts on the relay chain, your parachain will come online. Once this happens, you should see the collator start reporting parachain blocks:

# Notice the relay epoch change! Only then do we start parachain collating!
#
2021-05-30 17:00:04 [Relaychain] 💤 Idle (2 peers), best: #30 (0xfc02…2a2a), finalized #28 (0x10ff…6539), ⬇ 1.0kiB/s ⬆ 0.3kiB/s
2021-05-30 17:00:04 [Parachain] 💤 Idle (0 peers), best: #0 (0xd42b…f271), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 17:00:06 [Relaychain] 👶 New epoch 3 launching at block 0x68bc…0605 (block slot 270402601 >= start slot 270402601).
2021-05-30 17:00:06 [Relaychain] 👶 Next epoch starts at slot 270402611
2021-05-30 17:00:06 [Relaychain] ✨ Imported #31 (0x68bc…0605)
2021-05-30 17:00:06 [Parachain] Starting collation. relay_parent=0x68bcc93d24a31a2c89800a56c7a2b275fe9ca7bd63f829b64588ae0d99280605 at=0xd42bb78354bc21770e3f0930ed45c7377558d2d8e81ca4d457e573128aabf271
2021-05-30 17:00:06 [Parachain] 🙌 Starting consensus session on top of parent 0xd42bb78354bc21770e3f0930ed45c7377558d2d8e81ca4d457e573128aabf271
2021-05-30 17:00:06 [Parachain] 🎁 Prepared block for proposing at 1 [hash: 0xf6507812bf60bf53af1311f775aac03869be870df6b0406b2969784d0935cb92; parent_hash: 0xd42b…f271; extrinsics (2): [0x1bf5…1d76, 0x7c9b…4e23]]
2021-05-30 17:00:06 [Parachain] 🔖 Pre-sealed block for proposal at 1. Hash now 0x80fc151d7ccf228b802525022b6de257e42388ec7dc3c1dd7de491313650ccae, previously 0xf6507812bf60bf53af1311f775aac03869be870df6b0406b2969784d0935cb92.
2021-05-30 17:00:06 [Parachain] ✨ Imported #1 (0x80fc…ccae)
2021-05-30 17:00:06 [Parachain] Produced proof-of-validity candidate. block_hash=0x80fc151d7ccf228b802525022b6de257e42388ec7dc3c1dd7de491313650ccae
2021-05-30 17:00:09 [Relaychain] 💤 Idle (2 peers), best: #31 (0x68bc…0605), finalized #29 (0xa6fa…9e16), ⬇ 1.2kiB/s ⬆ 129.9kiB/s
2021-05-30 17:00:09 [Parachain] 💤 Idle (0 peers), best: #0 (0xd42b…f271), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 17:00:12 [Relaychain] ✨ Imported #32 (0x5e92…ba30)
2021-05-30 17:00:12 [Relaychain] Moving approval window from session 0..=2 to 0..=3
2021-05-30 17:00:12 [Relaychain] ✨ Imported #32 (0x8144…74eb)
2021-05-30 17:00:14 [Relaychain] 💤 Idle (2 peers), best: #32 (0x5e92…ba30), finalized #29 (0xa6fa…9e16), ⬇ 1.4kiB/s ⬆ 0.2kiB/s
2021-05-30 17:00:14 [Parachain] 💤 Idle (0 peers), best: #0 (0xd42b…f271), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 17:00:18 [Relaychain] ✨ Imported #33 (0x8c30…9ccd)
2021-05-30 17:00:18 [Parachain] Starting collation. relay_parent=0x8c30ce9e6e9867824eb2aff40148ac1ed64cf464f51c5f2574013b44b20f9ccd at=0x80fc151d7ccf228b802525022b6de257e42388ec7dc3c1dd7de491313650ccae
2021-05-30 17:00:19 [Relaychain] 💤 Idle (2 peers), best: #33 (0x8c30…9ccd), finalized #30 (0xfc02…2a2a), ⬇ 0.7kiB/s ⬆ 0.4kiB/s
2021-05-30 17:00:19 [Parachain] 💤 Idle (0 peers), best: #1 (0x80fc…ccae), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 17:00:22 [Relaychain] 👴 Applying authority set change scheduled at block #31
2021-05-30 17:00:22 [Relaychain] 👴 Applying GRANDPA set change to new set [(Public(88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee (5FA9nQDV...)), 1), (Public(d17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae69 (5GoNkf6W...)), 1)]
2021-05-30 17:00:22 [Relaychain] 👴 Imported justification for block #31 that triggers command Changing authorities, signaling voter.
2021-05-30 17:00:24 [Relaychain] ✨ Imported #34 (0x211b…febf)
2021-05-30 17:00:24 [Parachain] Starting collation. relay_parent=0x211b3c53bebeff8af05e8f283d59fe171b7f91a5bf9c4669d88943f5a42bfebf at=0x80fc151d7ccf228b802525022b6de257e42388ec7dc3c1dd7de491313650ccae
2021-05-30 17:00:24 [Parachain] 🙌 Starting consensus session on top of parent 0x80fc151d7ccf228b802525022b6de257e42388ec7dc3c1dd7de491313650ccae
2021-05-30 17:00:24 [Parachain] 🎁 Prepared block for proposing at 2 [hash: 0x10fcb3180e966729c842d1b0c4d8d2c4028cfa8bef02b909af5ef787e6a6a694; parent_hash: 0x80fc…ccae; extrinsics (2): [0x4a6c…1fc6, 0x6b84…7cea]]
2021-05-30 17:00:24 [Parachain] 🔖 Pre-sealed block for proposal at 2. Hash now 0x5087fd06b1b73d90cfc3ad175df8495b378fffbb02fea212cc9e49a00fd8b5a0, previously 0x10fcb3180e966729c842d1b0c4d8d2c4028cfa8bef02b909af5ef787e6a6a694.
2021-05-30 17:00:24 [Parachain] ✨ Imported #2 (0x5087…b5a0)
2021-05-30 17:00:24 [Parachain] Produced proof-of-validity candidate. block_hash=0x5087fd06b1b73d90cfc3ad175df8495b378fffbb02fea212cc9e49a00fd8b5a0
2021-05-30 17:00:24 [Relaychain] 💤 Idle (2 peers), best: #34 (0x211b…febf), finalized #31 (0x68bc…0605), ⬇ 1.0kiB/s ⬆ 130.1kiB/s
2021-05-30 17:00:24 [Parachain] 💤 Idle (0 peers), best: #1 (0x80fc…ccae), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 17:00:29 [Relaychain] 💤 Idle (2 peers), best: #34 (0x211b…febf), finalized #32 (0x5e92…ba30), ⬇ 0.2kiB/s ⬆ 0.1kiB/s
2021-05-30 17:00:29 [Parachain] 💤 Idle (0 peers), best: #1 (0x80fc…ccae), finalized #0 (0xd42b…f271), ⬇ 0 ⬆ 0
2021-05-30 17:00:30 [Relaychain] ✨ Imported #35 (0xee07…38a0)
2021-05-30 17:00:34 [Relaychain] 💤 Idle (2 peers), best: #35 (0xee07…38a0), finalized #33 (0x8c30…9ccd), ⬇ 0.9kiB/s ⬆ 0.3kiB/s
2021-05-30 17:00:34 [Parachain] 💤 Idle (0 peers), best: #1 (0x80fc…ccae), finalized #1 (0x80fc…ccae), ⬇ 0 ⬆ 0
2021-05-30 17:00:36 [Relaychain] ✨ Imported #36 (0xe8ce…4af6)
2021-05-30 17:00:36 [Parachain] Starting collation. relay_parent=0xe8cec8015c0c7bf508bf3f2f82b1696e9cca078e814b0f6671f0b0d5dfe84af6 at=0x5087fd06b1b73d90cfc3ad175df8495b378fffbb02fea212cc9e49a00fd8b5a0
2021-05-30 17:00:39 [Relaychain] 💤 Idle (2 peers), best: #36 (0xe8ce…4af6), finalized #33 (0x8c30…9ccd), ⬇ 0.6kiB/s ⬆ 0.1kiB/s
2021-05-30 17:00:39 [Parachain] 💤 Idle (0 peers), best: #2 (0x5087…b5a0), finalized #1 (0x80fc…ccae), ⬇ 0 ⬆ 0

Note the delay here! It may take some time for your relay chain to enter a new epoch.

Rococo & Westend Relay Chain Testnets

Is this Cumulus Parachain Template Rococo & Westend testnets compatible? Yes!

  • Rococo is the testnet of Kusama (join the Rococo Faucet to get testing funds).
  • Westend is the testnet of Polkadot (join the Westend Faucet to get testing funds).

See the Cumulus Workshop for the latest instructions to register a parathread/parachain on a relay chain.

NOTE: When running the relay chain and parachain, you must use the same tagged version of Polkadot and Cumulus so the collator would register successfully to the relay chain. You should test locally registering your parachain successfully before attempting to connect to any running relay chain network!

Find chainspec files to connect to live networks here. You want to be sure to use the correct git release tag in these files, as they change from time to time and must match the live network!

These networks are under constant development - so please follow the progress and update of your parachains in lock step with the testnet changes if you wish to connect to the network. Do join the Parachain Technical matrix chat room to ask questions and connect with the parachain building teams.

Learn More

  • More detailed instructions to use Cumulus parachains are found in the Cumulus Workshop.
  • Refer to the upstream Substrate Node Template to learn more about the structure of this project, the capabilities it encapsulates and the way in which those capabilities are implemented.
  • Learn more about how a parachain block is added to a finalized chain here.

Download Details:
Author: aresprotocols
Source Code: https://github.com/aresprotocols/substrate-parachain-template
License: Unlicense License

#rust  #blockchain #substrate #parachain #polkadot 

Substrate Parachain Template: A New Cumulus-based Substrate Node

Mars: A Set Of Tools for Writing Substrate based Polkadot Parachains

Cumulus

curl http://localhost:9961 -H "Content-Type:application/json;charset=utf-8" -d "@ocw-aura-alice-01.curl"

A set of tools for writing Substrate-based Polkadot parachains. Refer to the included overview for architectural details, and the Cumulus workshop for a hand-holding walkthrough of using these tools.

It's easy to write blockchains using Substrate, and the overhead of writing parachains' distribution, p2p, database, and synchronization layers should be just as low. This project aims to make it easy to write parachains for Polkadot by leveraging the power of Substrate.

Cumulus clouds are shaped sort of like dots; together they form a system that is intricate, beautiful and functional.

Consensus

cumulus-consensus is a consensus engine for Substrate that follows a Polkadot relay chain. This will run a Polkadot node internally, and dictate to the client and synchronization algorithms which chain to follow, finalize, and treat as best.

Collator

A Polkadot collator for the parachain is implemented by cumulus-collator.

Rococo :crown:

Rococo is the testnet for parachains. It currently runs the parachains Tick, Trick and Track.

Rococo is an elaborate style of design and the name describes the painstaking effort that has gone into this project. Tick, Trick and Track are the German names for the cartoon ducks known to English speakers as Huey, Dewey and Louie.

Build & Launch Rococo Collators

Collators are similar to validators in the relay chain. These nodes build the blocks that will eventually be included by the relay chain for a parachain.

To run a Rococo collator you will need to compile the following binary:

cargo build --release -p polkadot-collator

Once the executable is built, launch collators for each parachain (repeat once each for chain tick, trick, track):

./target/release/polkadot-collator --chain $CHAIN --validator

Parachains

The parachains of Rococo all use the same runtime code. The only difference between them is the parachain ID used for registration with the relay chain:

  • Tick: 100
  • Trick: 110
  • Track: 120

The network uses horizontal message passing (HRMP) to enable communication between parachains and the relay chain and, in turn, between parachains. This means that every message is sent to the relay chain, and from the relay chain to its destination parachain.

Launch a local setup including a Relay Chain and a Parachain

Launch the Relay Chain

# Compile Polkadot with the real overseer feature
git clone https://github.com/paritytech/polkadot
git fetch
git checkout rococo-v1
cargo build --release

# Generate a raw chain spec
./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json

# Alice
./target/release/polkadot --chain rococo-local-cfde.json --alice --tmp

# Bob (In a separate terminal)
./target/release/polkadot --chain rococo-local-cfde.json --bob --tmp --port 30334

Launch the Parachain

# Compile
git clone https://github.com/paritytech/cumulus
git fetch
git checkout rococo-v1
cargo build --release

# Export genesis state
# --parachain-id 200 as an example that can be chosen freely. Make sure to everywhere use the same parachain id
./target/release/polkadot-collator export-genesis-state --parachain-id 200 > genesis-state

# Export genesis wasm
./target/release/polkadot-collator export-genesis-wasm > genesis-wasm

# Collator1
./target/release/polkadot-collator --collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335

# Collator2
./target/release/polkadot-collator --collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336

# Parachain Full Node 1
./target/release/polkadot-collator --tmp --parachain-id <parachain_id_u32_type_range> --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337

Register the parachain

image

Download Details:
Author: aresprotocols
Source Code: https://github.com/aresprotocols/mars
License: GPL-3.0 License

#rust  #blockchain #substrate #parachain #polkadot 

Mars: A Set Of Tools for Writing Substrate based Polkadot Parachains

Substrate Cumulus Parachain Template

Substrate Cumulus Parachain Template

A new Cumulus-based Substrate node, ready for hacking :cloud:

Upstream

This project is a fork of the Substrate Developer Hub Node Template.

Build & Run

Follow these steps to prepare a local Substrate development environment :hammer_and_wrench:

Setup

If necessary, refer to the setup instructions at the Substrate Developer Hub.

Build

Once the development environment is set up, build the node template. This command will build the Wasm and native code:

cargo build --release

Run

Local Relay Chain Testnet

Relay Chain Network(Validators)

We need to clone and install the Polkadot (rococo-v1 branch):

# Get a fresh clone, or `cd` to where you have polkadot already:
git clone git@github.com:paritytech/polkadot.git
cd polkadot
git checkout rococo-v1

# build the polkadot node
cargo build --release

# generaete the chainspec - note this file MUST be shared with all nodes!
# Other nodes cannot generate it due to possible non-determinism 
./target/release/polkadot build-spec --chain rococo-local --raw --disable-default-bootnode > rococo_local.json

# Start Relay `Alice` node
./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay0 --validator --alice --port 50556

Open a new terminal, same directory:

# Start Relay `Bob` node
./target/release/polkadot --chain ./rococo_local.json -d cumulus_relay1 --validator --bob --port 50555

There must be a minimum of 2 relay chain nodes per parachain node. Scale as needed!

Parachain Nodes (Collators)

Substrate Parachain Template:

# NOTE: this command assumes the chain spec is in a directory named polkadot that is a sibling of the working directory
./target/release/kodadot -d local-test --collator --alice --ws-port 9945 --parachain-id 200 -- --chain ../polkadot/rococo_local.json

Note: this chainspec file MUST be shared with all nodes genereated by one validator node and passed around. Other nodes cannot generate it due to possible non-determanism

Registering on Local Relay Chain

Export the Parachain Genesis and Runtime

The files you will need to register we will generate in a ./resources folder, to build them because you modified the code you can use the following commands:

# Build the parachain node (from it's top level dir)
cargo build --release

# Build the Chain spec
./target/release/kodadot build-spec \
--disable-default-bootnode > ./resources/template-local-plain.json

# Build the raw file
./target/release/kodadot build-spec \
--chain=./resources/template-local-plain.json \
--raw --disable-default-bootnode > ./resources/template-local.json


# Export genesis state to `./resources files
./target/release/kodadot export-genesis-state --parachain-id 200 > ./resources/para-200-genesis
# export runtime wasm
./target/release/kodadot export-genesis-wasm > ./resources/para-200.wasm

Register on the Relay with sudo

In order to produce blocks you will need to register the parachain as detailed in the Substrate Cumulus Worship by going to

Developer -> sudo -> paraSudoWrapper -> sudoScheduleParaInitialize(id, genesis)

Ensure you set the ParaId to 200 and the parachain: Bool to Yes.

The files you will need are in the ./resources folder, you just created.

Restart the Parachain (Collator) and Wait...

The collator node may need to be restarted to get it functioning as expected. After a new era starts on the relay chain, your parachain will come online. Once this happens, you should see the collator start reporting parachian blocks:

2021-04-01 16:31:06 [Relaychain] ✨ Imported #243 (0x46d8…f394)    
2021-04-01 16:31:06 [Relaychain] 👴 Applying authority set change scheduled at block #191    
2021-04-01 16:31:06 [Relaychain] 👴 Applying GRANDPA set change to new set [(Public(88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee (5FA9nQDV...)), 1), (Public(d17c2d7823ebf260fd138f2d7e27d114c0145d968b5ff5006125f2414fadae69 (5GoNkf6W...)), 1)]    
2021-04-01 16:31:06 [Relaychain] 👴 Imported justification for block #191 that triggers command Changing authorities, signaling voter.    
2021-04-01 16:31:06 [Parachain] Starting collation. relay_parent=0x46d87d4b55ffcd2d2dde3ee2459524c41da48ac970fb1448feaa26777b14f394 at=0x85c655663ad333b1508d0e4a373e86c08eb5b5353a3eef532a572af6395c45be
2021-04-01 16:31:06 [Parachain] 🙌 Starting consensus session on top of parent 0x85c655663ad333b1508d0e4a373e86c08eb5b5353a3eef532a572af6395c45be    
2021-04-01 16:31:06 [Parachain] 🎁 Prepared block for proposing at 91 [hash: 0x078560513ac1862fed0caf5726b7ca024c2af6a28861c6c69776b61fcf5d3e1f; parent_hash: 0x85c6…45be; extrinsics (2): [0x8909…1c6c, 0x12ac…5583]]    
2021-04-01 16:31:06 [Parachain] Produced proof-of-validity candidate. pov_hash=0x836cd0d72bf587343cdd5d4f8631ceb9b863faaa5e878498f833c7f656d05f71 block_hash=0x078560513ac1862fed0caf5726b7ca024c2af6a28861c6c69776b61fcf5d3e1f
2021-04-01 16:31:06 [Parachain] ✨ Imported #91 (0x0785…3e1f)    
2021-04-01 16:31:09 [Relaychain] 💤 Idle (2 peers), best: #243 (0x46d8…f394), finalized #192 (0x9fb4…4b28), ⬇ 1.0kiB/s ⬆ 3.2kiB/s    
2021-04-01 16:31:09 [Parachain] 💤 Idle (0 peers), best: #90 (0x85c6…45be), finalized #64 (0x10af…4ede), ⬇ 1.1kiB/s ⬆ 1.0kiB/s    
2021-04-01 16:31:12 [Relaychain] ✨ Imported #244 (0xe861…d99d)    
2021-04-01 16:31:14 [Relaychain] 💤 Idle (2 peers), best: #244 (0xe861…d99d), finalized #193 (0x9225…85f1), ⬇ 2.0kiB/s ⬆ 1.6kiB/s    
2021-04-01 16:31:14 [Parachain] 💤 Idle (0 peers), best: #90 (0x85c6…45be), finalized #65 (0xdd20…d44a), ⬇ 1.6kiB/s ⬆ 1.4kiB/s    

Note the delay here! It may take some time for your relaychain to enter a new era.

Learn More

Refer to the upstream Substrate Developer Hub Node Template to learn more about the structure of this project, the capabilities it encapsulates and the way in which those capabilities are implemented. You can learn more about The Path of Parachain Block on the official Polkadot Blog.

Download Details:
Author: kodadot
Source Code: https://github.com/kodadot/metaprime.network
License: Unlicense License

#rust  #blockchain  #substrate #parachain 

Substrate Cumulus Parachain Template

A Parachain on Building Bridges Of Chains Based On PoS Consensus

Install Rust and required tools

curl https://sh.rustup.rs -sSf | sh
make init

Build binary

make build-all-release

Testing

make test-all

Generate runtime weights

if runtime logic change we may do the benchmarking to regenerate WeightInfo for dispatch calls

make run-benchmarking

Testing runtime migration

If modify the storage, should test the data migration before production upgrade.

make try-bifrost-runtime-upgrade

Run development chain

make run-dev

Run local testnet with polkadot-launch

Install polkadot-launch

yarn global add polkadot-launch
cd -

Build polkadot

git clone -n https://github.com/paritytech/polkadot.git /tmp/polkadot
cd /tmp/polkadot
git checkout release-v0.9.13
cargo build --release
cd -

Launch Polkadot and the parachain

cd -
polkadot-launch ./scripts/bifrost-launch.json

It will take about 1-2 minutes for the parachain to start producing blocks.

Run local testnet with parachain-launch

Install parachain-launch

yarn global add @open-web3/parachain-launch

Generate docker files

parachain-launch generate --config=scripts/bifrost-docker-launch.yml --yes

It will pull images and generate required docker files in a folder called output in your current working directory

Start relaychain and parachain

To start the nodes, navigate to the output folder that the generated docker scripts in and start containers:

cd ./output
docker-compose up -d --build

Run full node with docker

Create bifrost-fullnode directory, generate node-key and get bifrost.json

mkdir -p ~/node-key subkey generate-node-key --file ~/node-key/bifrost.key

Start the node with docker

Replace your-fullnode-name

docker pull bifrostnetwork/bifrost:latest
docker run -d \
-v ~/node-key:/node-key \
-p 9944:9944 \
-p 9933:9933 \
-p 30333:30333 \
bifrostnetwork/bifrost:latest \
  --name your-fullnode-name \
  --base-path "/data" \
  --node-key-file "/node-key/bifrost.key" \
  --chain "/spec/bifrost.json" \
  --pruning=archive \
  --rpc-external \
  --ws-external \
  --rpc-cors all \
  --state-cache-size 0 \
  --execution wasm

Download Details:
Author: bifrost-finance
Source Code: https://github.com/bifrost-finance/bifrost
License: GPL-3.0 License

#rust  #blockchain  #substrate #web3 #parachain #defi 

A Parachain on Building Bridges Of Chains Based On PoS Consensus

Cumulus: A Set Of Tools for Writing Substrate-based Polkadot Parachain

Cumulus

A set of tools for writing Substrate-based Polkadot parachains. Refer to the included overview for architectural details, and the Cumulus tutorial for a guided walk-through of using these tools.

It's easy to write blockchains using Substrate, and the overhead of writing parachains' distribution, p2p, database, and synchronization layers should be just as low. This project aims to make it easy to write parachains for Polkadot by leveraging the power of Substrate.

Cumulus clouds are shaped sort of like dots; together they form a system that is intricate, beautiful and functional.

Consensus

parachain-consensus is a consensus engine for Substrate that follows a Polkadot relay chain. This will run a Polkadot node internally, and dictate to the client and synchronization algorithms which chain to follow, finalize, and treat as best.

Collator

A Polkadot collator for the parachain is implemented by the polkadot-collator binary.

Statemint 🪙

This repository also contains the Statemint runtime (as well as the canary runtime Statemine and the test runtime Westmint). Statemint is a common good parachain providing an asset store for the Polkadot ecosystem.

Build & Launch a Node

To run a Statemine or Westmint node (Statemint is not deployed, yet) you will need to compile the polkadot-collator binary:

cargo build --release --locked -p polkadot-collator

Once the executable is built, launch the parachain node via:

CHAIN=westmint # or statemine
./target/release/polkadot-collator --chain $CHAIN

Refer to the setup instructions below to run a local network for development.

Rococo :crown:

Rococo is becoming a Community Parachain Testbed for parachain teams in the Polkadot ecosystem. It supports multiple parachains with the differentiation of long-term connections and recurring short-term connections, to see which parachains are currently connected and how long they will be connected for see here.

Rococo is an elaborate style of design and the name describes the painstaking effort that has gone into this project.

Build & Launch Rococo Collators

Collators are similar to validators in the relay chain. These nodes build the blocks that will eventually be included by the relay chain for a parachain.

To run a Rococo collator you will need to compile the following binary:

cargo build --release --locked -p polkadot-collator

Otherwise you can compile it with Parity CI docker image:

docker run --rm -it -w /shellhere/cumulus \
                    -v $(pwd):/shellhere/cumulus \
                    paritytech/ci-linux:production cargo build --release --locked -p polkadot-collator
sudo chown -R $(id -u):$(id -g) target/

If you want to reproduce other steps of CI process you can use the following guide.

Once the executable is built, launch collators for each parachain (repeat once each for chain tick, trick, track):

./target/release/polkadot-collator --chain $CHAIN --validator

Parachains

The network uses horizontal message passing (HRMP) to enable communication between parachains and the relay chain and, in turn, between parachains. This means that every message is sent to the relay chain, and from the relay chain to its destination parachain.

Local Setup

Launch a local setup including a Relay Chain and a Parachain.

Launch the Relay Chain

# Compile Polkadot with the real overseer feature
git clone https://github.com/paritytech/polkadot
cargo build --release

# Generate a raw chain spec
./target/release/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > rococo-local-cfde.json

# Alice
./target/release/polkadot --chain rococo-local-cfde.json --alice --tmp

# Bob (In a separate terminal)
./target/release/polkadot --chain rococo-local-cfde.json --bob --tmp --port 30334

Launch the Parachain

# Compile
git clone https://github.com/paritytech/cumulus
cargo build --release

# Export genesis state
./target/release/polkadot-collator export-genesis-state > genesis-state

# Export genesis wasm
./target/release/polkadot-collator export-genesis-wasm > genesis-wasm

# Collator1
./target/release/polkadot-collator --collator --alice --force-authoring --tmp --port 40335 --ws-port 9946 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30335

# Collator2
./target/release/polkadot-collator --collator --bob --force-authoring --tmp --port 40336 --ws-port 9947 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30336

# Parachain Full Node 1
./target/release/polkadot-collator --tmp --port 40337 --ws-port 9948 -- --execution wasm --chain ../polkadot/rococo-local-cfde.json --port 30337

Register the parachain

image

Containerize

After building polkadot-collator with cargo or with Parity CI image as documented in this chapter, the following will allow producing a new docker image where the compiled binary is injected:

./docker/scripts/build-injected-image.sh

Alternatively, you can build an image with a builder pattern:

docker build --tag $OWNER/$IMAGE_NAME --file ./docker/polkadot-collator_builder.Containerfile .

You may then run your new container:

```bash
docker run --rm -it $OWNER/$IMAGE_NAME --collator --tmp --execution wasm --chain /specs/westmint.json

Download Details:
Author: paritytech
Source Code: https://github.com/paritytech/cumulus
License: GPL-3.0 License

#rust  #blockchain  #substrate #parachain 

Cumulus: A Set Of Tools for Writing Substrate-based Polkadot Parachain
aaron silva

aaron silva

1620893766

Complete guide on integrating Polkadot Development Platform for your business growth

“The Polkadot Development Platform has a demandable market in the digital world as it raised the economic growth of many industries after integrating the protocol for launch. The Polkadot protocol has increased the market cap upto 30% in February, 2021. The Polkadot network is gaining more popularity for taking the blockchain projects to the next level for initiating parallel transactions. The growth of the Polkadot protocol in the blockchain world is expected to reap more than $20 billion in the second half of 2021.”

The Polkadot Development has brought efficient changes to the blockchain industry. Polkadot is considered a blockchain protocol that connects various specialized blockchains into a single network. It is a protocol built on previously launched blockchain networks like Ethereum and TRON for better performance over fund transactions. The Polkadot blockchain acts as a framework for investors to build their own blockchains in a transparent method. The traders can experience seamless transactions of funds on different blockchain platforms.

What is Polkadot?

The Polkadot is a global blockchain protocol that enables transferring of data across various blockchain systems. It is initiated similarly to DeFi infrastructure for maintaining transparency, adaptability and heterogeneous sharding. The Polkadot is a sharded multichain network that enables users to experience multiple transactions on various chains parallelly. The Polkadot network eliminates the need for intermediaries for users to experience less wait time and reduced transaction fee.

The Polkadot protocol performs better than traditional networks since it transacts funds one by one. The applications built on Polkadot blockchain are powered using parallel processing for improving the scalability of transactions for future growth. Sharded chains connected with Polkadot are called Parachains for transacting funds parallelly in the network. The integration of the Polkadot protocol on the blockchain platform is entirely decentralized for managing the transactions. The investments towards the Polkadot network brings high returns for investors in the long run.

What is the role of Parachain in Polkadot Protocol?

The Parachain is considered a blockchain application containing a specific data structure that is globally validatable and coherent over the relay chain. The Parachain resembles the form of blockchain but exactly not a blockchain. The parallelized chain runs parallel to the relay chain for bringing the term Parchain concept to the blockchain world. It is noticed that Parchains functions parallely to transact funds instantly for achieving scalability of the Polkadot network.

It is initialized with security systems in the blockchain network for communicating with other Parachains via XCMP. The entire network of Pararchain is maintained by ‘Collator’ to control every node for retaining important information without any loss. The produced new block candidates are validated and sent to pass through the relay chain for verification and further added to Polkadot protocol.

How efficiently Polkadot Protocol works?

The Polkadot blockchain has functioned mainly through the support of four best elements like Relay Chain, Parachains, Parathreads and bridges. Each element contributes its own efficiency to make the Polkadot network perform efficiently by connecting with various blockchain platforms. The Polkadot protocol is a cross-chain platform that connects multiple blockchain networks for executing parallel transactions seamlessly. The creation of the Polkadot application enables investors to gain access to data through a private blockchain and allows it to be used on public blockchain as well.

  • Relay Chain is considered as the central Polkadot blockchain for validating entire transactions efficiently in the network. It takes the responsibility to separate new transactions on the chain for users to experience fast transactions over contemporaries. The relay chain benefits from maintaining high security, cross-chain interoperability and consensus in the blockchain network.

  • Parachains is considered an independent blockchain that runs parallel to the Relay Chain for maintaining the accuracy of transaction flow in the Polkadot network. Each Parchain on the Polkadot blockchain development services is responsible for managing transactions for specific purposes. The Collator is assigned in Parachain for maintaining produced blocks on the chain.

  • Parathreads are initiated for operating the entire Parachain since they differ from fee structure. The registration process in Parchin is executed through slot auctions or governance proposals on the Polkadot blockchain. However, it is noted that there is a specific fee for the Parathread registration process that charges less compared to Parachain and the process seems to be simple for new and existing traders.

  • Bridges are considered special Parachains in the Polkadot ecosystem since they connect the blockchain internally and externally like Bitcoin and Ethereum. It enables the user to experience seamless transaction of tokens between the Polkadot blockchain and other external networks by eliminating the need for centralized exchange. In this way, users can experience the power of parallel transactions in the Polkadot network.

What are the benefits offered in the Polkadot network?

  • The inheritance of Parachain in the Polkadot protocol benefits the investors with identity management and service for finance on various blockchain platforms.
  • Integration of the Polkadot network in the blockchain platform is fully decentralized for efficient transactions to occur.
  • The initialization of the Polkadot protocol has increased the speed of transaction, supports data processing, and benefits with high trade volume in less time.
  • It has high-end multi-layer security protocols present in Polkadot protocol for preventing various hacks and vulnerable activities.
  • It offers a better user interface to gain a wide range of audience attention for enhancing transactions on the Polkadot blockchain.
  • There is a possibility of creating new blockchains or Para Chains with the Polkadot network by connecting the main blockchain.
  • The Parachains can adopt a governance model for accessing pre-built modules present on different on-chain governance tokens.
  • The Polkadot blockchain is highly interoperable for users to gain complete control over their transaction details.
  • It enables users to experience the exchange of tokens and verifying credentials on Polkadots cross-chain model for engaging with continuous trade in the marketplace.
  • The Polkadot network updates itself based on the market trends to benefit the growth of investor’s business.

Summing Up :

The Polkadot development platform is new to the digital world and created massive demand after its launch in the marketplace. Many investors and industries stepped forward in exploring the extensive benefits of integrating Polkadot protocol for their business growth. The investment towards the Polkadot blockchain generated more revenue for investors in less time. Investors can approach any blockchain company with professional experience in offering proper guidance towards developing a world-class Polkadot protocol at an affordable price for competing with others in the trade market.

#polkadot development platform #polkadot development #parachain #polkadot blockchain

Complete guide on integrating Polkadot Development Platform for your business growth

Parachain là gì? BẢN CHẤT Parachain protocol của Polkadot là gì?

Parachain là gì?
Parachain là gì? Được định nghĩa là một loạt chuỗi con trực thuộc mạng lưới chính của Polkadot, có thể hoạt động độc lập. Parachain là một nhánh blockchain được gắn với chuỗi chính Relay Chain của Pokadot, chuỗi này kết nối với chuỗi chính dựa trên các giao thức và trình thiết kế cơ sở dữ liệu proof of Sharding, kết hợp trình xác thực Proof of Validity, và Proof of Stake để tạo khối.

#parachain

Parachain là gì? BẢN CHẤT Parachain protocol của Polkadot là gì?

How to convert a Substrate FRAME based runtime into a Cumulus Parachain runtime

This workshop focuses on showing how to convert a Substrate FRAME based runtime into a Cumulus parachain runtime. The Polkadot relay chain will allow two Parchains to interact in a decentralized and reliable way.

We will simulate a real case scenario in which one parachain pays another parachain for the services it did on their behalf.

Talk: Parachains Workshop
Speakers: Ricardo Rius · Runtime Engineer, Parity
Recorded at Sub0 Online on October 15th, 2020

#substrate #cumulus #parachain #blockchain

How to convert a Substrate FRAME based runtime into a Cumulus Parachain runtime
Nandu Singh

Nandu Singh

1603424530

How to build a Polkadot Parachain

What is a Polkadot Parachain?

A parachain is an application-specific data structure that is globally coherent and validatable by the validators of the Polkadot Relay Chain. Most commonly a parachain will take the form of a blockchain, but there is no specific need for them to be actual blockchains. They take their name from the concept of parallelized chains that run parallel to the Relay Chain. Due to their parallel nature, they are able to parallelize transaction processing and achieve scalability of the Polkadot system. They share in the security of the entire Polkadot network and can communicate with other parachains through XCMP.

Parachains are maintained by a network maintainer known as a collator. The role of the collator node is to maintain a full-node of the parachain, retain all necessary information of the parachain, and produce new block candidates to pass to the Relay Chain validators for verification and inclusion in the shared state of Polkadot. The incentivization of a collator node is an implementation detail of the parachain (see parachain economies). They are not required to be staked on the Relay Chain or own DOT tokens unless stipulated to do so by the parachain implementation.

The Polkadot Host (PH) allows for the state transitions performed on parachains to be specified as a Wasm executable. Proofs of new state transitions that occur on a parachain must be validated against the registered state transition function (STF) that is stored on the Relay Chain by the validators before Polkadot acknowledges a state transition has occurred on a parachain. The only constraint to the logic that a parachain is allowed to implement is that it must be verifiable by the Relay Chain validators. Verification most commonly takes the form of a bundled proof of a state transition known as a Proof-of-Verification (PoV) block, which is submitted to the validators from one or more of the parachain collators to be checked.

Parachain economies

Parachains may have their own economies with their own native tokens. Schemes such as Proof-of-Stake are usually used to select the validator set in order to handle validation and finalization; parachains will not be required to do either of those things. However, since Polkadot is general over what the parachain can implement, it may be the choice of the parachain to implement a staking token, but it’s not generally necessary.

Collators may be incentivized through inflation of a native parachain token. There may be other ways to incentivize the collator nodes that do not involve inflating the native parachain token.

Transaction fees in a native parachain token can also be an implementation choice of parachains. Polkadot makes no hard and fast rules for how the parachains decide on original validity of transactions. For example, a parachain may be implemented so that transactions must pay a minimum fee to collators to be valid. The Relay Chain will enforce this validity. Similarly, a parachain could not include that in their implementation and Polkadot would still enforce its validity.

Parachains are not required to have their own token. If they do, is up to the parachain to make the economic case for their token, not Polkadot.

via https://wiki.polkadot.network/docs/en/learn-parachains

#polkadot #parachain #blockchain

How to build a Polkadot Parachain