AVS Setup Enhanced and Automated Edition of hello-avs We have updated the AVS workflow to be more automated and simplified. The AVS smart contract will now deploy automatically when you run our updated binary.
Prerequisites
Have private key ready for import, both operator private key and avs private key
Derive a new operator private key if no, and encrypt to disk
Copy imuad keys add play1 --home ~/.tmp-imuad
- address: im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
name: play1
pubkey: '{"@type":"/ethermint.crypto.v1.ethsecp256k1.PubKey","key":"An7RpHF1aV6NmnNNj1lJZGO4A8TwGVaDx3mzRjlJ12Ic"}'
type: local
**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.
coyote ozone network avoid lift ozone reveal six sell source curtain basket initial model fish scene hedgehog funny teach sphere magnet birth false gift
Then use the following command to convert the bech32-encoded address to a hex address.
Copy imuad debug addr im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
Address bytes: [130 118 176 86 91 85 156 60 23 118 136 28 196 194 54 188 226 91 54 54]
Address (hex): 8276B0565B559C3C1776881CC4C236BCE25B3636
Address (EIP-55): 0x8276B0565b559C3C1776881Cc4c236Bce25b3636
Bech32 Acc: im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
Bech32 Val: imvaloper1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3k94enmy
Finally, export private key and private key encrypted text using the following method:
Copy imuad keys unsafe-export-eth-key --home ~/.tmp-imuad play1.info
21B5DD3A8F1D0816CEB4C7C4ED3ED8B6254D200E20AC13B8B26B5BD66D1C2EA3
cat ~/.tmp-imuad/keyring-test/play1.info
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyNC0xMi0xOSAxMDo1NTowNS4xNDg2MjEgKzA4MDAgQ1NUIG09KzAuMDcxOTQ5NDU5IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoidzljbElxTWJlY004Ry1xMiJ9.aZ2J36AtbrVCVH6TpIWMORAksfA6VHNL2_pP7e6oJnVUVoSdGNeJ3A.uVrRM3Bf6HVcOre5.YA1gCgwA0mZEAQwsn3Q1RGT4AtjFt0Nfd9vB4Fqk6p1sYpqcXkKeal7jFJGX6x18kYf17I-yQecH3Bqiwurbkt1JiQUTJMrN0G_sBkmVFeQR9GRRWIOex8LfS8dPqKOVD2mCTMtvsASmOQ5iGl_wbUquVRVgMBN6vZCAXe02Q8tr4y_0EiGUB3tMR_DqXlkn2Wv7oPtCWjaxomgzqP3sXcJCNQATkwNb6SshQZoIOPnc8-ZklJooxm7kaTFbfwGtNZBIIY_CU4ju4RE5-XPwSwKO63JVJxi6tQ7BKc_ZckQ25qMAwdGodU4qnIuIHNJfqxsFsWYrEbT0ABMX6dZULz7CQM34Gp0dI3w5-qpnBqsBS1Z_-9bnSLc-RcrE-sGs9u49xftDzZgDiJiKUyL93dpWN7BrPKGzDC_eHuSixWsTghRqyPUMchjlmGNb8KS7jlYPV9dnUqWnpO9gaWG21NYVHv8.wb34zulE2BI85PLRQQAPxg
Use the values thus obtained to populate this section
Copy operator_hex_pri: 21B5DD3A8F1D0816CEB4C7C4ED3ED8B6254D200E20AC13B8B26B5BD66D1C2EA3
operator_ethaddr: 0x8276B0565b559C3C1776881Cc4c236Bce25b3636
operator_im_acc_address: im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
operator_cosmos_pri: eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyNC0xMi0xOSAxMDo1NTowNS4xNDg2MjEgKzA4MDAgQ1NUIG09KzAuMDcxOTQ5NDU5IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoidzljbElxTWJlY004Ry1xMiJ9
Ensure that there are enough funds in the account for transactions.
Use the local_funded_account account in Imuachain to transfer some amount to the two prepared accounts for sending transactions.
Copy curl localhost:8545 -X POST -H "Content-Type: application/json" --data '{"method":"eth_getBalance","params":["0x3e108c058e8066DA635321Dc3018294cA82ddEdf", "latest"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"result":"0x52b7d2dcc80cd2e4000000"}
curl localhost:8545 -X POST -H "Content-Type: application/json" --data '{"method":"eth_getBalance","params":["0x8276B0565b559C3C1776881Cc4c236Bce25b3636", "latest"],"id":1,"jsonrpc":"2.0"}'
{"jsonrpc":"2.0","id":1,"result":"0x3635c9adc5dea00000"}
Register Operator
Register operator using imuad
cli with the following parameters:
Copy imuad tx operator register-operator \
--meta-info "My Operator" \
--from play1.info \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.01 \
--home "~/.tmp-imuad" \
--chain-id "imuachaintestnet_233-1" \
--keyring-backend test \
--fees 50000000000hua
auth_info:
fee:
amount:
- amount: "50000000000"
denom: hua
gas_limit: "200000"
granter: ""
payer: ""
signer_infos: []
tip: null
body:
extension_options: []
memo: ""
messages:
- '@type': /imuachain.operator.v1.RegisterOperatorReq
from_address: im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
info:
approve_addr: im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
client_chain_earnings_addr:
earning_info_list: []
commission:
commission_rates:
max_change_rate: "0.010000000000000000"
max_rate: "0.200000000000000000"
rate: "0.100000000000000000"
update_time: "1970-01-01T00:00:00Z"
earnings_addr: im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn
operator_meta_info: My Operator
non_critical_extension_options: []
timeout_height: "0"
signatures: []
confirm transaction before signing and broadcasting [y/N]: y
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: ADAB3FF26CFF074BCCFE4859E790CFA2F3C452E66725CB33DE7503B133B8BAB7
verify by seeing all operators’ info as in the red line
Copy imuad query operator get-all-operators
operator_acc_addrs:
- im18cggcpvwspnd5c6ny8wrqxpffj5zmhkl3agtrj
- im1sfmtq4jm2kwrc9mk3qwvfs3khn39kd3kjyn7kn # newly added
pagination:
next_key: null
total: "2"
Preparing and configure the hello-avs repo
Clone the hello-world-avs repository to a folder of your choice.
Ensure imua-key
is installed
Import AVS ECDSA Private Key
Copy # Import AVS private key
./imua-key importKey --key-type ecdsa --private-key {avs_private_key} --output-dir tests/keys/avs.ecdsa.key.json
# Output: tests/keys/avs.ecdsa.key.json
Import Operator ECDSA Private Key
Copy ./imua-key importKey --key-type ecdsa --private-key 21B5DD3A8F1D0816CEB4C7C4ED3ED8B6254D200E20AC13B8B26B5BD66D1C2EA3 --output-dir ./tests/keys/operator.ecdsa.key.json
# Output: tests/keys/operator.ecdsa.key.json
Generate or Import BLS Private Key for operator
Generate
Copy # generate BLS key
./imua-key generate --key-type bls --num-keys 1
# Output: random folder
Import
Copy # Import BLS private key
./imua-key importKey --key-type bls --private-key {bls_private_key} --output-dir tests/keys/test.bls.key.json
# Output: tests/keys/test.bls.key.json
Or copy the generated bls json file into tests/keys/test.bls.key.jso
Copy ls bls-bd64f40a-bd71-11ef-88eb-0e9d598fbdf0/keys/1.bls.key.json
bls-bd64f40a-bd71-11ef-88eb-0e9d598fbdf0/keys/1.bls.key.json
e. Key Paths
AVS Owner ECDSA Private Key: tests/keys/avs.ecdsa.key.json
Operator ECDSA Private Key: tests/keys/operator.ecdsa.key.json
BLS Private Key: tests/keys/test.bls.key.json
f. Secure Environment Variable Management
If a non-empty password is used when writing private keys to JSON files, you must set the corresponding environment variables
For our local use-case, we only used bls password, so we need to set it in the environment
Copy cat bls-bd64f40a-bd71-11ef-88eb-0e9d598fbdf0/password.txt
p3KWlL3dPVh4w1Y45x7P
export OPERATOR_BLS_KEY_PASSWORD="p3KWlL3dPVh4w1Y45x7P"
g. Configure the config.yaml file to match the operator and avs related information
Copy #The eoa address of Operato, used for sending transactions
operator_address: 0x8276B0565b559C3C1776881Cc4c236Bce25b3636
Starting the AVS
Make sure the environment variables are set in the terminal you wanna execute the following command. If no, please export the variable
Copy printenv OPERATOR_BLS_KEY_PASSWORD
p3KWlL3dPVh4w1Y45x7P
Start AVS Operator
Open a separate terminal window #1, execute the following commands
Copy ./operatorbinary --config ./config.yaml
Start AVS
Open a separate terminal window #2, execute the following commands
Copy ./avsbinary --config ./config.yaml