EOA Wallets
Prerequisites
Setup the dYdX CLI1. List wallets
$ dydxprotocold keys list
- address: dydx1m4...dfpel
name: test
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ara...zbQ0"}'
type: local
dydxprotocold keys show test
2. Generate new wallet
Let’s say you want to name your wallet myNewWallet
- you can choose an arbitrary name, that is meaningful to you. Spaces are allowed, although they might not be convenient when you try to use the wallet
$ dydxprotocold keys add myNewWallet
- address: dydx1cza...069c
name: myNewWallet
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9QEyr+iQoCI...6IjzVG2vEMf"}'
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.
some mnemonic keywords will appear here
This will output the newly created wallet information, as well as the mnemonic for it.
3. Import an existing wallet with a mnemonic
You will need to have the mnemonic of the wallet available. myImportedWallet
is an example, use a name that is meaningful to you.
The command will halt with the message > Enter your bip39 mnemonic asking for your mnemonic - paste it (or enter it manually) and hit enter:
dydxprotocold keys add myImportedWallet --recover
4. Add an offline wallet
dydxprotocold
allows you to add the public key of someone else’s wallet, so that you can, for example, work with a multisig containing that wallet. The section can help obtain a wallet’s public key.
To add it to your setup, execute the following command, adjusting the name offllineWallet
accordingly
$ dydxprotocold keys add offllineWallet --pubkey='{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9QEyr+iQoCI...6IjzVG2vEMf"}'
- address: dydx1cza...069c
name: offllineWallet
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9QEyr+iQoCI...6IjzVG2vEMf"}'
type: offline
5. Connect a Ledger HW wallet
💡 If you encounter the following error during the process, please perform the steps in Ledger Wallet and try again.
Error: failed to generate ledger key: failed to retrieve device: ledger nano S: hidapi: failed to open device
Connect your Ledger device to your workstation
Make sure the Cosmos App is installed - open it
Run the following command: (note that
myLedgerWallet
is an arbitrary name - you can choose your own name)
dydxprotocold keys add myLedgerWallet --ledger
- address: dydx1cza...069c
name: myLedgerWallet
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9QEyr+iQoCI...6IjzVG2vEMf"}'
type: ledger
To output the wallet address in the Ledger device - this will allow you to review the address on the device.
dydxprotocold keys show myLedgerWallet --device
6. Rename a wallet
dydxprotocold keys rename <old name> <new name>
7. Query token balances
You can list the tokens balances of an address with
dydxprotocold query bank balances dydx1y66c5c7zpcqxqgqec9ttutuwu60qkzav22h3ue
balances:
- amount: "22071848837500000000"
denom: adydx
pagination:
next_key: null
total: "0"
8. Send a transaction
dydxprotocold tx bank send <from> <to> <amount><denom> --fees <fee amount><feedenom>
from:
can be either wallet name, or wallet address, but it cannot be an offline walletto:
is the recipient’s wallet addressamount denom:
e.g. 1000000000000000000 adydx for sending 1 DYDXfee amount denom:
e.g. 5000000000000000 adydx - this value may need adjustment
Let's take a look at an example on testnet:
$ dydxprotocold tx bank send testnetWallet \
dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art \
100000000000000000adv4tnt \
--fees 5000000000000000adv4tnt \
--node https://dydx-testnet-rpc.polkachu.com:443 \
--chain-id dydx-testnet-4
auth_info:
fee:
amount:
- amount: "5000000000000000"
denom: adv4tnt
gas_limit: "200000"
granter: ""
payer: ""
signer_infos: []
tip: null
body:
extension_options: []
memo: ""
messages:
- '@type': /cosmos.bank.v1beta1.MsgSend
amount:
- amount: "100000000000000000"
denom: adv4tnt
from_address: dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art
to_address: dydx14zzueazeh0hj67cghhf9jypslcf9sh2n5k6art
non_critical_extension_options: []
timeout_height: "0"
signatures: []
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 985DB721FF8B65DB5FCAF57C93599DEDA5B5EDF7C24C8013112CE8752C7E2866
9. Vote for a proposal
dydxprotocold query gov proposals
View a specific proposal details
$ dydxprotocold query gov proposal 22
deposit_end_time: "2024-02-28T06:16:24.014055663Z"
final_tally_result:
abstain_count: "289052466830663152761344"
no_count: "4808846255497145968117"
no_with_veto_count: "19555000000000000000"
yes_count: "90144414592955946800079127"
id: "22"
messages:
- '@type': /dydxprotocol.prices.MsgCreateOracleMarket
authority: dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky
params:
exchange_config_json: '{"exchanges":[{"exchangeName":"Binance","ticker":"STRKUSDT","adjustByMarket":"USDT-USD"},{"exchangeName":"Bybit","ticker":"STRKUSDT","adjustByMarket":"USDT-USD"},{"exchangeName":"Kraken","ticker":"STRKUSD"},{"exchangeName":"Kucoin","ticker":"STRK-USDT","adjustByMarket":"USDT-USD"},{"exchangeName":"Okx","ticker":"STRK-USDT","adjustByMarket":"USDT-USD"},{"exchangeName":"Gate","ticker":"STRK_USDT","adjustByMarket":"USDT-USD"}]}'
exponent: -9
id: 43
min_exchanges: 3
min_price_change_ppm: 4000
pair: STRK-USD
- '@type': /dydxprotocol.perpetuals.MsgCreatePerpetual
authority: dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky
params:
atomic_resolution: -6
default_funding_ppm: 0
id: 43
liquidity_tier: 2
market_id: 43
ticker: STRK-USD
- '@type': /dydxprotocol.clob.MsgCreateClobPair
authority: dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky
clob_pair:
id: 43
perpetual_clob_metadata:
perpetual_id: 43
quantum_conversion_exponent: -9
status: STATUS_INITIALIZING
step_base_quantums: "1000000"
subticks_per_tick: 1000000
- '@type': /dydxprotocol.delaymsg.MsgDelayMessage
authority: dydx10d07y265gmmuvt4z0w9aw880jnsr700jnmapky
delay_blocks: 3600
msg:
'@type': /dydxprotocol.clob.MsgUpdateClobPair
authority: dydx1mkkvp26dngu6n8rmalaxyp3gwkjuzztq5zx6tr
clob_pair:
id: 43
perpetual_clob_metadata:
perpetual_id: 43
quantum_conversion_exponent: -9
status: STATUS_ACTIVE
step_base_quantums: "1000000"
subticks_per_tick: 1000000
metadata: ""
proposer: dydx19rl2uqr87c6sv8p7lhg9yz4mde3cdaluk4ss5w
status: PROPOSAL_STATUS_PASSED
submit_time: "2024-02-21T06:16:24.014055663Z"
summary: Add the x/prices, x/perpetuals and x/clob parameters needed for a STRK-USD
perpetual market. Create the market in INITIALIZING status and transition it to
ACTIVE status after 3600 blocks.
title: Add STRK-USD perpetual market
total_deposit:
- amount: "2000000000000000000000"
denom: adydx
voting_end_time: "2024-02-25T06:16:24.014055663Z"
voting_start_time: "2024-02-21T06:16:24.014055663Z"
10. Submit vote
dydxprotocold tx gov vote <proposal id> <option> --from <addres or wallet name> --fees
option
: should be either Yes , No , NoWithVeto , or AbstainFees
: 5000000000000000adydx - this value may need some adjustment
11. Query vote tally
$ dydxprotocold query gov tally 22
abstain_count: "289052466830663152761344"
no_count: "4808846255497145968117"
no_with_veto_count: "19555000000000000000"
yes_count: "90144414592955946800079127"
Last updated