Deploying GIP-1 and GIP-2 Assets
GIP-1 and GIP-2 define the standards for deploying new spot tokens and spot trading pairs on GX Exchange. This page documents the API for permissionless token and pair deployment.
Overview
| Standard | Purpose | Description |
|---|---|---|
| GIP-1 | Spot token deployment | Register a new token on GX Exchange for spot trading |
| GIP-2 | Spot pair deployment | Create a new trading pair between two registered tokens |
Any address can deploy GIP-1 tokens and GIP-2 pairs. The deployer address has certain administrative privileges over the assets they deploy (see GIP-3 Deployer Actions).
GIP-1: Deploy a Spot Token
Registers a new token on GX Exchange. The token receives a unique index in the spot asset space (10000+).
Action
{
"action": {
"type": "spotDeploy",
"deployType": "token",
"tokenName": "MYTOKEN",
"szDecimals": 6,
"weiDecimals": 18,
"initialSupply": "1000000.0",
"evmContract": "0xTokenContractAddress..."
},
"nonce": 1700000000123,
"signature": { "r": "0x...", "s": "0x...", "v": 27 }
}| Field | Type | Required | Description |
|---|---|---|---|
tokenName | string | Yes | Token symbol (e.g., "MYTOKEN") — must be unique |
szDecimals | int | Yes | Size decimal places for order quantities |
weiDecimals | int | Yes | On-chain decimal places (typically 18 for ERC-20) |
initialSupply | string | No | Initial token supply to mint |
evmContract | address? | No | GX EVM contract address if the token has an on-chain representation |
Response
{
"status": "ok",
"response": {
"type": "spotDeploy",
"data": {
"tokenIndex": 10042,
"tokenName": "MYTOKEN",
"deployer": "0xYourAddress..."
}
}
}Constraints
| Constraint | Requirement |
|---|---|
| Token name | 1-10 uppercase alphanumeric characters |
| Token name uniqueness | Must not collide with existing token names |
| szDecimals | 0-8 |
| weiDecimals | 0-18 |
| Deployer deposit | A minimum deposit may be required to prevent spam |
GIP-2: Deploy a Spot Pair
Creates a new trading pair between two registered GIP-1 tokens.
Action
{
"action": {
"type": "spotDeploy",
"deployType": "pair",
"baseToken": 10042,
"quoteToken": 10001,
"initialPrice": "1.50"
},
"nonce": 1700000000123,
"signature": { "r": "0x...", "s": "0x...", "v": 27 }
}| Field | Type | Required | Description |
|---|---|---|---|
baseToken | int | Yes | Token index of the base asset |
quoteToken | int | Yes | Token index of the quote asset |
initialPrice | string | No | Suggested initial reference price |
Response
{
"status": "ok",
"response": {
"type": "spotDeploy",
"data": {
"pairIndex": 10042,
"pairName": "MYTOKEN-USDC",
"baseToken": 10042,
"quoteToken": 10001
}
}
}Constraints
| Constraint | Requirement |
|---|---|
| Both tokens | Must be valid registered GIP-1 tokens |
| Pair uniqueness | The base/quote combination must not already exist |
| Quote token | Typically USDC (index 10001) for liquidity |
Code Examples
TypeScript — Deploy Token and Pair
import { GxClient } from "@gx-exchange/sdk";
const client = new GxClient();
await client.connect("https://api.gx.exchange");
client.setWallet("0xYourPrivateKey...");
// Deploy a new token
const tokenResult = await client.exchange({
action: {
type: "spotDeploy",
deployType: "token",
tokenName: "MYTOKEN",
szDecimals: 6,
weiDecimals: 18,
},
nonce: Date.now(),
});
const tokenIndex = tokenResult.response.data.tokenIndex;
console.log("Token deployed at index:", tokenIndex);
// Deploy a trading pair against USDC
const pairResult = await client.exchange({
action: {
type: "spotDeploy",
deployType: "pair",
baseToken: tokenIndex,
quoteToken: 10001, // USDC
},
nonce: Date.now(),
});
console.log("Pair deployed:", pairResult.response.data.pairName);Python — Deploy Token
from gx_exchange.exchange import Exchange
from gx_exchange.utils.constants import MAINNET_API_URL
import eth_account
import time
account = eth_account.Account.from_key("0xYourPrivateKey...")
exchange = Exchange(account, MAINNET_API_URL)
# Deploy token
result = exchange.spot_deploy(
deploy_type="token",
token_name="MYTOKEN",
sz_decimals=6,
wei_decimals=18,
)
print(f"Token index: {result['response']['data']['tokenIndex']}")Verifying Deployment
After deployment, the new token and pair appear in the spotMeta response:
POST /info
{ "type": "spotMeta" }Search the tokens array for your token name and verify the assigned index matches the deployment response.
Deployment Fees
| Operation | Fee |
|---|---|
| GIP-1 token deployment | 10 USDC |
| GIP-2 pair deployment | 10 USDC |
Fees are deducted from the deployer’s GX Exchange balance.