tradeparadex / code-samples

Collection of Paradex code samples and snippets
7 stars 7 forks source link

How to get Chain ID for Starknet’s main network? #65

Closed nickdul closed 5 months ago

nickdul commented 5 months ago

Hello Paradex Team,

Could you please clarify how to get Chain ID for Starknet’s main network?

below your example with hardcoded value for SEPOLIA:

https://github.com/tradeparadex/code-samples/blob/05d3ef69aee022b4dbd6da85901f46ad3f08c7ee/java/auth.groovy#L35

    // Chain ID - PRIVATE_SN_POTC_SEPOLIA
    BigInteger chainID = new BigInteger('7693264728749915528729180568779831130134670232771119425')
    String chainIdHex = '0x' + chainID.toString(16).toUpperCase()
amayvs commented 5 months ago

@nickdul Hi, chain ID starknet_chain_id can be obtained from the status page:

• Testnet: https://app.testnet.paradex.trade/status • Mainnet: https://app.paradex.trade/status

To convert it to a BigInteger string, you can use following utils:

Expected values:

// Testnet = PRIVATE_SN_POTC_SEPOLIA
testnetChainId = 7693264728749915528729180568779831130134670232771119425

// Mainnet = PRIVATE_SN_PARACLEAR_MAINNET
mainnetChainId = 8458834024819506728615521019831122032732688838300957472069977523540