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.
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
eth_syncing
eth_accounts
eth_protocolVersion
eth_getBlockByHash
eth_getBlockByNumber
eth_blockNumber
eth_getUncleByBlockHashAndIndex
eth_getTransactionByHash
eth_getTransactionByBlockNumberAndIndex
eth_getTransactionByBlockHashAndIndex
eth_getBlockTransactionCountByHash
eth_getTransactionReceipt
eth_getBalance
eth_getStorageAt
eth_getCode
eth_getTransactionCount
eth_getLogs
eth_getBlockTransactionCountByNumber
eth_call
eth_gasPrice
eth_estimateGas
eth_sendRawTransaction
eth_sendTransaction
eth_sign
eth_signTypedData
net_version
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.