Home

Awesome

Jupiter

Wasm smart contract networks powered by Substrate FRAME Contracts pallet in Polkadot ecosystem.

Jupiter aims to be an open blockchain network, which supports contract developers to use ink!, Ask! and other language frameworks which can run on FRAME Contracts pallet contract model. We will directly use DOT(test coin)/ROC(rococo coin) as native token for gas fee and governance.

For different requirements, this repo contains different runtime for different situations (The content in following parentheses is the name of the executable file):

In post, we use rococo-v1 branch for parachain. And now the rococo-v1 branch do not need anymore.

In following, we name FRAME contracts pallet as pallet-contracts

Patract's FRAME contracts pallet (We will name it as pallet-patracts in future)

Patract FRAME contracts pallet contains our ChainExtension to provide many particular features for contracts, and contains some compatible modifications.

Thus we call "src pallet-contract" for the pallet-contract module which comes from substrate directly, and call "modified pallet-contracts" for the pallet-contract which comes from our forked substrate repo in vendor directory.

Inside:

Jupiter living network

When using Substrate Portal, @polkadot/api and Redspot or other 3rd parties client to connect Jupiter node, please remember to add "extending types" for Jupiter requirements. Notice different network may have different Extending types.

Now, Jupiter has launched following network:

compile and run

1. clone this repo

> git clone --recurse-submodules https://github.com/patractlabs/jupiter.git
## or do following commands
> git clone https://github.com/patractlabs/jupiter.git
> cd jupiter/vendor
> git submodule update --init --recursive

2. init building environment

Note: if you have build substrate successfully, you do not need to do this any more

You should prepare rust environment before, lookup this link for rust to downland rust and install it.

then:

> cd jupiter/scripts
> bash init.sh

3. compile this repo

Compile this repo follow this step:

> WASM_BUILD_TYPE=release cargo build --release

or we advice you to add WASM_BUILD_TYPE=release in your global environment variables, so that you could just execute:

cargo build --release

If you just need debug execution file, just do

cargo build

4. run

When running node, following parameters means:

More parameters please lookup from --help or Substrate Developer Hub https://substrate.dev/

4.1 Jupiter PoA

The blockchain produces blocks in babe algorithm for every 6 second, and do finality by grandpa algorithm. All people could join this testnet as a sync node.

Welcome use this link https://app.element.io/#/room/#jupiter-faucet-room:matrix.org to claim some DOT from our faucet

4.1.1 join Jupiter PoA testnet

Moving the execution file jupiter-prep to other place and launch the node by following steps:

./jupiter-prep --chain=jupiter-poa --name=<set you custom name> --pruning=archive --execution=NativeElseWasm

Those steps is same to any other substrate node, just should notice this parameter --chain should use jupiter.

You could lookup your node in https://telemetry.patract.io/.

4.1.2 start dev mode Jupiter PoA blockchain

Notice this dev mode just means Jupiter PoA start with --dev, which is using dev config to start Jupiter PoA, not the jupiter-dev node.

./jupiter-prep --dev --execution=NativeElseWasm -d <database path for you>
4.1.2 start local test mode Jupiter PoA blockchain

Local test is a mode which is used to start a private blockchain network.

# start first node
./jupiter-prep --chain=jupiter-poa-local --alice --execution=NativeElseWasm -d <database path for you>
# start second node
./jupiter-prep --chain=jupiter-poa-local --bob --execution=NativeElseWasm -d <database path for you>

Note if you start those two nodes in a machine, there could connect to each other directly. If you start in different but in same network, you should add --bootnodes parameter when start second node. More details please lookup https://substrate.dev/

4.2 Jupiter

currently, we add Sandbox HostFunction in relaychain(westend) to support parachain contract, so if you want to running on test environment, you should add Sandbox HostFunction to relaychain.

4.2.1 start local test mode Jupiter Parachain

Export relaychain json:

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

Custom parachain specification:

./target/release/jupiter build-spec --chain jupiter-dev --disable-default-bootnode > westend-local-parachain-plain.json

Default para ID is 1000 from Cumulus, so you must correctly set it for your parachain based on the reserved para ID from above. Assuming your reserved para ID is 2000, you will open rococo-local-parachain-plain.json and modify two fields:

// --snip--
  "para_id": 2000, // <--- your already registered ID
  // --snip--
      "parachainInfo": {
        "parachainId": 2000 // <--- your already registered ID
      },
  // --snip--

Then generate a raw chain spec derived from your modified plain chain spec:

./target/release/jupiter build-spec --chain westend-local-parachain-plain.json --raw --disable-default-bootnode > westend-local-parachain-2000-raw.json

Obtain Wasm runtime validation function:

./target/release/jupiter export-genesis-wasm --chain westend-local-parachain-2000-raw.json > para-wasm

Generate a parachain genesis state:

./target/release/jupiter export-genesis-state --chain westend-local-parachain-2000-raw.json > para-genesis

Run parachain:

./target/release/jupiter \
  --alice \
  --collator \
  --force-authoring \
  --chain westend-local-parachain-2000-raw.json \
  --tmp \
  --port 40333 \
  --ws-port 8844 \
  -- \
  --execution wasm \
  --chain westend-local.json \
  --port 30343 \
  --ws-port 9977

After running relaychain and parachain, upload parachain genenis file to relaychain. refere this link.

4.2.2 join Jupiter Parachain testnet

For now, we only running our own private parachain(collator) node use aura algorithm, outside node should running in sync mode.

./jupiter --chain ./jupiter-westend-patract.json --execution wasm --wasm-execution=compiled --force-authoring --parachain-id=2000 --tmp \
--chain ./westend-patract.json --no-beefy --execution wasm --wasm-execution=compiled --tmp \
--bootnodes /dns/ws.patract-westend.patract.cn/tcp/30333/p2p/12D3KooWFBrd6SrevJ4vLi3SY7KRYQEVbRSeoENmdDouAW7wGCvZ

Notice, currently we didn't make seed node into westend-patract.json, so you have to specify our private westend bootnode.

4.3 Jupiter Dev Node

jupiter-dev just use for local development, it providers a nice and quick experience for contract developing for developers do not need wait for producing block time, which is very wasting time in testing.

running jupiter-dev node in your machine:

./jupiter-dev --dev -d .sub --execution=Native

5. https://polkadot.js.org/apps/ or https://github.com/polkadot-js/apps or using for polkadot-js sdk

Now, Jupiter has provided in apps. And we would provide Jupiter Rococo in TEST RELAYS & PARACHAINS soon.