Skip to content

Latest commit

 

History

History
141 lines (106 loc) · 3.7 KB

tutorial.md

File metadata and controls

141 lines (106 loc) · 3.7 KB

install rust environment

install rust environment

clone project

git clone https://github.com/ChainSupport/frontier-pos-template.git
cd frontier-pos-template

build

build local node

run testnet node

cargo build --release --features testnet
./target/release/substrate --dev --alice

Unit tests

cargo test -p babe-consensus-data-provider -- --nocapture
cargo test -p ecdsa-keyring -- --nocapture

Generate test coverage report

cargo clean
cargo tarpaulin --out html --run-types Tests -p babe-consensus-data-provider
cargo clean
cargo tarpaulin --out html --run-types Tests -p ecdsa-keyring

Cargo clippy

cargo clippy --features testnet
cargo clippy --features mainnet

docker build

build node docker

run by docker

docker-compose up

explorer

Here, we can see that two validators are randomly producing blocks, fully compatible with NPOS (Nominated Proof-of-Stake).

Connect MetaMask Wallet

The following steps assume that you have already created a wallet address. If you haven't created a wallet yet, please create one in MetaMask first.

  1. Add your network to MetaMask.

    Network name: Frontier Testnet
    Default RPC URL: http://localhost:9944
    Chain ID: 42
    Currency symbol: UNIT
    
    add_network_to_metamask
  2. Connect to your network and copy your wallet address.

    1. select network
    before_select
    2. copy your address
    copy your address
  3. Use CHARLETH to transfer UNIT to your wallet address in the explorer. Your MetaMask wallet will display the balance.

    1. transfer
      charleth transfer
    2. balance
      balance

Run your scan (Blockscout)

Transactions in the EVM can be viewed on this scan.

  1. deploy

    git clone https://github.com/ChainSupport/blockscout.git
    cd blockscout/docker-compose
    
    docker-compose up --build
    
  2. When you send token to any address from MetaMask, you will find the transfer record on the scan.

    1. Send token by MetaMask
      transfer
    2. transactions
      transaction

Note: Currently, Blockscout does not support displaying native transfer records, meaning transactions made through the Balances pallet are not shown here. (We plan to provide support for this in the future.)

Deploy a smart contract

Option 1: Remix

  1. Visit Remix remix

  2. Select a network select network for remix

  3. Compile and deploy the smart contract

    1. Compoile compile 2_Owner
    2. deploy deploy 2_Owner

Option 2: hardhat

https://hardhat.org/tutorial