Using the Web3 API
Getting started
The TEE-attested Web3 relay that protects users' metadata.
1RPC.io provides a single endpoint that protects users' privacy and assets.
1rpc.io and 1rpc.ai have separate account systems. API keys for each platform are unique and cannot be used interchangeably.
- Zero tracking: user metadata is not retained once the request has been successfully relayed (burn after relaying).
- Metadata masking: metadata attached to a user's request is replaced with 1RPC's own.
- Random dispatching: requests are dispatched randomly to providers to break linkage between wallets when requests are sent from different addresses.
- Transaction sanitizers: filter and validate transactions before they are relayed to the blockchain.
Build with 1RPC
Replace the existing RPC URL with 1RPC's endpoint to interact with the blockchain.
curl --request POST \
--url https://1rpc.io/eth \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{ "id": 1, "jsonrpc": "2.0", "method": "eth_blockNumber" }'package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
const url = "https://1rpc.io/eth"
rpcClient, err := ethclient.Dial(url)
if err != nil {
panic(err)
}
blockNumber, err := rpcClient.BlockNumber(context.Background())
if err != nil {
panic(err)
}
fmt.Println(blockNumber)
}const Web3 = require('web3');
const url = 'https://1rpc.io/eth';
const web3 = new Web3(new Web3.providers.HttpProvider(url));
web3.eth.getBlockNumber((error, blockNumber) => {
if (!error) {
console.log(blockNumber);
} else {
console.log(error);
}
});from web3 import Web3, HTTPProvider
url = 'https://1rpc.io/eth'
web3 = Web3(HTTPProvider(url))
print(web3.eth.block_number)wscat -c wss://1rpc.io/dot
> {"jsonrpc": "2.0", "id": 0, "method": "system_chainType"}