设置一个本地节点 (Set up a local network)

准备开始 (Get started)

Sei is currently running with golang 1.18.3+. You need to set golang up locally before moving to the next step.

Sei 目前正在运行 golang 1.18.3+。在进行下一步之前,您需要在本地设置 golang。

Find the latest release here and download the Sei repository

在这里 找到最新版本并下载 Sei 存储库

git clone --depth 1 --branch <tag_name> https://github.com/sei-protocol/sei-chain.git

You need to replace <tag_name> with your favorable release tag name here. For example, 1.1.1beta.

您需要在此处将 <tag_name> 替换为您喜欢发布的标签名称。例如,1.1.1beta

If you get the error "Permission denied (publickey)"then make sure that you have correctly generated an SSH key and added it to your github account. If that doesn't work, then go through the remainder of the debugging docs for this problem 如果您收到错误“Permission denied (publickey)”,请确保您已正确生成 SSH 密钥将其添加到您的 github 帐户。如果这不起作用,请查看调试文档的其余部分来解决这个问题

Using seid, an internal tool of Sei, is the preferred way to start the Sei local. 使用 Seid ,一个Sei 的内部工具,是启动 Sei 本地的首选方式。

Seid(内部工具) Seid (Internal tool)

本地构建并启动 Sei (Build and initiate Sei local)

First build the tool 首先构建工具

cd sei-chain

make install

Ensure that seid is accessible, whether that is adding it to your GOPATH to your PATH (1) or creating an alias (2)

确保 seid 可访问,无论是将其添加到您 GOPATH的 路径(1)/PATH (1) 还是创建别名 (2)

1.添加路径/PATH 到GOPATH (1.Adding GOPATH to your PATH)

export GOPATH=$HOME/go

export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

2.创建一个seid别名 (2.Creating an alias for seid)

Add seid alias to your shell script, and execute (source) the shell:

将 seid 别名添加到您的 shell 脚本,并执行 (source) shell:

// example on ubuntu

alias seid="/home/ubuntu/go/bin/seid"

If you've run the chain before, you may have leftover cruft. Run the following to reset the state.

如果您以前运行过该链,则可能有剩余的垃圾。运行以下命令重置状态。

sudo -S rm -r ~/.sei/

seid tendermint unsafe-reset-all

You should see output that matches the following, indicating previous records of the chain have been nullified:

您应该看到与以下匹配的内容,表明该链先前的记录已被消除:

4:22PM INF Removed all blockchain history dir=/Users/$username/.sei/data
4:22PM INF Generated private validator file keyFile=/Users/$username/.sei/config/priv_validator_key.json stateFile=/Users/$username/.sei-chain/data/priv_validator_state.json

Next, initialize the chain. This creates the genesis field:

接下来,初始化链。这将创建 genesis 字段:

seid init $MONIKER --chain-id sei-chain

Sei local should be initiated successfully:

本地Sei应该启动成功:

