# zkSync Era

### /getbalance

#### Get the balance or number of the given token in the requested public address.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/getbalance`

#### Query Parameters

| Name                                      | Type   | Description                                                                                                                                 |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| rpc                                       | String | Remote procedural call URL                                                                                                                  |
| chainId<mark style="color:red;">\*</mark> | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                        |
| chainSymbol                               | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                                                        |
| blockNumber                               | String | <p>Block number for which the balance needs to be retrieved.</p><p>By default, it will pick the latest block number when not specified.</p> |
| address<mark style="color:red;">\*</mark> | String | The public address to get the balance of.                                                                                                   |
| tokenAddress                              | String | The address of token to get the balance of.                                                                                                 |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/getbalance?chainId=324&blockNumber=35710825&address=0x5f5BB2b9A16d48541d38E048E94a9CD713bD6Cb7&tokenAddress=0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "balance": "177900"
    }
}
```

{% endtab %}
{% endtabs %}

### /getblock

#### Get details of a block.

<mark style="color:blue;">`GET`</mark> `https://historicallp.api.expand.network/chain/getblock`

#### Query Parameters

| Name                                          | Type   | Description                                                                          |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                           | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark>     | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                   | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| blockNumber<mark style="color:red;">\*</mark> | String | The block number or block hash.                                                      |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicallp.api.expand.network/chain/getblock?blockNumber=696293&chainId=324
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "baseFeePerGas": 250000000,
    "difficulty": "0",
    "extraData": "0x",
    "gasLimit": 4294967295,
    "gasUsed": 3273403,
    "hash": "0x978dd7094735b8621254f26a875f020413ef7a498ad5dce79ab322bf5c4e5313",
    "l1BatchNumber": "0x1c05",
    "l1BatchTimestamp": "0x642a40e5",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0x0000000000000000000000000000000000000000",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "nonce": "0x0000000000000000",
    "number": 696293,
    "parentHash": "0x0019d93c7755306ee4861d6e203fe3bf754fab46c24d74f9a700a46b236c023f",
    "receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "sealFields": [],
    "size": 0,
    "timestamp": 1680490794,
    "totalDifficulty": "0",
    "transactions": [
      {
        "chainId": "324",
        "hash": "0x638118f1c0ee1ec486d54e3928839380cac1c32952b9938c6ce83ec068bb4552",
        "transactionStatus": true,
        "blockNumber": "696293",
        "timestamp": null,
        "from": "0x4a16466fCE63B2c79e562A35Dad32E9F3cAEF90d",
        "to": "0xD0eA21ba66B67bE636De1EC4bd9696EB8C61e9AA",
        "value": "0",
        "transactionFees": "107598250000000",
        "gas": "764969",
        "gasPrice": "250000000",
        "input": "0x095ea7b30000000000000000000000002da10a1e27bf85cedd8ffb1abbe97e53391c02950000000000000000000000000000000000000000000000001bc16d674ec80000",
        "nonce": 4,
        "type": null,
        "network": null,
        "v": "0x2ab",
        "r": "0x5e405172ff1cbf5b4af2595c15f67e79c7049efd3f990611950c511a10494468",
        "s": "0x78ca1efdb6e3cce11267a9d17de75aee293da3f0406396f3d08a8fc4c2345b8a",
        "yParity": null,
        "transactionIndex": null,
        "accessList": null,
        "maxFeePerGas": "260000000",
        "maxPriorityFeePerGas": "260000000",
        "logs": []
      }
    ],
    "transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "uncles": []
  }
}
```

{% endtab %}
{% endtabs %}

### /getgasprice

#### Get the current gas price from the network.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/getgasprice`

#### Query Parameters

| Name                                      | Type   | Description                                                                          |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                       | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark> | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                               | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/getgasprice?chainId=324
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "gasPrice": "100000000"
    }
}
```

{% endtab %}
{% endtabs %}

### /getstorage

#### Get data stored in the given slot.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/getstorage`

#### Query Parameters

| Name                                      | Type   | Description                                                                          |
| ----------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                       | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark> | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                               | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| address<mark style="color:red;">\*</mark> | String | Contract address whose storage is needed.                                            |
| index                                     | String | Slot index on the smart contract. By default,  it is taken as 0.                     |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/getstorage?address=0x32Fd44bB869620C0EF993754c8a00Be67C464806&chainId=324&index=0
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "data": "0x0000000000000000000000000000000000000000000000000000000000000001"
    }
}
```

{% endtab %}
{% endtabs %}

### /gettransaction

#### Get details of a transaction.

<mark style="color:blue;">`GET`</mark> `https://api.expand.network/chain/gettransaction`

