Peggo
如果您在此页面,您很可能已经成为Injective的验证者。恭喜您!配置peggo是您设置的最后一步。
peggo的.env
示例:
PEGGO_ENV="local" # environment name for metrics (dev/test/staging/prod/local)
PEGGO_LOG_LEVEL="debug" # log level depth
PEGGO_COSMOS_CHAIN_ID="injective-1" # chain ID of the Injective network
PEGGO_COSMOS_GRPC="tcp://localhost:9090" # gRPC of your injectived process
PEGGO_TENDERMINT_RPC="http://localhost:26657" # Tendermint RPC of your injectived process
# Note: omitting PEGGO_COSMOS_GRPC and PEGGO_TENDERMINT_RPC enables stand-alone peggo mode. In this mode,
# peggo is connected to load balanced endpoints provided by the Injective network. This decouples peggo's connection from your injectived process.
# Injective config
PEGGO_COSMOS_FEE_DENOM="inj" # token used to pay fees on Injective
PEGGO_COSMOS_GAS_PRICES="160000000inj" # default --gas-prices flag value for sending messages to Injective
PEGGO_COSMOS_KEYRING="file" # keyring backends ("os", "file", "kwallet", "memory", "pass", "test")
PEGGO_COSMOS_KEYRING_DIR= # path to your keyring dir
PEGGO_COSMOS_KEYRING_APP="peggo" # arbitrary name for your keyring app
PEGGO_COSMOS_FROM= # account address of your Validator (or your Delegated Orchestrator)
PEGGO_COSMOS_FROM_PASSPHRASE= # keyring passphrase
PEGGO_COSMOS_PK= # private key of your Validator (or your Delegated Orchestrator)
PEGGO_COSMOS_USE_LEDGER=false
# Ethereum config
PEGGO_ETH_KEYSTORE_DIR= # path to your Ethereum keystore
PEGGO_ETH_FROM= # your Ethereum address (must be Delegated Ethereum address if you're a Validator)
PEGGO_ETH_PASSPHRASE= # passphrase of your Ethereum keystore
PEGGO_ETH_PK= # private key of your Ethereum address
PEGGO_ETH_GAS_PRICE_ADJUSTMENT=1.3 # suggested Ethereum gas price will be adjusted by this factor (Relayer)
PEGGO_ETH_MAX_GAS_PRICE="500gwei" # max gas price allowed for sending Eth transactions (Relayer)
PEGGO_ETH_CHAIN_ID=1 # chain ID of Ethereum network
PEGGO_ETH_RPC="http://localhost:8545" # RPC of your Ethereum node
PEGGO_ETH_ALCHEMY_WS="" # optional websocket endpoint for listening pending transactions on Peggy.sol
PEGGO_ETH_USE_LEDGER=false
# Price feed provider for token assets (Batch Creator)
PEGGO_COINGECKO_API="https://api.coingecko.com/api/v3"
# Relayer config
PEGGO_RELAY_VALSETS=true # set to `true` to relay Validator Sets
PEGGO_RELAY_VALSET_OFFSET_DUR="5m" # duration which needs to expire before a Valset is eligible for relaying
PEGGO_RELAY_BATCHES=true # set to `true` to relay Token Batches
PEGGO_RELAY_BATCH_OFFSET_DUR="5m" # duration which needs to expire before a Token Batch is eligible for relaying
PEGGO_RELAY_PENDING_TX_WAIT_DURATION="20m" # time to wait until a pending tx is processed
# Batch Creator config
PEGGO_MIN_BATCH_FEE_USD=23.2 # minimum amount of fee a Token Batch must satisfy to be created
# Metrics config
PEGGO_STATSD_PREFIX="peggo."
PEGGO_STATSD_ADDR="localhost:8125"
PEGGO_STATSD_STUCK_DUR="5m"
PEGGO_STATSD_MOCKING=false
PEGGO_STATSD_DISABLED=true
步骤 1:配置 .env
.env
# official Injective mainnet .env config
mkdir ~/.peggo
cp mainnet-config/10001/peggo-config.env ~/.peggo/.env
cd ~/.peggo
以太坊配置
首先,在.env
文件中更新PEGGO_ETH_RPC
,并填写有效的以太坊EVM RPC端点。
要设置您自己的以太坊完整节点,请按照此处的说明操作。您也可以使用外部以太坊RPC提供商,如Alchemy或Infura,但请注意,Peggo桥接中继节点大量使用eth_getLogs
调用,这可能会增加您的成本负担,具体取决于您的提供商。
管理Peggo的以太坊密钥
Peggo支持两种提供签名密钥凭证的选项——使用Geth密钥库(推荐)或提供明文以太坊私钥。
选项 1. Geth密钥库 您可以在Geth文档中找到使用密钥库安全创建新以太坊账户的说明。 为了方便,下面提供了一个示例。
geth account new --datadir=/home/ec2-user/.peggo/data/
INFO [03-23|18:18:36.407] Maximum peer count ETH=50 LES=0 total=50
Your new account is locked with a password. Please give a password. Do not forget this password.
Password:
Repeat password:
Your new key was generated
Public address of the key: 0x9782dc957DaE6aDc394294954B27e2118D05176C
Path of the secret key file: /home/ec2-user/.peggo/data/keystore/UTC--2021-03-23T15-18-44.284118000Z--9782dc957dae6adc394294954b27e2118d05176c
- You can share your public address with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your funds!
- You must BACKUP your key file! Without the key, it's impossible to access account funds!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!
确保遵循geth提供的警告,特别是在备份您的密钥文件时,以免不小心丢失密钥。我们还建议在您的密码短语中不要使用任何引号或反引号字符,以确保与peggo的兼容性。
# example values, replace with your own
PEGGO_ETH_KEYSTORE_DIR=/home/ec2-user/.peggo/data/keystore
PEGGO_ETH_FROM=0x9782dc957DaE6aDc394294954B27e2118D05176C
PEGGO_ETH_PASSPHRASE=12345678
然后确保您的以太坊地址中有足够的ETH。
选项 2. 以太坊私钥(不安全)
只需将PEGGO_ETH_PK
更新为来自新账户的以太坊私钥即可。
Injective 配置
为发送Injective交易创建您的委托Cosmos密钥
您的peggo协调器可以:
使用专门的委托账户密钥来发送特定于验证者的Peggy交易(即ValsetConfirm、BatchConfirm和SendToCosmos交易);或
直接使用您的验证者账户密钥(“您的验证者就是您的协调器”)
出于隔离的考虑,我们建议创建一个委托的Cosmos密钥来发送Injective交易,而不是使用您的验证者账户密钥。
要创建一个新密钥,请运行:
injectived keys add $ORCHESTRATOR_KEY_NAME
然后确保您的协调器INJ地址中有足够的INJ余额,以便peggo协调器可以向Injective发送消息。 要获取您的协调器INJ地址,请运行:
injectived keys list $ORCHESTRATOR_KEY_NAME
您可以使用以下命令将INJ从您的验证者账户转账到协调器地址:
injectived tx bank send $VALIDATOR_KEY_NAME $ORCHESTRATOR_INJ_ADDRESS <amount-in-inj> --chain-id=injective-1 --keyring-backend=file --yes --node=tcp://localhost:26657 --gas-prices=500000000inj
示例
injectived tx bank send genesis inj1u3eyz8nkvym0p42h79aqgf37gckf7szreacy9e 20000000000000000000inj --chain-id=injective-1 --keyring-backend=file --yes --node=tcp://localhost:26657 --gas-prices=500000000inj
然后,您可以通过运行以下命令验证您的协调器账户是否有INJ余额:
injectived q bank balances $ORCHESTRATOR_INJ_ADDRESS
为peggo管理Cosmos账户密钥
Peggo支持两种提供Cosmos签名密钥凭证的选项——使用Cosmos密钥环(推荐)或提供明文私钥。
选项 1. Cosmos 密钥环
在.env
文件中,首先指定对应您peggo账户签名密钥的PEGGO_COSMOS_FROM
和PEGGO_COSMOS_FROM_PASSPHRASE
。
如果您按照上述推荐使用委托账户密钥配置,这将分别是您的$ORCHESTRATOR_KEY_NAME
和密码短语。否则,这应为您的$VALIDATOR_KEY_NAME
和相关的验证者密码短语。
请注意,默认的密钥环后端是文件,因此peggo会默认尝试在磁盘上查找密钥。
要使用默认的injectived密钥配置,您应将密钥环路径设置为您的injectived节点的主目录,例如~/.injectived
。
您还可以在这里阅读更多关于Cosmos密钥环的设置。
选项 2. Cosmos 私钥(不安全)
在.env
文件中,指定对应您peggo账户签名密钥的PEGGO_COSMOS_PK
。
如果您按照上述推荐使用委托账户密钥配置,这将是您的协调器账户的私钥。否则,这应为您的验证者账户私钥。
要获取您的协调器Cosmos私钥(如适用),请运行:
injectived keys unsafe-export-eth-key $ORCHESTRATOR_KEY_NAME
要获取您的验证者Cosmos私钥(如适用),请运行:
injectived keys unsafe-export-eth-key $VALIDATOR_KEY_NAME
再次强调,这种方法安全性较低,不推荐使用。
步骤 2:注册您的协调器和以太坊地址
您只能注册一次协调器和以太坊地址。之后无法更新。因此,在运行以下命令之前请仔细检查。
injectived tx peggy set-orchestrator-address $VALIDATOR_INJ_ADDRESS $ORCHESTRATOR_INJ_ADDRESS $ETHEREUM_ADDRESS --from $VALIDATOR_KEY_NAME --chain-id=injective-1 --keyring-backend=file --yes --node=tcp://localhost:26657 --gas-prices=500000000inj
要获取您的验证者INJ地址,请运行:
injectived keys list $VALIDATOR_KEY_NAME
要获取您的协调器INJ地址,请运行:
injectived keys list $ORCHESTRATOR_KEY_NAME
示例:
injectived tx peggy set-orchestrator-address inj10m247khat0esnl0x66vu9mhlanfftnvww67j9n inj1x7kvxlz2epqx3hpq6v8j8w859t29pgca4z92l2 0xf79D16a79130a07e77eE36e8067AeA783aBdA3b6 --from validator-key-name --chain-id=injective-1 --keyring-backend=file --yes --node=tcp://localhost:26657 --gas-prices=500000000inj
您可以通过在https://lcd.injective.network/peggy/v1/valset/current上检查您的验证者映射的以太坊地址来验证注册是否成功。
步骤 3:启动中继节点
cd ~/.peggo
peggo orchestrator
这将启动Peggo桥接(中继节点 / 协调器)。
步骤 4:创建Peggo systemd服务
在/etc/systemd/system/peggo.service
下添加以下内容的peggo.service
文件:
[Unit]
Description=peggo
[Service]
WorkingDirectory=/home/ec2-user/.peggo
ExecStart=/bin/bash -c 'peggo orchestrator '
Type=simple
Restart=always
RestartSec=1
User=ec2-user
[Install]
WantedBy=multi-user.target
然后使用以下命令配置环境变量,启动和停止peggo中继节点
sudo systemctl start peggo
sudo systemctl stop peggo
sudo systemctl restart peggo
sudo systemctl status peggo
# enable start on system boot
sudo systemctl enable peggo
# To check Logs
journalctl -f -u peggo
步骤 5:(可选)保护Cosmos密钥环免受未授权访问
在这里了解更多关于Cosmos密钥环的设置。启动节点后,默认的密钥环将把验证者操作密钥以加密形式存储在磁盘上。通常,密钥环位于节点的主目录中,即~/.injectived/keyring-file
。
Injective质押文档中的一些部分将引导您使用此密钥进行治理操作,例如提交交易和设置以太坊桥接。为了保护密钥免受未授权访问,即使密钥环密码短语通过配置泄露,您可以设置操作系统权限,仅允许injectived
/ peggo
进程访问磁盘。
在Debian、Ubuntu和RHEL等Linux系统中,可以使用POSIX访问控制列表(ACL)来实现此目的。在开始使用ACL之前,文件系统必须启用ACL。每个发行版都有一些官方指南:
贡献
如果您希望查看Peggo协调器的源代码并做出贡献,可以访问https://github.com/InjectiveLabs/peggo。
Last updated