Introduction
In this tutorial, you’ll learn how to generate your Orderly Account ID
— a crucial step to authenticate yourself and use their private APIs.
Before you can sign requests or integrate trading features with Orderly, you need this unique identifier linked to your wallet and the broker you’re working with.
We’ll go over what Orderly is, why the Account ID matters, and how to generate it step by step using JavaScript.
What is Orderly?
Orderly is a decentralized trading infrastructure (DEX infra) that combines the efficiency of a centralized exchange (CEX) with the transparency and self-custody of DeFi. It doesn’t have its own user interface; instead, it provides an order engine and a liquidity layer that can be easily integrated by other projects.
Thanks to its modular design, developers can build DEXs, wallet integrations, trading bots, or in-game swaps — all using its shared liquidity. Its vision is to connect multiple blockchains (both EVM and non-EVM) into a single order book, enabling seamless omnichain trading without bridges or friction.
What is the Account ID used for?
The Account ID is the first requirement to authenticate with the Orderly API. All private endpoints—such as placing orders or checking balances—require authentication using cryptographic keys.
This process, known as API Authentication
, ensures that requests to the API come from a valid user by signing each message with a private key (Orderly key). To make this work, you must include the orderly-account-id
in the headers of every request.
In short, without an Account ID, you can’t generate valid signatures or access the API’s private features. That’s why the first step before interacting programmatically with Orderly is to create your Account ID.
How to Create an Account ID
To authenticate with the Orderly API, you first need to generate your Account ID. This identifier is derived from your wallet and the brokerId
of the builder you’re working with.
Each wallet can have multiple Account IDs—one for each builder—and these IDs are not connected to each other.
1. Make sure you have Node.js installed.
2. Install the ethers
library (if you haven’t already):
npm install ethers
3. Getting the broker_id
To generate your Account ID, you need to know the broker_id
. Orderly provides an endpoint called chain_info
where you can check the available broker_ids
for each network.
Follow these steps:
- Go to the chain_info endpoint
- Click the
Try it
button - In the input field, enter a sample
broker_id
likewoofi_pro
- You’ll see a list of all available
broker_ids
by network
4. Create a .js
file and paste the following code:
import { AbiCoder, keccak256, solidityPackedKeccak256 } from "ethers";
const userAddress = "0xYOUR_ADDRESS"; // Replace with your wallet
const brokerId = "BROKER_ID"; // Replace with the brokerId
export function getAccountId(userAddress, brokerId) {
const abicoder = AbiCoder.defaultAbiCoder();
return keccak256(
abicoder.encode(
['address', 'bytes32'],
[userAddress, solidityPackedKeccak256(['string'], [brokerId])]
)
);
}
const accountId = getAccountId(userAddress, brokerId);
console.log(accountId);
5. Run the file with:
node filename.js
You’ll see your Account ID printed in the console, something like this:
0x440adacb805d48efc87ba34dd6401f8fc8b45ee55126ccd9a14f33f5b85d403c
This is the value you’ll use as orderly-account-id in the headers of your API requests.
Conclusion
Getting your Orderly Account ID is the first step toward securely interacting with its trading infrastructure. This ID allows you to authenticate your API requests and start building on the Orderly ecosystem—whether it's creating a DEX, integrating swaps into a wallet, or automating trades with bots.
With just a few steps and common tools like Node.js
and ethers
, you’re ready to start developing with Orderly.
Top comments (0)