This repository contains 2 ethereum services interact with ethereum RPC service
request method: GET
request uri: /blocks
request header: {
'Content-Type': 'application/json'
}
query paramter: {
limit: 1
}
response header: 200 OK
response body: {
"blocks": [{
"block_num": 1,
"block_hash": "",
"block_time": 12356789,
"parent_hash": ""
}]
}
request method: GET
request uri: /blocks
request header: {
'Content-Type': 'application/json'
}
path parameter: {
id: $id_value
}
response header: 200 OK
response body: {
{
"block_num": 1,
"block_hash": "",
"block_time": 12356789,
"parent_hash": "",
"transactions": [
"0x12345678"
"0x87654321"
]
}
}
request method: GET
request uri: /blocks
request header: {
'Content-Type': 'application/json'
}
path paramter: {
txHash: $txHash_value
}
response header: 200 OK
response body: {
"tx_hash": "0x666",
"from": "0x4321",
"to": "0x1234",
"nonce": 1,
"data": "0xeb12",
"value": "12345678",
"logs": [
{
"index": 0,
"data": "0x12345678"
}
]
}
根據 web3 API 透過 RPC 將區塊內的資料掃進 db
go test -v ./tests/