> For the complete documentation index, see [llms.txt](https://documentation.script.tv/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.script.tv/smart-contract-and-app-development/ethereum-rpc-api-support.md).

# Ethereum RPC API support

Script blockchain supports the Ethereum RPC APIs through the Script ETH RPC Adpator(<https://github.com/scriptnetwork/script-eth-rpc-adaptor>), which translates the Script RPC interface into the Ethereum RPC interface.

(I) Ethereum RPC APIs for the Script Testnet

We are hosting the Ethereum RPC adaptor for the Script Testnet at the URL below. The Chain ID for the Script Testnet(<https://chainlist.org/>) is 742.

\***Important note**: This hosted RPC service is only meant for lightweight usages. We highly recommend DApp developers to set up their in-house Ethereum RPC adaptors, especially those that use indexers like the Graph to crawl the chain data.

{% embed url="<https://testeth-rpc-api.script.tv/rpc>" %}

The following examples demonstrate how to interact with the Script Testnet through the above RPC endpoint with the curl command:

## Query Chain ID

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth\_chainId","params":\[],"id":67}' <https://testeth-rpc-api.script.tv/rpc>

## Query synchronization status

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth\_syncing","params":\[],"id":1}' <https://testeth-rpc-api.script.tv/rpc>

## Query block number

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth\_blockNumber","params":\[],"id":83}' <https://testeth-rpc-api.script.tv/rpc>

## Query account SPAY balance (should return an integer which represents the current SPAY balance in wei)

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth\_getBalance","params":\["0xc15149236229bd13f0aec783a9cc8e8059fb28da", "latest"],"id":1}' <https://testeth-rpc-api.script.tv/rpc>

We currently support the following Ethereum RPC methods(<https://ethereum.org/en/developers/docs/apis/json-rpc>):

eth\_chainId&#x20;

eth\_syncing&#x20;

eth\_accounts&#x20;

eth\_protocolVersion&#x20;

eth\_getBlockByHash&#x20;

eth\_getBlockByNumber&#x20;

eth\_blockNumber&#x20;

eth\_getUncleByBlockHashAndIndex&#x20;

eth\_getTransactionByHash&#x20;

eth\_getTransactionByBlockNumberAndIndex&#x20;

eth\_getTransactionByBlockHashAndIndex&#x20;

eth\_getBlockTransactionCountByHash&#x20;

eth\_getTransactionReceipt&#x20;

eth\_getBalance&#x20;

eth\_getStorageAt&#x20;

eth\_getCode&#x20;

eth\_getTransactionCount&#x20;

eth\_getLogs&#x20;

eth\_getBlockTransactionCountByNumber&#x20;

eth\_call&#x20;

eth\_gasPrice&#x20;

eth\_estimateGas&#x20;

eth\_sendRawTransaction&#x20;

eth\_sendTransaction&#x20;

eth\_sign&#x20;

eth\_signTypedData&#x20;

net\_version&#x20;

web3\_clientVersion

**Note 1:** Currently the RPC Adaptor does NOT support non-standard methods (<https://npmmirror.com/package/ganache-core/v/2.3.3>) like evm\_snapshot, evm\_revert, and evm\_mine. Thus, test cases using Fixtures (<https://ethereum-waffle.readthedocs.io/en/latest/fixtures.html>) (e.g. waffle.loadFixture()) are expected to fail when running against the Script blockchain.

**Note 2:** Currently the RPC Adaptor returns a generic "evm: execution reverted" messages in most case when the Script EVM execution fails. Some test cases may check the EVM errors with code like this:

await expect(this.bar.leave("200")).to.be.revertedWith("ERC20: burn amount exceeds balance")

To make these test pass, for now we need to replace the expected error message with "evm: execution reverted" as shown below:

await expect(this.bar.leave("200")).to.be.revertedWith("evm: execution reverted")

If you need testnet SCPT/SPAY for DApp development purpose, please contact us at <https://discord.com/invite/scriptnetwork>.
