Local Sei Node
In this guide, we'll walk you through how to set up the Sei blockchain locally on your machine.
Prerequisites
To begin, ensure you are in the sei-chain repository on your local machine.
git clone https://github.com/sei-protocol/sei-chain
cd sei-chain
Running a Local Single-node Testnet
To run Sei locally, run the following command
./scripts/initialize_local_chain.sh
Once you run the initialization script, the seid process will be running 1 node locally. It will also seed 50 accounts. To verify the status of the local blockchain, open a new tab and run
seid status | jq
If the chain is running properly, you should see output similar to the following:
{
"NodeInfo": {
"protocol_version": {
"p2p": "8",
"block": "11",
"app": "0"
},
"id": "36126cf4875862c3388f04dcc636fc1557791dd7",
"listen_addr": "tcp://0.0.0.0:26656",
"network": "sei-chain",
"version": "0.34.19",
"channels": "40202122233038606100",
"moniker": "demo",
"other": {
"tx_index": "on",
"rpc_address": "tcp://127.0.0.1:26657"
}
},
"SyncInfo": {
"latest_block_hash": "0A708E540CC04445B3C5585ED2757FADCAD18FB8E2A403655B3DC90D0F588D49",
"latest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"latest_block_height": "1",
"latest_block_time": "2022-09-04T17:59:07.314228Z",
"earliest_block_hash": "0A708E540CC04445B3C5585ED2757FADCAD18FB8E2A403655B3DC90D0F588D49",
"earliest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"earliest_block_height": "1",
"earliest_block_time": "2022-09-04T17:59:07.314228Z",
"catching_up": false
},
"ValidatorInfo": {
"Address": "13A8F763B396AF5B835A10748C4EFEDB0F99AC28",
"PubKey": {
"type": "tendermint/PubKeyEd25519",
"value": "7ztvoNO/8wxIkqTcsDQ3CLgCyF5yOz6WBqf0yGrmeuE="
},
"VotingPower": "70000000000000"
}
}
To deploy multiple nodes, you can use a docker container to start a sei chain cluster.
Install Docker & Docker Compose
For MacOS:
The easiest and recommended way to get Docker and Docker Compose is to install Docker Desktop here:
https://docs.docker.com/desktop/install/mac-install/ (opens in a new tab)
For Ubuntu:
Follow the below link to install docker on ubuntu
https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository (opens in a new tab)
Follow the below link to install standalone docker compose
https://docs.docker.com/compose/install/other/ (opens in a new tab)
Deploy Sei Chain Validators on Docker
Detailed instructions and commands can be found in the Makefile (opens in a new tab) of the sei-chain repo.
Start a 4 Node Validator Cluster
This will start a 4 node sei chain cluster, each validator node will be running in its own docker container, and each node will also run the oracle price feeder daemon
# If this is the first time or you want to rebuild the binary:
make docker-cluster-start
# If you have run docker-cluster-start and build/seid exist,
# you can skip the build process to quick start by:
make docker-cluster-start-skipbuild
All the logs and genesis files will be generated under the temporary build/generated folder. To access the service log:
# Monitor logs after cluster is started for node0
tail -f build/generated/seid-0.log
SSH into a single validator node
# List all containers
docker ps -a
# SSH into a running container
docker exec -it [container_name] /bin/bash
Deploy a State Sync Node
Requirement: Follow the above steps to start a 4 node docker cluster before starting any state sync node.
# Be sure to start up a 4-node cluster before you start a state sync node
make docker-cluster-start
# Wait for at least a few minutes till the latest block height exceed 500 (this can be changed via app.toml)
seid status |jq
# Start up a state sync node
make run-rpc-nodesh
Local Docker for Debugging and Testing
One of the fanciest thing of using docker is fast iteration. Here we support:
- Being able to make changes locally and start up the chain to see the immediate impact
- Being able to make changes to local dependency repo (Cosmo SDK/Tendermint) and start the chain with the latest changes without bumping or release any binary version In order to make local debugging work, you can follow these steps:
# Clone your dependency repo and put them under the same path as sei-chain
cd sei-chain
cd ../
git clone https://github.com/sei-protocol/sei-tendermint.git
git clone https://github.com/sei-protocol/sei-cosmos.git
# Modify go.mod file to point to local repo, must use the exact same path as below:
cd sei-chain
go mod edit -replace github.com/cosmos/cosmos-sdk=../sei-cosmos
go mod edit -replace github.com/tendermint/tendermint=../sei-tendermint
# Start the docker cluster
make docker-cluster-start
# You are good to go now! Make changes as you wish to any of the dependency repo and run docker to test it out.