> 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/setup-the-eth-rpc-adaptor-for-the-script-testnet.md).

# 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)&#x20;

CPU: 4 cores or more&#x20;

Memory: 32 GB or more&#x20;

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&#x20;

cd script&#x20;

git checkout release&#x20;

export GO111MODULE=on&#x20;

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&#x20;

cd $SCRIPT\_ETH\_RPC\_ADAPTOR\_HOME&#x20;

export GO111MODULE=on&#x20;

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&#x20;

cd $SCRIPT\_ETH\_RPC\_ADAPTOR\_HOME&#x20;

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&#x20;

httpAddress: "0.0.0.0"&#x20;

httpPort: 18888&#x20;

wsAddress: "0.0.0.0"&#x20;

wsPort: 18889&#x20;

timeoutSecs: 600&#x20;

maxConnections: 2048

log:&#x20;

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>
