SYBL supports most SDKs and libraries for interacting with EVM networks. You can also make raw RPC calls directly to the SYBL API.
In most cases it is as simple as changing the provider URL to point to SYBL:
https://rpc.sybl.dev/v1/eth/rpc?api_key=<SYBL_API_KEY>
const provider = new ethers.JsonRpcProvider(
"https://rpc.sybl.dev/v1/eth/rpc?api_key=<SYBL_API_KEY>"
);
All requests that do not require signing will be routed directly to the network regardless of the Role assigned to the API Key. SYBL only intercepts and signs calls that would require a signing operation.
For example:
RPC Method | SYBL Intercepts |
---|
personal_sign | True |
eth_sign | True |
eth_signTypedData_v1/3/4 | True |
eth_signTransaction | True |
eth_sendTransaction | True |
chain_id | False |
eth_getBalance | False |
eth_call | False |
All other non signing operations | False |
You can generate a Testnet or a Mainnet SYBL API Key in the dashboard.
Keep your API Keys secure as they have access to the Roles and Wallets you assign.
It is recommended to limit the Role to only what your service would require.
Currently only one Wallet can be assigned per API Key.
import ethers from "ethers";
const apiKey = process.env.SYBL_API_KEY
const main = async () => {
// goerli is chainId 5
const chainId = 5;
const provider = new ethers.JsonRpcProvider(
`https://rpc.sybl.dev/v1/eth/rpc?api_key=${apiKey}&chain_id=${chainId}`
);
const signer = provider.getSigner();
const data = {
to: "sybl.eth",
value: ethers.utils.parseEther("0.000000001").toHexString(),
};
const tx = await signer.sendTransaction(data);
console.log(`https://goerli.etherscan.io/tx/${tx.hash}`);
};
Golang go-ethereum
package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/common/hexutil"
rpc "github.com/ethereum/go-ethereum/rpc"
)
var apiKey = "<SYBL_API_KEY>"
var chainId = 5
var endpoint = "https://rpc.sybl.dev/v1/eth/rpc?api_key=" + apiKey + "&chain_id=" + chainId
func main() {
rpcClient, err := rpc.DialContext(context.Background(), endpoint)
if err != nil {
panic(err)
}
var res1 []string
err = rpcClient.Call(&res1, "eth_accounts")
fmt.Println(err, res1)
var res2 interface{}
err = rpcClient.Call(&res2, "eth_sign", res1[0], hexutil.Encode([]byte("test")))
fmt.Println(err, res2)
}
Raw RPC request
export SYBL_API_KEY="<SYBL_API_KEY>"
export SYBL_URL="https://rpc.sybl.dev/v1/eth/rpc?api_key=$SYBL_API_KEY&chain_id=5"
curl $SYBL_URL -H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'