For DevelopersAPIDeploying GIP-1 & GIP-2 Assets

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

StandardPurposeDescription
GIP-1Spot token deploymentRegister a new token on GX Exchange for spot trading
GIP-2Spot pair deploymentCreate 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 }
}
FieldTypeRequiredDescription
tokenNamestringYesToken symbol (e.g., "MYTOKEN") — must be unique
szDecimalsintYesSize decimal places for order quantities
weiDecimalsintYesOn-chain decimal places (typically 18 for ERC-20)
initialSupplystringNoInitial token supply to mint
evmContractaddress?NoGX 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

ConstraintRequirement
Token name1-10 uppercase alphanumeric characters
Token name uniquenessMust not collide with existing token names
szDecimals0-8
weiDecimals0-18
Deployer depositA 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 }
}
FieldTypeRequiredDescription
baseTokenintYesToken index of the base asset
quoteTokenintYesToken index of the quote asset
initialPricestringNoSuggested initial reference price

Response

{
  "status": "ok",
  "response": {
    "type": "spotDeploy",
    "data": {
      "pairIndex": 10042,
      "pairName": "MYTOKEN-USDC",
      "baseToken": 10042,
      "quoteToken": 10001
    }
  }
}

Constraints

ConstraintRequirement
Both tokensMust be valid registered GIP-1 tokens
Pair uniquenessThe base/quote combination must not already exist
Quote tokenTypically 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

OperationFee
GIP-1 token deployment10 USDC
GIP-2 pair deployment10 USDC

Fees are deducted from the deployer’s GX Exchange balance.