Skip to content

Instantly share code, notes, and snippets.

@emostov
Last active April 29, 2021 01:14
Show Gist options
  • Select an option

  • Save emostov/a58f887fce6af8a9b4aa2421114836c5 to your computer and use it in GitHub Desktop.

Select an option

Save emostov/a58f887fce6af8a9b4aa2421114836c5 to your computer and use it in GitHub Desktop.
Launch a local rococo test net with Alice & Bob

start up a local rococo testnetwork network

1 ) Start alice

cargo run -- \
  --base-path /tmp/alice \
  --chain rococo-local \
  --alice \
  --port 30333 \
  --ws-port 9944 \
  --rpc-port 9933 \
  --node-key 0000000000000000000000000000000000000000000000000000000000000001 \
  --validator

Alice's local node identity as shown in the stdout logs:

🏷 Local node identity is: 12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp    

2 ) Start bob

cargo run -- \
  --base-path /tmp/bob \
  --chain rococo-local \
  --bob \
  --port 30334 \
  --ws-port 9946 \
  --rpc-port 9934 \
  --validator \
  --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp

clear DBs for alice and bob

Clear Alice

cargo run -- purge-chain \
  --base-path /tmp/alice \
  --chain rococo-local

Clear Bob

cargo run -- purge-chain \
  --base-path /tmp/bob \
  --chain rococo-local

Parachain setup

Register a Parachain

registrar::register(
    paraId: 1 # increment this number to register more parathreads
    genesis_head: "0xffff", # arbitrary value
    validation_code: "0x0061736d01000000" # wasm magic number
)

start a crowdloan

crowdloan::create(
  paraId: 1,
  cap: 5000,
  first_period: 1,
  last_period: 4,
  end: 2000,
)

Can contribute before and during auction with crowdloan::contribute

start an auction

sudo(
  auctions::newAuction(
    duration: 100,
    lease_period_index: 1
  )
)

make a bid

auctions::bid(
  para: 1,
  auction_index: 1,
  first_slot: 2,
  last_slot: 4,
  amount: 100,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment