Setup the dYdX CLI

dYdX CLI: Initial setup

Prerequisites

A MacOS machine - although a similar process may be deduced for another OS, so long as you install the necessary tools

1. Install Homebrew

Make sure you have Homebrew installed

brew --version

If not, execute

/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/in

2. Get the tools

Make sure everything is up to date

brew update && brew upgrade 

You need git , make and go

3. Clone v4-chain git repository

Navigate to the directory under which you would like to clone the dYdX Chain source code into and execute the followin:

4. Checkout, build and install dydxprotocold

From within v4-chain/protocol/ directory

  1. First make sure your local repository is up to date

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

  1. 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:

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:

  1. Build the binary locally (might take some time)

The created binary should be located at ./build/dydxprotocold - let’s make it available from everywhere

πŸ’‘ While the step above can be executed multiple times safely, it’s only necessary to do so once.

πŸ’‘ You may need to close and reopen your Terminal window, if this is the first time you perform these steps.

To test if all went well:

5. Connect to dydx-mainnet-1

Set up an RPC node to connect to from the docs and configure it locally

Configure the chain-id , so you don’t need to input it manually later

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

8. dydxprotocold help

The dydxprotocold tool has a built in help menu - simply type the following to get information for any command

For example

Last updated