/
πŸ”
Authz and Metamask
Search
Duplicate
Try Notion
πŸ”
Authz and Metamask
We are going to use a Raspberry Pi to allow our Metamask + Ledger wallet to send some Authz transactions in order to enable autostake.
We are going to import the wallet and sign the transaction offline to be sure that no one can steal our coins.
Requirements
Seed phrase for your wallet
Raspberry Pi + Keyboard + Monitor. (Not using ssh to be sure that the rpi is 100% offline)
Sd card
Instructions
We are going to use the sd card to install the Raspberry Pi Os Lite (64-bit)
This step is very important because we want to be sure that we are running a OS without any modification.
1. Download the evmosd binary
Connect your raspberry pi using the ethernet cable (we are just going to be connected to the internet to download the evmosd binary)
If you don’t want to connect your rpi to the internet, you can just download the arm64 version of evmosd in your mac/pc and copy the binary in the sd card after installing the OS.
Download the binary and extract the tar file.
wget https://github.com/evmos/evmos/releases/download/v8.1.0/evmos_8.1.0_Linux_arm64.tar.gz tar -xfv evmos_8.1.0_Linux_arm64.tar.gz cd bin ./evmosd version ./evmosd init moniker --chain-id evmos_9001-2
Bash
After this step you can disconnect your ethernet cable because we are not going to connect to the internet again until we format and remove every content from the sd card
2. Import your seed phrase to the evmosd binary
Make sure you are no longer connected to the internet, your terminal should look like this:
Add your mnemonics:
./evmosd keys add --recover wallet_name --keyring-backend=file
Bash
Verify that the address is the correct one:
./evmosd keys list --keyring-backend=file
Bash
Get your account id and sequence number:
In your pc/mac browse to the page: https://rest.bd.evmos.org:1317/cosmos/auth/v1beta1/accounts/evmos1…
Write down the account number (<account_number>)and sequence (<sequence>)
Note: the address must be in the format evmos1... , you can convert address using https://evmos.me/utils/tools
3.1. Offline Signer (safest way)
Create the transaction:
./evmosd tx authz grant <bot_address> generic --msg-type /cosmos.staking.v1beta1.MsgDelegate --chain-id evmos_9001-2 --from `./evmosd keys show --address wallet_name --keyring-backend file` --keyring-backend file --fees 50000000000000000aevmos --offline --account-number <account_number> --sequence <sequence> --generate-only > tosign.json
Bash
Sign the transaction:
./evmosd tx sign tosign.json --chain-id evmos_9001-2 --from wallet_name --keyring-backend file --fees 50000000000000000aevmos --offline --account-number <account_number> --sequence <sequence> > signed.json
Bash
Broadcast the transaction using your pc/mac
Edit the following json using your values, most account values can be copied and pasted from the previous api call, the timestamp and signature needs to be manually typed.
Save the json file as toBroadcast.json
{ "body": { "messages": [ { "@type": "/cosmos.authz.v1beta1.MsgGrant", "granter": "<your address>", "grantee": "<bot address>", "grant": { "authorization": { "@type": "/cosmos.authz.v1beta1.GenericAuthorization", "msg": "/cosmos.staking.v1beta1.MsgDelegate" }, "expiration": "<expiration time>" } } ], "memo": "", "timeout_height": "0", "extension_options": [], "non_critical_extension_options": [] }, "auth_info": { "signer_infos": [ { "public_key": { "@type": "/ethermint.crypto.v1.ethsecp256k1.PubKey", "key": "<your pubkey>" }, "mode_info": { "single": { "mode": "SIGN_MODE_DIRECT" } }, "sequence": "<sequence>" } ], "fee": { "amount": [{ "denom": "aevmos", "amount": "50000000000000000" }], "gas_limit": "200000", "payer": "", "granter": "" } }, "signatures": [ "<signature>" ] }
JSON
Broadcast the transaction
evmosd tx broadcast ./toBroadcast.json --node https://tendermint.bd.evmos.org:26657
Bash
3.2. Online Signer (not so safe way)
If you keep your raspberry pi connected to the internet you can send the transaction with just 1 step:
./evmosd tx authz grant <bot_address> generic --msg-type /cosmos.staking.v1beta1.MsgDelegate --chain-id evmos_9001-2 --from wallet_name --keyring-backend file --fees 50000000000000000aevmos --node https://tendermint.bd.evmos.org:26657
Bash
4. Claim the commission (validators only):
You just need to change /cosmos.staking.v1beta1.MsgDelegate to /cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission
Remove everything
Delete your ~./evmosd folder from the raspberry pi
Format your sd card