Git Product home page Git Product logo

node-deploy's Introduction

Deployment tools of BC-BSC

Installation

Before proceeding to the next steps, please ensure that the following packages and softwares are well installed in your local machine:

  • solc: 0.6.4
  • nodejs: 12.18.3
  • npm: 6.14.6
  • go: 1.18+
  • expect
  • foundry
  • jq If you would setup nodes on k8s environment, the following packages and softwares are neccessary:
  • helm: 3.9.4
  • minikube: 1.29.0
  • docker: 20.10.22
  • kubectl: 1.26.1

Quick Start

  1. Clone this repository
git clone https://github.com/bnb-chain/node-deploy.git
  1. For the first time, please execute the following command
git submodule update --init --recursive
  1. Make geth, bootnode, bnbchaind, tbnbcli binary files, and put them into bin/ folder.
git clone https://github.com/bnb-chain/bsc.git
cd bsc && make geth
go build -o ./build/bin/bootnode ./cmd/bootnode

cp ./build/bin/geth ../bin/geth
cp ./build/bin/bootnode ../bin/bootnode

git clone https://github.com/bnb-chain/node.git
cd node && make build
cp ./build/tbnbcli ../bin/tbnbcli
cp ./build/bnbchaind ../bin/bnbchaind

git clone [email protected]:bnb-chain/test-crosschain-transfer.git
cd test-crosschain-transfer && go build
cp ./test-crosschain-transfer ../bin/test-crosschain-transfer
  1. Make tool binary
make tool
  1. Configure the cluster

You can configure the cluster by modifying the following files:

  • config.toml
  • genesis/genesis-template.json
  • .env
  1. Setup all nodes. two different ways, choose as you like.

On Kubernetes environment

#on k8s environment
minikube start

bash +x ./setup_bc_node.sh init
bash +x ./setup_bc_node.sh install_k8s
kubectl port-forward svc/bc-node-0 26657:26657 -n bc

bash +x ./setup_bsc_node.sh register
bash +x ./setup_bsc_node.sh generate_k8s
bash +x ./setup_bsc_node.sh install_k8s
kubectl -n bsc port-forward svc/bsc-node-0 8545:8545

bash +x ./setup_oracle_relayer.sh docker
bash +x ./setup_oracle_relayer.sh install_k8s

bash +x ./setup_bsc_relayer.sh docker
bash +x ./setup_bsc_relayer.sh install_k8s

Natively

#native deploy without docker
rm -rf .local

bash +x ./setup_bc_node.sh native_init 
bash +x ./setup_bc_node.sh native_start 

bash +x ./setup_bsc_node.sh native_init
bash +x ./setup_bsc_node.sh native_start

bash +x ./setup_bsc_relayer.sh native_init
bash +x ./setup_bsc_relayer.sh native_start 

bash +x ./setup_oracle_relayer.sh native_init
bash +x ./setup_oracle_relayer.sh native_start 

or simply

# native deploy
bash +x ./start_cluster.sh
  1. Execute cross chain transaction by sending BNB from BC to BSC
## 0x9fB29AAc15b9A4B7F17c3385939b007540f4d791 is the address used by test-crosschain-transfer as sender
## macos
echo "12345678" | ./bin/tbnbcli bridge transfer-out --amount 500000000:BNB --expire-time $(date -v+300S +%s) --to 0x9fB29AAc15b9A4B7F17c3385939b007540f4d791  --from node0-delegator --chain-id Binance-Chain-Ganges --node localhost:26657 --home ./.local/bc/node0

## linux
echo "12345678" | ./bin/tbnbcli bridge transfer-out --amount 500000000:BNB --expire-time $(date --date="+300 seconds" +%s) --to 0x9fB29AAc15b9A4B7F17c3385939b007540f4d791  --from local-user --chain-id Binance-Chain-Ganges --node localhost:26657
  1. Check the account balance
curl -X POST "http://localhost:8545" -H "Content-Type: application/json"  --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x9fB29AAc15b9A4B7F17c3385939b007540f4d791", "latest"],"id":1}' 
  1. Execute cross chain transaction by sending BNB from BSC to BC

./bin/test-crosschain-transfer --amount 1 --rpc-url http://localhost:8545 --to 0x0cdce3d8d17c0553270064cee95c73f17534d5a0
  1. Check the account balance
## The bech32 format of 0x0cdce3d8d17c0553270064cee95c73f17534d5a0 is tbnb1pnww8kx30sz4xfcqvn8wjhrn796nf4dqshlvlg.(you can use this tool https://slowli.github.io/bech32-buffer/ to do the convert)  
./bin/tbnbcli account tbnb1pnww8kx30sz4xfcqvn8wjhrn796nf4dqshlvlg --chain-id Binance-Chain-Ganges --node localhost:26657 --trust-node

Additional Commands

Remove all nodes

bash +x ./setup_bc_node.sh uninstall_k8s
bash +x ./setup_bsc_node.sh uninstall_k8s
bash +x ./setup_oracle_relayer.sh uninstall_k8s
bash +x ./setup_bsc_relayer.sh uninstall_k8s
bash +x ./setup_bc_node.sh native_stop 
bash +x ./setup_bsc_node.sh native_stop
bash +x ./setup_bsc_relayer.sh native_stop
bash +x ./setup_oracle_relayer.sh native_stop

or simply

bash +x ./stop_cluster.sh

Start a standalone BSC Cluster

# one cmd to start bsc cluster all alone
bash +x ./setup_bsc_node.sh native_run_alone

Upgrade image

kubectl set image statefulset/bc-node-0 bc=ghcr.io/bnb-chain/node:0.10.6 -n bc
...

kubectl set image statefulset/bsc-node-0 bsc=ghcr.io/bnb-chain/bsc:1.1.18_hf -n bsc
...

node-deploy's People

Contributors

j75689 avatar nathanbsc avatar matuskysel avatar buddh0 avatar unclezoro avatar mister-ea avatar weiihann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.