Getting Started

Learn how to generate an API Key and make your first request with the expand.network API.

Follow these steps to get started today :

Step 1: 🔑 Create an API key (For further details, Click here)

Step 2: Make Your First Request

Performing READ operations

To perform read queries, directly target our domain https://api.expand.network/ to hit our API environment. Following are the examples to make read queries:

📑 Replace "YOUR_API_KEY" with your API Key, which was received by completing Step 1.

Example 1: via Postman

Example 2: via cURL from a command line

curl -H "x-api-key: YOUR_API_KEY" https://api.expand.network/chain/getbalance?address=0xe688b84b23f322a994A53dbF8E15FA82CDB71127

Performing WRITE operations

To perform a write transaction, you would require the followings:-

  1. expand.network SDK which can be cloned from GitHub.

  2. API key

  • Example code: Send one Wei from an address ending in 2c7 to address ending in 86F. You need to use your private key to sign the transaction. The return value is the transaction hash (res).

const rawTransaction = await signTransaction({
    from: '0x1BdC0A29f667E2cc74e55531431986838023E2c7',
    to: '0x94a5E554DC172A472421291Ae6e6c0e3C150286F',
    value: '1',
    gas: 50000,
},{
    privateKey: YOUR_PRIVATE_KEY',
    xApiKey : 'YOUR_API_KEY'
}).then(rawTransaction => sendTransaction({
    rawTransaction: rawTransaction.rawTransaction,
    xApiKey : 'YOUR_API_KEY'
})).then(res => console.log(res));

Good to know: All transactions are securely signed on your end, so your private key remains with you. Expand.network does not hold your crypto or have access to your private key at any point.

Last updated