. # ~/.injectived
|- data # Contains the databases used by the node.
|- config/
|- app.toml # Application-related configuration file.
|- config.toml # Tendermint-related configuration file.
|- genesis.json # The genesis file.
|- node_key.json # Private key to use for node authentication in the p2p protocol.
|- priv_validator_key.json # Private key to use as a validator in the consensus protocol.
在启动链之前,您需要至少创建一个账户来填充状态。首先,在密钥存储(keyring)中创建一个名为 my_validator 的新账户,并使用 test 作为密钥存储后端(您可以选择其他名称或后端):
injectived keys add my_validator --keyring-backend=test
# Put the generated address in a variable for later use.
MY_VALIDATOR_ADDRESS=$(injectived keys show my_validator -a --keyring-backend=test)
# Create a gentx.
injectived gentx my_validator 1000000000000000000000inj --chain-id=injective-1 --keyring-backend=test
# Add the gentx to the genesis file.
injectived collect-gentxs
一个需要调整的配置示例是 app.toml 中的 minimum-gas-prices 字段,该字段定义了验证人节点愿意接受的最低 gas 价格来处理交易。如果该字段为空,请确保用某个值进行编辑,例如 10inj,否则节点将在启动时停止。对于本教程,我们将最低 gas 价格设置为 0:
# The minimum gas prices a validator is willing to accept for processing a
# transaction. A transaction's fees must meet the minimum of any denomination
# specified in this config (e.g. 0.25token1;0.0001token2).
minimum-gas-prices = "0inj"
运行本地网络
现在,一切设置完成,您可以最终启动您的节点:
injectived start # Blocks should start coming in after running this
# The argument <moniker> is the custom username of your node, it should be human-readable.
export MONIKER=<moniker>
# Injective Testnet has a chain-id of "injective-888"
injectived init $MONIKER --chain-id injective-888
# The argument <moniker> is the custom username of your node. It should be human-readable.
export MONIKER=<moniker>
# Injective Mainnet has a chain-id of "injective-1"
injectived init $MONIKER --chain-id injective-1