Developers

Read RPC requests

Learn how to read data from Syncport RPC calls

Send a transaction on Syncport


Step 1: Install dependencies
Make sure ethers is installed and run this once if you haven't already:

#Using npm 
install -g ethers

#Using yarn 


Step 2: Set Environment Variables
Hardcode the Syncport testnet RPC url and your wallet's private key so you can send a transaction.

ROLLUP_RPC_URL="https://rpc.devnet.alchemy.com/e4b92df2-b462-4839-a79d-f982a3e5757b"
PRIVATE_KEY="0xYOUR_TEST_PRIVATE_KEY"

Step 3: Run the Read Script
Use this one-liner to read the current latest block number on your rollup:

node -e "import('ethers').then(({ethers}) => ethers.getDefaultProvider(process.env.ROLLUP_RPC_URL).getBlockNumber().then(b => console.log('✅ Current block number:', b)))"



Step 4: Confirm the read works
If successful, you'll see:

Current block number: 123456

As a double check, feel free to cross verify on the explorer too!

Alternatively, you can read data from a Syncport using an HTTP JSON-RPC call, send a POST request to the Syncport RPC endpoint with a JSON body specifying the method you want to call.
Example: Get the latest block number

curl -X POST https://rpc.devnet.alchemy.com/e4b92df2-b462-4839-a79d-f982a3e5757b \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'