#### Query Parameters

| Name                                              | Type   | Description                                                                          |
| ------------------------------------------------- | ------ | ------------------------------------------------------------------------------------ |
| rpc                                               | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark>         | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                       | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| transactionHash<mark style="color:red;">\*</mark> | String | The transaction hash.                                                                |

{% tabs %}
{% tab title="Sample Request" %}

```url
https://api.expand.network/chain/gettransaction?chainId=324&transactionHash=0xe43b77386a5e5bdffaa62b347044cfd28b71947b6c9869046a1df644a3b83bb0
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
  "status": 200,
  "msg": "success",
  "data": {
    "chainId": "324",
    "hash": "0xe43b77386a5e5bdffaa62b347044cfd28b71947b6c9869046a1df644a3b83bb0",
    "transactionStatus": true,
    "blockNumber": "26972503",
    "timestamp": null,
    "from": "0xBf1C2eD425398FD04ecf319BEbd39EC487eEFeDF",
    "to": "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4",
    "value": "0",
    "transactionFees": "47253200000000",
    "gas": "1056669",
    "gasPrice": "100000000",
    "input": "0x095ea7b3000000000000000000000000f8b59f3c3ab33200ec80a8a58b2aa5f5d2a8944cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
    "nonce": 50,
    "type": 2,
    "network": null,
    "v": "0x0",
    "r": "0x45f3755db709c047dd9305f891fb44903f1dd6cf7a18747202d97a1b6a07e6bd",
    "s": "0x14f97115c291f73c75ea7d4f5b8d2019fcb33e934c65ab193929075591abc83d",
    "yParity": null,
    "transactionIndex": 25,
    "accessList": null,
    "maxFeePerGas": "135000000",
    "maxPriorityFeePerGas": "0",
    "logs": [
      {
        "address": "0x000000000000000000000000000000000000800A",
        "blockHash": "0x01f0e4321958ad440ccc627214933209614abac4f5534a8f15a13a2a92f97037",
        "blockNumber": 26972503,
        "data": "0x000000000000000000000000000000000000000000000000000081bd5d5a48c0",
        "l1BatchNumber": "0x6b911",
        "logIndex": 136,
        "logType": null,
        "removed": false,
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x000000000000000000000000bf1c2ed425398fd04ecf319bebd39ec487eefedf",
          "0x0000000000000000000000000000000000000000000000000000000000008001"
        ],
        "transactionHash": "0xe43b77386a5e5bdffaa62b347044cfd28b71947b6c9869046a1df644a3b83bb0",
        "transactionIndex": 25,
        "transactionLogIndex": "0x0",
        "id": "log_d7912a52"
      },
      {
        "address": "0x000000000000000000000000000000000000800A",
        "blockHash": "0x01f0e4321958ad440ccc627214933209614abac4f5534a8f15a13a2a92f97037",
        "blockNumber": 26972503,
        "data": "0x000000000000000000000000000000000000000000000000000021a2df504bc0",
        "l1BatchNumber": "0x6b911",
        "logIndex": 137,
        "logType": null,
        "removed": false,
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x0000000000000000000000000000000000000000000000000000000000008001",
          "0x000000000000000000000000bf1c2ed425398fd04ecf319bebd39ec487eefedf"
        ],
        "transactionHash": "0xe43b77386a5e5bdffaa62b347044cfd28b71947b6c9869046a1df644a3b83bb0",
        "transactionIndex": 25,
        "transactionLogIndex": "0x1",
        "id": "log_66ae4e73"
      },
      {
        "address": "0x3355df6D4c9C3035724Fd0e3914dE96A5a83aaf4",
        "blockHash": "0x01f0e4321958ad440ccc627214933209614abac4f5534a8f15a13a2a92f97037",
        "blockNumber": 26972503,
        "data": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
        "l1BatchNumber": "0x6b911",
        "logIndex": 138,
        "logType": null,
        "removed": false,
        "topics": [
          "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
          "0x000000000000000000000000bf1c2ed425398fd04ecf319bebd39ec487eefedf",
          "0x000000000000000000000000f8b59f3c3ab33200ec80a8a58b2aa5f5d2a8944c"
        ],
        "transactionHash": "0xe43b77386a5e5bdffaa62b347044cfd28b71947b6c9869046a1df644a3b83bb0",
        "transactionIndex": 25,
        "transactionLogIndex": "0x2",
        "id": "log_e96517f9"
      },
      {
        "address": "0x000000000000000000000000000000000000800A",
        "blockHash": "0x01f0e4321958ad440ccc627214933209614abac4f5534a8f15a13a2a92f97037",
        "blockNumber": 26972503,
        "data": "0x000000000000000000000000000000000000000000000000000035207fd6a900",
        "l1BatchNumber": "0x6b911",
        "logIndex": 139,
        "logType": null,
        "removed": false,
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x0000000000000000000000000000000000000000000000000000000000008001",
          "0x000000000000000000000000bf1c2ed425398fd04ecf319bebd39ec487eefedf"
        ],
        "transactionHash": "0xe43b77386a5e5bdffaa62b347044cfd28b71947b6c9869046a1df644a3b83bb0",
        "transactionIndex": 25,
        "transactionLogIndex": "0x3",
        "id": "log_350928fb"
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

### **/sendtransaction**

#### Send transaction on the chain.

<mark style="color:green;">`POST`</mark> `https://api.expand.network/chain/sendtransaction`

