更新时间:2023-12-11 GMT+08:00

使用cURL发送HTTP API请求

Request example:

curl https://your-http-endpoint/v1/<API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getBlockByNumber","params":["0xf8e7d",false],"id":1,"jsonrpc":"2.0"}'

Response example:

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "baseFeePerGas": "0x0",
        "difficulty": "0x2",
        "extraData": "0xd883010300846765746888676f312e32302e31856c696e7578000000394f7f55f8b003b860a1c43902a0f6cc97fc61995d28ddb7074edf5c69fe4c503b5194c152cf3b827de2e8b32f6a5d1e6aab282e84e46ee978157c85676c3fb964e90a42ef49ebfc564ae6b863f41f95228784da1315d5f1ba50749b39dbdc0212db7e7920519b985ef84a830f8e7ba05fbae7c490271975e55112f31add5c69a35a46c2b53f1629f18b477f9a8ef6ee830f8e7ca08384763b6b4cab00a7a9dd0de27e8e319d10fd66ce0d16708b70f4264c8f2c6180e801644243b324bb502cf301ca933d84f26895aa7607dbf425c9a12af0b48dad1ee634fddcd28fa0ca33d6b007ef8da8b26f224c81d5876fce13c46bf8fa78b400",
        "gasLimit": "0x8583b00",
        "gasUsed": "0x0",
        "hash": "0x7f222d3f1a7c664fc8709361e0f0d0e60ae63bfcd9f770e7892f043c8885b167",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "miner": "0x69cb38199d2c2419b384fa6e22f4667069843730",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0xf8e7d",
        "parentHash": "0x8384763b6b4cab00a7a9dd0de27e8e319d10fd66ce0d16708b70f4264c8f2c61",
        "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x316",
        "stateRoot": "0xbb246175024b46f7c985032bba83d3d5aa42ea708e8f8b90834d8445aa3ab651",
        "timestamp": "0x655d6eca",
        "totalDifficulty": "0x1f1b52",
        "transactions": [],
        "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "uncles": []
    }
}