Endpoints
Every public name is served over HTTPS by one nginx. The chain id is
firstaccess-testnet-1.
Node
| API | Endpoint | Use it for |
|---|---|---|
| CometBFT RPC | https://rpc.testnet.firstaccess.exchange | Broadcasting transactions (broadcast_tx_sync, broadcast_tx_commit), blocks, tx by hash, abci_query on the stores. dYdX's TypeScript client connects here |
| REST | https://api.testnet.firstaccess.exchange | Every module's queries as JSON (Cosmos SDK, dYdX, x/binary), and transaction simulation |
| gRPC | grpc.testnet.firstaccess.exchange:443 (TLS) | The same queries and cosmos.tx.v1beta1.Service. dYdX's Python client connects here |
- The RPC answers a fixed list of methods; pending transactions are not public, and
/websocketis off (public RPC).GET /lists the methods. - The RPC, REST and gRPC are rate limited per IP (limits).
- CORS on the RPC and REST allows any origin, so a browser can call them directly.
- Values of type
uint64andSerializableIntare strings in REST JSON.
curl -s https://rpc.testnet.firstaccess.exchange/status
curl -s https://api.testnet.firstaccess.exchange/cosmos/base/tendermint/v1beta1/node_info
curl -s https://api.testnet.firstaccess.exchange/dydxprotocol/clob/clob_pair# gRPC, with grpcurl and server reflection
grpcurl grpc.testnet.firstaccess.exchange:443 list
grpcurl -d '{"company_id": 1}' grpc.testnet.firstaccess.exchange:443 dydxprotocol.binary.Query/CompanyIndexThe node serves gRPC reflection, so grpcurl needs no proto files.
Indexer
| API | Endpoint |
|---|---|
| HTTP | https://indexer.testnet.firstaccess.exchange/v4 |
| WebSocket | wss://indexer.testnet.firstaccess.exchange/v4/ws |
dYdX's indexer with its API unchanged, plus a chainMarket field on every chain market
(indexer API).
Explorer and faucet
| Endpoint | |
|---|---|
| Explorer | https://explorer.testnet.firstaccess.exchange (explorer) |
| Faucet status | GET https://app.testnet.firstaccess.exchange/faucet/status |
| Faucet drip | POST https://app.testnet.firstaccess.exchange/faucet/drip {"address": "dydx1..."} (quickstart) |
Configuring dYdX's clients
dYdX's clients ship with dYdX's own networks; point them at this chain:
import { IndexerClient, IndexerConfig, ValidatorClient, ValidatorConfig } from '@dydxprotocol/v4-client-js';
const REST = 'https://api.testnet.firstaccess.exchange';
async function main() {
// USDC is asset 0; read its denom from the chain.
const { asset } = await (await fetch(`${REST}/dydxprotocol/assets/asset/0`)).json();
const validator = await ValidatorClient.connect(
new ValidatorConfig('https://rpc.testnet.firstaccess.exchange', 'firstaccess-testnet-1', {
USDC_DENOM: asset.denom,
USDC_DECIMALS: 6,
CHAINTOKEN_DENOM: 'adv4tnt',
CHAINTOKEN_DECIMALS: 18,
}),
);
const indexer = new IndexerClient(
new IndexerConfig(
'https://indexer.testnet.firstaccess.exchange',
'wss://indexer.testnet.firstaccess.exchange/v4/ws',
),
);
}
main();import httpx
from dydx_v4_client.indexer.rest.indexer_client import IndexerClient
from dydx_v4_client.network import NodeConfig, secure_channel
from dydx_v4_client.node.client import NodeClient
REST = "https://api.testnet.firstaccess.exchange"
# USDC is asset 0; read its denom from the chain.
usdc_denom = httpx.get(f"{REST}/dydxprotocol/assets/asset/0").json()["asset"]["denom"]
node = await NodeClient.connect(
NodeConfig(
"firstaccess-testnet-1",
chaintoken_denom="adv4tnt",
usdc_denom=usdc_denom,
channel=secure_channel("grpc.testnet.firstaccess.exchange:443"),
)
)
# dydx_v4_client prices gas only in dYdX's own USDC denom or the chain token:
# pay fees in the chain token.
node.builder.denomination = "adv4tnt"
indexer = IndexerClient("https://indexer.testnet.firstaccess.exchange")The TypeScript client's ValidatorConfig takes the RPC endpoint; the Python client's
NodeConfig a gRPC channel, without a scheme. Both indexer clients take the indexer's base
URL, without /v4.
Both clients work with our indexer unchanged. Checked against a local indexer built from this
repository: TypeScript IndexerClient (utility.getHeight, markets.getPerpetualMarkets with
chainMarket, getPerpetualMarketOrderbook on a binary's 0.001 book, getPerpetualMarketTrades),
SocketClient (subscribeToMarkets), and Python IndexerClient (utility.get_height,
markets.get_perpetual_markets, get_perpetual_market_orderbook).