First make sure your local repository is up to date
gitfetch--prune&&gitpull
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
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:
gitcheckouttags/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:
$gitcheckouttags/protocol/v3.0.0Note:switchingto'tags/protocol/v3.0.0'.Youarein'detached HEAD'state.Youcanlookaround,makeexperimentalchangesandcommitthem,andyoucandiscardanycommitsyoumakeinthisstatewithoutimpactinganybranchesbyswitchingbacktoabranch.Ifyouwanttocreateanewbranchtoretaincommitsyoucreate,youmaydoso (now orlater) by using -c with the switch command. Example:gitswitch-c<new-branch-name>Orundothisoperationwith:gitswitch-Turnoffthisadvicebysettingconfigvariableadvice.detachedHeadtofalseHEADisnowat85fb10adUpgradecosmosforktofixRPCqueries (#956)
Build the binary locally (might take some time)
LEDGER_ENABLED=truemakeinstallbuild
The created binary should be located at ./build/dydxprotocold - let’s make it available from everywhere
ln-sf"$(pwd)/build/dydxprotocold"/usr/local/bin
💡 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:
$dydxprotocoldversion3.0.0
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
dydxprotocoldconfigchain-iddydx-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