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

Setup the ETH RPC Adaptor for the Script Testnet

This page provides the instructions to setup the ETH RPC Adaptor for the Script Testnet on a virtual machine. The adaptor is a middleware which translates the Script RPC interface to the Ethereum RPC interface. To enable the Script ETH RPC API service, you’d need to run

  1. the Script Node, and

  2. the Script/ETH RPC adaptor on the same VM.

Below is the recommended VM spec:

OS: Ubuntu (18.04.4 LTS or higher version)

CPU: 4 cores or more

Memory: 32 GB or more

Hardrive: 1 TB+ SSD drive

(I) Install and Launch the Script Testnet Node (https://whitepaper.script.tv/validators/validator-node-setup)

(II) Install and Launch the ETH RPC adaptor

Install the adaptor

You'd need to compile the adaptor from the source code. First, install Go 1.14.2 and set environment variables GOPATH , GOBIN, and PATH. Next, clone the Script blockchain repo and install Script following the steps below:

mkdir -p $GOPATH/src/github.com/scripttoken

cd $GOPATH/src/github.com/scripttoken

git clone https://github.com/scriptnetwork/Node-Network-guide.git $GOPATH/src/github.com/scripttoken/script

cd script

git checkout release

export GO111MODULE=on

make install

Next, clone the script-eth-rpc-adaptor repo:

cd $GOPATH/src/github.com/scripttoken

git clone https://github.com/scriptnetwork/script-eth-rpc-adaptor.git

Following the steps below to build the script-eth-rpc-adaptor binary and copy it into your $GOPATH/bin.

export SCRIPT_ETH_RPC_ADAPTOR_HOME=$GOPATH/src/github.com/scripttoken/script-eth-rpc-adaptor

cd $SCRIPT_ETH_RPC_ADAPTOR_HOME

export GO111MODULE=on

make install

Start the Adaptor

Now, create the config folder for the RPC adaptor

export SCRIPT_ETH_RPC_ADAPTOR_HOME=$GOPATH/src/github.com/scripttoken/script-eth-rpc-adaptor

cd $SCRIPT_ETH_RPC_ADAPTOR_HOME

mkdir -p ../scriptnet/eth-rpc-adaptor

Use your favorite editor to open file ../scriptnet/eth-rpc-adaptor/config.yaml, paste in the follow content, save and close the file:

script:

rpcEndpoint: "http://127.0.0.1:16888/rpc"

node:

skipInitializeTestWallets: true

rpc:

enabled: true

httpAddress: "0.0.0.0"

httpPort: 18888

wsAddress: "0.0.0.0"

wsPort: 18889

timeoutSecs: 600

maxConnections: 2048

log:

levels: "*:info"

Then, launch the adaptor binary with the following command:

screen -S rpc_adaptor # if you run the node on a Linux server

cd $SCRIPT_ETH_RPC_ADAPTOR_HOME

script-eth-rpc-adaptor start --config=../scriptnet/eth-rpc-adaptor

The ETH RPC server should now be started at port 18888.

Sanity checks

After the adaptor is started, you can issue the following curl commands to make sure the ETH RPC APIs service is up and running. Note that in the config.yaml file, rpc.httpAddress is set to "0.0.0.0", which enables the RPC APIs to be accessible from a remote machine. Of course, you'd also need to setup proper firewall rules to allow remote access.

Query Chain ID

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":67}' http://127.0.0.1:18888/rpc

Query synchronization status

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://127.0.0.1:18888/rpc

Query block number

curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' http://127.0.0.1:18888/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}' http://127.0.0.1:18888/rpc

PreviousEthereum RPC API supportNextMetamask

Last updated 1 year ago

Was this helpful?