Blockchain HTTP RPC

FREEMIUM
By Crypto APIs | Updated 22日前 | Data
Popularity

9.3 / 10

Latency

74ms

Service Level

100%

Health Check

N/A

README

curl

curl \
  -d '{"jsonrpc":"2.0", "method":"eth_blockNumber", "params":[], "id":1}' \
  -H "Content-Type: application/json" \
  -H "X-RapidAPI-Key:[Your API key]" \
  -H "X-RapidAPI-Host: blockchain-http-rpc1.p.rapidapi.com" \
  -X POST \
  https://blockchain-http-rpc1.p.rapidapi.com/api/polygon/mumbai

web3js integration

import Web3 from "web3";

const provider = new Web3.providers.HttpProvider(
  "https://blockchain-http-rpc1.p.rapidapi.com/api/polygon/mumbai",
  {
    headers: [
      {
        name: "X-RapidAPI-Key",
        value: "[Your API key]",
      },
      {
        name: "X-RapidAPI-Host",
        value: "blockchain-http-rpc1.p.rapidapi.com",
      },
    ],
  }
);

const web3 = new Web3(provider);
web3.eth.getBlockNumber().then(function (result) {
  console.log("[web3.js] Current block number: " + result);
});

ethersjs integration

import Web3 from "web3";
import { ethers } from "ethers";

const web3provider = new Web3.providers.HttpProvider(
  "https://blockchain-http-rpc1.p.rapidapi.com/api/polygon/mumbai",
  {
    headers: [
      {
        name: "X-RapidAPI-Key",
        value: "[Your API key]",
      },
      {
        name: "X-RapidAPI-Host",
        value: "blockchain-http-rpc1.p.rapidapi.com",
      },
    ],
  }
);

const provider = new ethers.providers.Web3Provider(web3provider);
provider.getBlockNumber().then(function (result) {
  console.log("[ethers.js] Current block number: " + result);
});
Followers: 0
API Creator:
Rapid account: Crypto AP Is
Crypto APIs
cryptoapis
Log In to Rate API
Rating: 5 - Votes: 1