{"app_message":{"auth":{"accounts":[],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"bank":{"balances":[],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"supply":[]},"capability":{"index":"1","owners":[]},"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"dex":{"lastEpoch":"0","longBookList":[],"params":{},"shortBookList":[],"twapList":[{"assetDenom":"luna","lastEpoch":"0","priceDenom":"stake","prices":["105"],"twapPrice":"105"},{"assetDenom":"luna","lastEpoch":"0","priceDenom":"ust","prices":["105"],"twapPrice":"105"}]},"distribution":{"delegator_starting_infos":[],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[]},"outstanding_rewards":[],"params":{"base_proposer_reward":"0.010000000000000000","bonus_proposer_reward":"0.040000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"","validator_accumulated_commissions":[],"validator_current_rewards":[],"validator_historical_rewards":[],"validator_slash_events":[]},"epoch":{"epoch":{"current_epoch":"0","current_epoch_height":"0","current_epoch_start_time":"2022-05-15T23:24:58.835910Z","epoch_duration":"60s","genesis_time":"2022-05-15T23:24:58.835910Z"},"params":{}},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[]},"gov":{"deposit_params":{"max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}]},"deposits":[],"proposals":[],"starting_proposal_id":"1","tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"votes":[],"voting_params":{"voting_period":"172800s"}},"ibc":{"channel_genesis":{"ack_sequences":[],"acknowledgements":[],"channels":[],"commitments":[],"next_channel_sequence":"0","receipts":[],"recv_sequences":[],"send_sequences":[]},"client_genesis":{"clients":[],"clients_consensus":[],"clients_metadata":[],"create_localhost":false,"next_client_sequence":"0","params":{"allowed_clients":["06-solomachine","07-tendermint"]}},"connection_genesis":{"client_connection_paths":[],"connections":[],"next_connection_sequence":"0","params":{"max_expected_time_per_block":"30000000000"}}},"mint":{"minter":{"annual_provisions":"0.000000000000000000","inflation":"0.130000000000000000"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"params":null,"slashing":{"missed_blocks":[],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[]},"staking":{"delegations":[],"exported":false,"last_total_power":"0","last_validator_powers":[],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[]},"transfer":{"denom_traces":[],"params":{"receive_enabled":true,"send_enabled":true},"port_id":"transfer"},"upgrade":{},"vesting":{},"wasm":{"codes":[],"contracts":[],"gen_msgs":[],"params":{"code_upload_access":{"address":"","permission":"Everybody"},"instantiate_default_permission":"Everybody","max_wasm_code_size":"1228800"},"sequences":[]}},"chain_id":"seisei-chain","gentxs_dir":"","moniker":"demo","node_id":"5e145a4dff089c72e73fc63c45e036947d126150"}

Create and configure your account:

创建并配置你的账户

export ACCOUNT_NAME="YOUR_ACCOUNT_NAME_HERE"

seid keys add $ACCOUNT_NAME

This should create a new account locally and display its address and mnemonic:

这应该在本地创建一个新帐户并显示其地址和助记词:

- name: $ACCOUNT_NAME

type: local

address: sei1ep9jyk9kydjz0fhadm7rzy6pc9ga7tdt4d26xn

pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ai3obIQZXAmdgDSw7p1awFIPGK9b7cu/SfJM6nbc+hV/"}'

mnemonic: ""

**Important** write this mnemonic phrase in a safe place.

It is the only way to recover your account if you ever forget your password.

some mnemonic words some mnemonic words some mnemonic words some mnemonic words some mnemonic words

Store the shown account address into local env variable and add it as the genesis account to the chain:

将显示的帐户地址存储到本地环境变量中,并将其作为创世帐户添加到链中:

export ACCOUNT_ADDRESS="ADDRESS_OF_YOUR_ACCOUNT"

seid add-genesis-account $ACCOUNT_ADDRESS 100000000000000000000usei

ADDRESS_OF_YOUR_ACCOUNT will be the address displayed from the previous command (in this example, seiep9jyk9kydjz0fhadm7rzy6pc9ga7tdt4d26xn)

ADDRESS_OF_YOUR_ACCOUNT 将是上一个命令显示的地址(在本例中,seiep9jyk9kydjz0fhadm7rzy6pc9ga7tdt4d26xn)

Self stake into the network:

自我质押到网络中:

seid gentx $ACCOUNT_NAME 70000000000000000000usei --chain-id sei-chain

Then collect the genesis transaction:

然后收集创世交易:

seid collect-gentxs

You should see a genesis transaction similar to the following:

您应该会看到类似于以下内容的创世交易:

{"app_message":{"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos1njgca0khra0a6y4c4j6eckzwq4jtc24hvd0s2e","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"0","address":"cosmos1ep9jyk9kydjz0fhadm7rzy6pc9ga7tdt4d26xn","pub_key":null,"sequence":"0"}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"bank":{"balances":[{"address":"cosmos1njgca0khra0a6y4c4j6eckzwq4jtc24hvd0s2e","coins":[{"amount":"100000000000000000000","denom":"stake"}]},{"address":"cosmos1ep9jyk9kydjz0fhadm7rzy6pc9ga7tdt4d26xn","coins":[{"amount":"100000000000000000000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"supply":[]},"capability":{"index":"1","owners":[]},"crisis":{"constant_fee":{"amount":"1000","denom":"stake"}},"dex":{"lastEpoch":"0","longBookList":[],"params":{},"shortBookList":[],"twapList":[{"assetDenom":"luna","lastEpoch":"0","priceDenom":"stake","prices":["105"],"twapPrice":"105"},{"assetDenom":"luna","lastEpoch":"0","priceDenom":"ust","prices":["105"],"twapPrice":"105"}]},"distribution":{"delegator_starting_infos":[],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[]},"outstanding_rewards":[],"params":{"base_proposer_reward":"0.010000000000000000","bonus_proposer_reward":"0.040000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"","validator_accumulated_commissions":[],"validator_current_rewards":[],"validator_historical_rewards":[],"validator_slash_events":[]},"epoch":{"epoch":{"current_epoch":"0","current_epoch_height":"0","current_epoch_start_time":"2022-05-15T23:24:58.835910Z","epoch_duration":"60s","genesis_time":"2022-05-15T23:24:58.835910Z"},"params":{}},"evidence":{"evidence":[]},"feegrant":{"allowances":[]},"genutil":{"gen_txs":[{"auth_info":{"fee":{"amount":[],"gas_limit":"200000","granter":"","payer":""},"signer_infos":[{"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ai3obIQZXAmdgDSw7p1awFIPGK9b7cu/SfJM6nbc+hV/"},"sequence":"0"}]},"body":{"extension_options":[],"memo":"5e145a4dff089c72e73fc63c45e036947d126150@192.168.1.77:26656","messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","commission":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"delegator_address":"cosmos1ep9jyk9kydjz0fhadm7rzy6pc9ga7tdt4d26xn","description":{"details":"","identity":"","moniker":"demo","security_contact":"","website":""},"min_self_delegation":"1","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"wYmGjeAUx9MOeO80b92Jg6FUuzmSwN1Xi1F42pLVHWM="},"validator_address":"cosmosvaloper1ep9jyk9kydjz0fhadm7rzy6pc9ga7tdtse702q","value":{"amount":"70000000000000000000","denom":"stake"}}],"non_critical_extension_options":[],"timeout_height":"0"},"signatures":["BtnsRzsdTGeNtAtRv2JrgCecfQEYusz9USliMf+8ShlS5qrVY7a3FUPDbfubJPNA1bExiKDzeIubqQFSlE5WzA=="]}]},"gov":{"deposit_params":{"max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}]},"deposits":[],"proposals":[],"starting_proposal_id":"1","tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"votes":[],"voting_params":{"voting_period":"172800s"}},"ibc":{"channel_genesis":{"ack_sequences":[],"acknowledgements":[],"channels":[],"commitments":[],"next_channel_sequence":"0","receipts":[],"recv_sequences":[],"send_sequences":[]},"client_genesis":{"clients":[],"clients_consensus":[],"clients_metadata":[],"create_localhost":false,"next_client_sequence":"0","params":{"allowed_clients":["06-solomachine","07-tendermint"]}},"connection_genesis":{"client_connection_paths":[],"connections":[],"next_connection_sequence":"0","params":{"max_expected_time_per_block":"30000000000"}}},"mint":{"minter":{"annual_provisions":"0.000000000000000000","inflation":"0.130000000000000000"},"params":{"blocks_per_year":"6311520","goal_bonded":"0.670000000000000000","inflation_max":"0.200000000000000000","inflation_min":"0.070000000000000000","inflation_rate_change":"0.130000000000000000","mint_denom":"stake"}},"params":null,"slashing":{"missed_blocks":[],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[]},"staking":{"delegations":[],"exported":false,"last_total_power":"0","last_validator_powers":[],"params":{"bond_denom":"stake","historical_entries":10000,"max_entries":7,"max_validators":100,"unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[]},"transfer":{"denom_traces":[],"params":{"receive_enabled":true,"send_enabled":true},"port_id":"transfer"},"upgrade":{},"vesting":{},"wasm":{"codes":[],"contracts":[],"gen_msgs":[],"params":{"code_upload_access":{"address":"","permission":"Everybody"},"instantiate_default_permission":"Everybody","max_wasm_code_size":"1228800"},"sequences":[]}},"chain_id":"sei-chain","gentxs_dir":"/Users/cyson/.sei-chain/config/gentx","moniker":"demo","node_id":"5e145a4dff089c72e73fc63c45e036947d126150"}

The next step is to override denominator currency used for various functionalities to usei:

下一步是将用于各种功能的计价货币覆盖为usei:

cat ~/.sei/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json

cat ~/.sei/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json

cat ~/.sei/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json

cat ~/.sei/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="usei"' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json

We recommend you to change the precommit timeout setting as following to slow down the block time and get a better visualization of the logs:

我们建议您更改 precommit 超时设置,以减慢阻塞时间并更好地可视化日志:

export $CONFIG_PATH=$HOME/.sei/config/config.toml

# for linux machine, remove the '' after sed -i

sed -i '' 's/timeout_prevote =.*/timeout_prevote = "2000ms"/g' $CONFIG_PATH

sed -i '' 's/timeout_precommit =.*/timeout_precommit = "2000ms"/g' $CONFIG_PATH

sed -i '' 's/timeout_commit =.*/timeout_commit = "2000ms"/g' $CONFIG_PATH

sed -i '' 's/skip_timeout_commit =.*/skip_timeout_commit = false/g' $CONFIG_PATH

Finally, start the chain:

最后,开始这条链!

seid start

New blocks will be built from then.

此时起将建造新的区块。

最后更新于