SGChain API Reference
This guide provides a complete reference for the SGChain API. All endpoints (unless specified) require a standard User JWT in the Authorization header.
Base URL: Public soon
Blockchain Explorer
Allows users to inspect transaction status directly from the blockchain node.
Get Transaction Details
GET/explorer/tx/:hashPublic
Parameters
hash(Path)The 66-character transaction hash (e.g., 0x85d...).
Response Example
{
"hash": "0x85d4e0860b5ca201a3488d177b532e6346312165494b5c5bde970b6c52c9c937",
"from": "0x109621604130f32801CA225D6E8081363f5AA085",
"to": "0x487aEa14d763b31D1e25C2A2f15ebb91Bfa0C666",
"value": "120.0",
"blockNumber": 108832,
"timestamp": 1764490186,
"status": "SUCCESS",
"gasUsed": "21000",
"gasPrice": "0.000000007"
}Wallet Management
Endpoints for managing user wallets, including balances and sensitive operations.
Get My Wallet
GET/me/walletUser JWT
Response Example
{
"sgcBalance": 100.50,
"fiatBalanceUsd": 500.00,
"sgcValueUsd": 11557.50,
"totalAccountValueUsd": 12057.50,
"isPinSet": true
}Reveal Private Key
A short-lived Wallet Access Token is required for this sensitive operation.
GET/me/wallet/detailsWallet Access Token
Response Example
{
"onchainAddress": "0x123...",
"privateKey": "0xabc..."
}Verify PIN (Unlock Wallet)
POST/me/wallet/verify-pinUser JWT
Request Body
{ "pin": "1234" }Response Example
{
"walletAccessToken": "ey...",
"expiresIn": 14400
}Token Launchpad
Create and deploy your own custom tokens on the SGChain network.
Create Token Draft
POST/tokensUser JWT
Request Body
{
"tier": "FUN",
"metadata": {
"name": "My Coin",
"symbol": "MYC",
"decimals": 18
},
"supplyConfig": { "totalSupply": "1000000" },
"allocations": [
{ "category": "CREATOR", "percent": 100, "amount": "1000000" }
]
}Submit for Deployment
Deducts the deployment fee (in SGC) and triggers the on-chain contract creation.
POST/tokens/:id/submitUser JWT
Response Example
{
"status": "PENDING_ONCHAIN",
"sgcForLiquidity": "..."
}List My Tokens
GET/tokens/my-tokensUser JWT
Swap (DEX)
Endpoints for swapping tokens through the decentralized exchange.
Get Quote
GET/swap/quoteUser JWT
Parameters
tokenIn(Query)'SGC' or a token address.tokenOut(Query)'SGC' or a token address.amountIn(Query)The amount of the input token to swap.
Response Example
{ "amountOut": "12.5432" }Execute Swap
POST/swap/executeWallet Access Token
Request Body
{
"tokenIn": "SGC",
"tokenOut": "0xTokenAddress...",
"amountIn": "10",
"slippage": 0.5
}Transfers
Move SGC between users or to external platforms.
Internal Transfer (SGC)
POST/me/transfer/sgcUser JWT
Request Body
{
"toEmail": "friend@example.com",
"amountSgc": 5.0
}External Transfer (To Exchange)
Returns a redeemable code for use on an external platform.
POST/me/transfer/externalUser JWT
Request Body
{ "amountSgc": 10 }