Navigate to the directory under which you would like to clone the dYdX Chain source code into and execute the followin:
git clone https://github.com/dydxprotocol/v4-chain.git
cd v4-chain/protocol/
4. Checkout, build and install dydxprotocold
From within v4-chain/protocol/ directory
First make sure your local repository is up to date
git fetch --prune && git pull
By default, your repository is at the latest, often not-yet released, version of the software (the main branch). You can check the tracked version with
$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
Unless else is explicitly required, you should be using the latest released version. You can check which is it from this location. The one marked as latest is the latest released - at the time of writing, that is v3.0.0.To check out v3.0.0 run:
git checkout tags/protocol/v3.0.0
When opting for a different version, donβt forget to add tags/protocol/ before the version in the git checkout command
An output similar to the below works, if you switched from main branch to a released version:
$ git checkout tags/protocol/v3.0.0
Note: switching to 'tags/protocol/v3.0.0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 85fb10ad Upgrade cosmos fork to fix RPC queries (#956)
Build the binary locally (might take some time)
LEDGER_ENABLED=true make install build
The created binary should be located at ./build/dydxprotocold - letβs make it available from everywhere
Configure the chain-id , so you donβt need to input it manually later
dydxprotocold config chain-id dydx-mainnet-1
Connecting to Public Testnet dydx-testnet-4 can be done by simply using an RPC endpoint from the testnet docs - just make sure you add :433 at the end of the URL, e.g. https://testnet-dydx-rpc.lavenderfive.com:443 Donβt forget to configure chain-id too!
6. Test your connection to dydx-mainnet-1
Test by reading the balance of an address, for example dydx1y66c5c7zpcqxqgqec9ttutuwu60qkzav22h3ue
The dydxprotocold tool has a built in help menu - simply type the following to get information for any command
dydxprotocold help [path to command]
For example
$ dydxprotocold help query
Querying subcommands
Usage:
dydxprotocold query [flags]
dydxprotocold query [command]
Aliases:
query, q
Available Commands:
account Query for account by address
assets Querying commands for the assets module
auth Querying commands for the auth module
bank Querying commands for the bank module
block Get verified data for the block at given height
blocktime Querying commands for the blocktime module
bridge Querying commands for the bridge module
clob Querying commands for the clob module
delaymsg Querying commands for the delaymsg module
distribution Querying commands for the distribution module
epochs Querying commands for the epochs module
evidence Query for evidence by hash or for all (paginated) submitted evidence
feegrant Querying commands for the feegrant module
feetiers Querying commands for the feetiers module
gov Querying commands for the governance module
ibc Querying commands for the IBC module
ibc-transfer IBC fungible token transfer query subcommands
interchain-accounts IBC interchain accounts query subcommands
params Querying commands for the params module
perpetuals Querying commands for the perpetuals module
prices Querying commands for the prices module
rewards Querying commands for the rewards module
sending Querying commands for the sending module
slashing Querying commands for the slashing module
staking Querying commands for the staking module
stats Querying commands for the stats module
subaccounts Querying commands for the subaccounts module
tendermint-validator-set Get the full tendermint validator set at given height
tx Query for a transaction by hash, "<addr>/<seq>" combination or comma-separated signatures in a committed block
txs Query for paginated transactions that match a set of events
upgrade Querying commands for the upgrade module
vest Querying commands for the vest module
Flags:
--chain-id string The network chain ID
-h, --help help for query
Global Flags:
--home string directory for config and data (default "/Users/kaizhang/.dydxprotocol")
--log_format string The logging format (json|plain) (default "plain")
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
--trace print out full stack trace on errors
Use "dydxprotocold query [command] --help" for more information about a command.
$ dydxprotocold help query bank
Querying commands for the bank module
Usage:
dydxprotocold query bank [flags]
dydxprotocold query bank [command]
Available Commands:
balances Query for account balances by address
denom-metadata Query the client metadata for coin denominations
send-enabled Query for send enabled entries
spendable-balances Query for account spendable balances by address
total Query the total supply of coins of the chain
Flags:
-h, --help help for bank
Global Flags:
--chain-id string The network chain ID
--home string directory for config and data (default "/Users/kaizhang/.dydxprotocol")
--log_format string The logging format (json|plain) (default "plain")
--log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
--trace print out full stack trace on errors
Use "dydxprotocold query bank [command] --help" for more information about a command.