#### Request Body

| Name                                             | Type   | Description                                                                          |
| ------------------------------------------------ | ------ | ------------------------------------------------------------------------------------ |
| rpc                                              | String | Remote procedural call URL.                                                          |
| chainId<mark style="color:red;">\*</mark>        | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| chainSymbol                                      | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. |
| rawTransaction<mark style="color:red;">\*</mark> | String | The encoded transaction, obtained from the signed transaction.                       |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "rawTransaction": "0xf86d0d8405f5e100830927c0946fb447ae94f5180254d436a693907a1f5769690087038d7ea4c680008082027ba0d73a953d53eb64f90c7c91273df70074021ec9d6aa2280ba53527086a5d45f65a0273ee55497b2374af9b244af11a2e5a02f94137385fac51ef51f21908a18ca57",
    "chainId": "324"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "324",
        "transactionHash": "0x7d987e52e0b106a2171919775970089b052857046fbf32137c8c445f10d6d69f" 
    }
}
```

{% endtab %}
{% endtabs %}

### /decodetransaction

#### Get the decoded transaction for the provided raw transaction.&#x20;

<mark style="color:green;">`POST`</mark> `https://api.expand.network/chain/decodetransaction`

#### Request Body

| Name                                             | Type   | Description                                                                                                |
| ------------------------------------------------ | ------ | ---------------------------------------------------------------------------------------------------------- |
| chainId                                          | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details. By default, Ethereum. |
| chainSymbol                                      | String | Refer to the [Chain ID ](https://docs.expand.network/ids/chain-ids)page for details.                       |
| rawTransaction<mark style="color:red;">\*</mark> | String | The raw transaction to be given for decoding.                                                              |

{% tabs %}
{% tab title="Sample Request" %}

```json
{
    "rawTransaction": "0xf86d808405f5e100830927c0946fb447ae94f5180254d436a693907a1f5769690087038d7ea4c68000808202aca0535316a857d5c6f59ee228509cf9eb638905250548c7a7effcc6ebff22bca4dea012a9859bf2f663521c9832f1d118de7d548e119b5d9b07ff6d6d349025b3f8b2"
}
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "parsedTx": {
            "nonce": 0,
            "gasPrice": {
                "type": "BigNumber",
                "hex": "0x05f5e100"
            },
            "gasLimit": {
                "type": "BigNumber",
                "hex": "0x0927c0"
            },
            "to": "0x6Fb447Ae94F5180254D436A693907a1f57696900",
            "value": {
                "type": "BigNumber",
                "hex": "0x038d7ea4c68000"
            },
            "data": "0x",
            "chainId": 324,
            "v": 684,
            "r": "0x535316a857d5c6f59ee228509cf9eb638905250548c7a7effcc6ebff22bca4de",
            "s": "0x12a9859bf2f663521c9832f1d118de7d548e119b5d9b07ff6d6d349025b3f8b2",
            "from": "0x56D2208EfD27Fe9C67e3879DeBCe35833B9D4cC7",
            "hash": "0x90521267c0d1e6f72398e1bc1d45552415145126656a385c07494c56832ea3c9",
            "type": null
        },
        "assetChanges": {
            "from": "0x56D2208EfD27Fe9C67e3879DeBCe35833B9D4cC7",
            "to": "0x6Fb447Ae94F5180254D436A693907a1f57696900",
            "value": {
                "type": "BigNumber",
                "hex": "0x038d7ea4c68000"
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}
