DAWN Chain (cluster)

Requirements

  • Go 1.13

Deployment of smart contract

Set-up

# Into the Project Directory=>

cd testnet-contracts/

# Create .env with sample environment variables
cp .env.example .env

# Add environment variable MNEMONIC from your MetaMask account in .env file.

# Add environment variable INFURA_PROJECT_ID from your Infura account in .env file.

Running the bridge on the Ropsten testnet

cd testnet-contracts/

Now run the following commands..

# Deploy contract to ropsten network
yarn migrate --network ropsten

# Get contract's address
yarn peggy:address --network ropsten

Set up the nodes and validators

node-1

Open a terminal and run the following commands. Let's call it as terminal-1

# Install tools (golangci-lint v1.18)
make tools-clean
make tools

# Install the app into your $GOBIN
make install

# Now you should be able to run the following commands, confirming the build is successful:
fbd help
fbcli help
fbrelayer help

Running and testing the application

First, initialise a chain and create accounts.

# Initialize the genesis.json file that will help you to bootstrap the network
fbd init node1 --chain-id=fbchain

# Create a key to hold your validator account and for another test account
fbcli keys add validator1
# Enter password

fbcli keys add testuser
# Enter password

# Edit the genesis.json file for customised stake denom
# on terminal go to folder ~/.fbd/config/genesis.json
# Edit the staking section having bond_denom key from "stake" to "fbx"
# Save and close the file.


# Initialize the genesis account and transaction
fbd add-genesis-account $(fbcli keys show validator1 -a) 1000000000fbx,1000000000fbc

# Create genesis transaction
fbd gentx --name validator1 --amount 1000000fbx
# Enter password

# Collect genesis transaction
fbd collect-gentxs

#Add Customisation to genesis file
# on terminal go to folder ~/.fbd/config/genesis.json
Replace '"staking"' section with the json mentioned in customised_genesis.json (which is in Project Directory)

# Now its safe to start `fbd`
fbd start

Start the relayer service

For automated relaying, there is a relayer service that can be run that will automatically watch and relay events (local web socket and deployed address parameters may vary).

Open a new terminal and run the following commands. Let's call it as terminal-2

# Check fbrelayer connection to ebd
fbrelayer status

# Start fbrelayer on the contract's deployed address with [PEGGY_DEPLOYED_ADDRESS]

fbrelayer init wss://ropsten.infura.io/ws [PEGGY_DEPLOYED_ADDRESS] LogLock\(bytes32,address,bytes,address,string,uint256,uint256\) validator1 --chain-id=fbchain
# Enter password and press enter
# You should see a message like: Started ethereum websocket with provider: wss://ropsten.infura.io/ws \ Subscribed to contract events on address: [PEGGY_DEPLOYED_ADDRESS]
# The relayer will now watch the contract on Ropsten and create a claim whenever it detects a lock event.

#Using the application from rest-server

fbcli rest-server --trust-node

node-2

Now, on terminal-1, run the following commands

# Install tools (golangci-lint v1.18)
make tools-clean
make tools

# Install the app into your $GOBIN
make install

# Now you should be able to run the following commands, confirming the build is successful:
fbd help
fbcli help
fbrelayer help

Running and testing the application

# Initialize the genesis.json file with another moniker and same namechain
fbd init node2 --chain-id=fbchain

# Create a key to hold your validator account and for another test account
fbcli keys add validator2
# Enter password

overwrite ~/.fbd/config/genesis.json with first nodes genesis.json

#change persistent_peers
#run `fbcli status` on first node to get id.
go to ~/.fbd/config/config.toml
persistent_peers = "<id_of_node1>@<ip>:<26656>"


# Now its safe to start `fbd`
fbd start

node-1

# Then, wait 10 seconds and from first node send tokens to valdator2 address for testing
fbcli tx send validator1 <validator2> 10000fbx --chain-id=fbchain --yes
run "fbcli keys show validator2" on second node to get validator2 address.

terminal-2

# Next, setup the staking module prerequisites
# First, create a validator and stake
fbcli tx staking create-validator \
  --amount=1000fbx \
  --pubkey=$(fbd tendermint show-validator) \
  --moniker="node2" \
  --chain-id=fbchain \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --gas=200000 \
  --gas-prices="0.001fbx" \
  --from=validator2

terminal-3

Start the Relayer service

For automated relaying, there is a relayer service that can be run that will automatically watch and relay events (local web socket and deployed address parameters may vary).

# Check fbrelayer connection to ebd
fbrelayer status

# Start fbrelayer on the contract's deployed address with [PEGGY_DEPLOYED_ADDRESS]

fbrelayer init wss://ropsten.infura.io/ws [PEGGY_DEPLOYED_ADDRESS] LogLock\(bytes32,address,bytes,address,string,uint256,uint256\) validator2 --chain-id=fbchain
# Enter password and press enter
# You should see a message like: Started ethereum websocket with provider: wss://ropsten.infura.io/ws \ Subscribed to contract events on address: [PEGGY_DEPLOYED_ADDRESS]
# The relayer will now watch the contract on Ropsten and create a claim whenever it detects a lock event.

#Using the application from rest-server

fbcli rest-server --trust-node

node-3

Terminal-1

# Install tools (golangci-lint v1.18)
make tools-clean
make tools

# Install the app into your $GOBIN
make install

# Now you should be able to run the following commands, confirming the build is successful:
fbd help
fbcli help
fbrelayer help

Running and testing the application

First, initialize a chain and create accounts.

# Initialize the genesis.json file with another moniker and same namechain
fbd init node3 --chain-id=fbchain

# Create a key to hold your validator account and for another test account
fbcli keys add validator3
# Enter password

overwrite ~/.fbd/config/genesis.json with first nodes genesis.json

#change persistent_peers

go to ~/.fbd/config/config.toml
persistent_peers = "id@first_node_ip:26656, id@second_node_ip:26659"
run "fbcli status" on first node to get first_node id.
run "fbcli status" on second node to get second_node id.

# Now its safe to start `fbd`
fbd start

From node-1

# Then, wait 10 seconds and from first node send tokens to valdator3 address for testing
fbcli tx send validator1 <validator3> 10000fbx --chain-id=fbchain --yes
run "fbcli keys show validator3" on third node to get validator3 address.

Terminal-2

# Next, setup the staking module prerequisites
# First, create a validator and stake
fbcli tx staking create-validator \
  --amount=900fbx \
  --pubkey=$(fbd tendermint show-validator) \
  --moniker="node3" \
  --chain-id=fbchain \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --gas=200000 \
  --gas-prices="0.001fbx" \
  --from=validator3

Start the Relayer service

For automated relaying, there is a relayer service that can be run that will automatically watch and relay events (local web socket and deployed address parameters may vary). On terminal-3, run the following commands

# Check fbrelayer connection to ebd
fbrelayer status

# Start fbrelayer on the contract's deployed address with [PEGGY_DEPLOYED_ADDRESS]

fbrelayer init wss://ropsten.infura.io/ws [PEGGY_DEPLOYED_ADDRESS] LogLock\(bytes32,address,bytes,address,string,uint256,uint256\) validator3 --chain-id=fbchain
# Enter password and press enter
# You should see a message like: Started ethereum websocket with provider: wss://ropsten.infura.io/ws \ Subscribed to contract events on address: [PEGGY_DEPLOYED_ADDRESS]
# The relayer will now watch the contract on Ropsten and create a claim whenever it detects a lock event.

#Using the application from rest-server

fbcli rest-server --trust-node

Last updated