Script Network Documentation
  • Getting Started Guides
    • How to Sign Up + Sign In to Script TV
    • Using the Live TV player
    • Navigating the Script TV Dashboard (Test Phase)
    • Testnet, Explorer + Creating a Wallet (Test Phase)
    • Reward System: Script Points, Zealy, Galxe + more
  • ScriptGLASS - How to mint
  • 🎬About Script Network
    • Introduction
    • Products
    • Why Script TV?
    • How it works
    • Understanding the Script Blockchain
    • Script TV + Web3
    • Market Strategy
    • Benefits
    • Comparison
  • 🗺️Roadmap
  • 🪙Script Tokens
    • SCPT
      • Detailed SCPT Tokenomics
    • SPAY
      • 💰SPAY Tokenomics
        • 🕶️ScriptGLASS explained
          • Economics
        • Allowable/Earnable Watch Time
      • Mechanism Design of Glasses
        • Glass Types
        • Glass Payouts
          • Durability
        • Gems
        • Levels
        • Recharge Vouchers
        • Recharge Voucher Mechanism
        • Recharge Costs
        • Glass Minting
        • Game Theory
  • 🦸For Users
    • ⛓️Blockchain Integration
      • Installation guide for Script Node setup for Win , Mac and Linux
      • Build and Install
      • Run Unit Tests
      • Launch Script Node
      • Command Line Tool
      • Steps To Upgrade The Chain
      • Account/Wallet Management
      • Call Smart Contract
      • Turing-Complete Smart Contract Support
    • Basic Concept
    • Tokens
    • Script NFTs
    • Transactions
    • Script Wallet
    • Faucet (Technical)
    • Smart Contracts
  • 🌐Script Network Explorer
    • Block APIs
    • Transaction APIs
    • Account APIs
    • Stake APIs
  • 🔯Nodes
    • Node Token Emissions
    • Lightning Node Overview
      • Validator / Lightning Node Setup
        • Steps To Change Node Password
        • Stake to the Lightning node
    • Lightning Staking Process
      • Lightning Stake Withdrawal Process
        • Staking through Web Wallet
  • 💠Validators
    • Block Settlement
    • Steps To Migrate Lightning/Validator
  • 📒Edge Documentation
    • Introduction
    • What is Edge
    • How it works
    • Edge Uses
    • Possibilities with Edge
    • Edge Features
    • Benefits
    • Use Cases
  • 🔗Smart Contract Development
    • 💻 How to quickly deploy a smart contract on Script Blockchain
  • Smart Contract & App Development
    • Turing-Complete Smart Contract
    • Ethereum RPC API support
    • Setup the ETH RPC Adaptor for the Script Testnet
    • Metamask
    • Truffle
    • Hardhat
    • Remix
    • Web3.js
    • Explorer Tools for DApp Development
    • Script Blockchain SRC20 Token Integration Guide
  • 📔API References
    • Metamask Script Network RPC Details (Testnet)
    • RPC API Reference
      • Examples
      • GetBlock
        • Transaction Types
        • Request
        • GetBlockByHeight
      • GetTransaction
        • GetPendingTransactions
    • Tx APIs
      • Broadcast Raw Transaction
      • BroadcastRawTransactionAsync
    • ScriptCli APIs
      • Account APIs
        • NewKey API
        • ListKeys
        • UnlockKey
        • LockKey
        • IsKeyUnlocked
      • Tx APIs
        • Send
        • Configuration for the Script Blockchain Node
  • 🤝Referrals/Network Effects
  • 🛡️ Audits
  • 📊Script Network Blockchain Summary
  • Disclaimer
  • Frequently Asked Question
    • To resolve the block height issue
    • Update seed peer to resolve connectivity issue
Powered by GitBook
On this page
  • Query Chain ID
  • Query synchronization status
  • Query block number
  • Query account SPAY balance (should return an integer which represents the current SPAY balance in wei)

Was this helpful?

  1. Smart Contract & App Development

Ethereum RPC API support

PreviousTuring-Complete Smart ContractNextSetup the ETH RPC Adaptor for the Script Testnet

Last updated 1 year ago

Was this helpful?

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.

https://testeth-rpc-api.script.tv/rpc