Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/public-networks/how-to/use-besu-api/access-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Access logs using the following Besu API methods:

- [`eth_getFilterChanges`](../../reference/api/index.md#eth_getfilterchanges)
- [`eth_getFilterLogs`](../../reference/api/index.md#eth_getfilterlogs)
- [`eth_getLogs`](../../reference/api/index.md#eth_getlogs).
- [`eth_getLogs`](../../reference/api/index.md#eth_getlogs)

Use [`eth_newFilter`](../../reference/api/index.md#eth_newfilter) to create the filter before using [`eth_getFilterChanges`](../../reference/api/index.md#eth_getfilterchanges) and [`eth_getFilterLogs`](../../reference/api/index.md#eth_getfilterlogs)).

Expand Down Expand Up @@ -68,6 +68,7 @@ If the contract had been executed twice since the last poll, with `valueIndexed`
"removed": false,
"blockNumber": "0x21c",
"blockHash": "0xc7e6c9d5b9f522b2c9d2991546be0a8737e587beb6628c056f3c327a44b45132",
"blockTimestamp": "0x55ba4740",
"transactionHash": "0xfd1a40f9fbf89c97b4545ec9db774c85e51dd8a3545f969418a22f9cb79417c5",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
Expand Down Expand Up @@ -97,6 +98,7 @@ If the contract had been executed twice with `valueIndexed` set to 5 since the f
"removed": false,
"blockNumber": "0x1a7",
"blockHash": "0x4edda22a242ddc7bc51e2b6b11e63cd67be1af7389470cdea9c869768ff75d42",
"blockTimestamp": "0x55ba4662",
"transactionHash": "0x9535bf8830a72ca7d0020df0b547adc4d0ecc4321b7d5b5d6beb1eccee5c0afa",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
Expand All @@ -111,6 +113,7 @@ If the contract had been executed twice with `valueIndexed` set to 5 since the f
"removed": false,
"blockNumber": "0x21c",
"blockHash": "0xc7e6c9d5b9f522b2c9d2991546be0a8737e587beb6628c056f3c327a44b45132",
"blockTimestamp": "0x55ba4740",
"transactionHash": "0xfd1a40f9fbf89c97b4545ec9db774c85e51dd8a3545f969418a22f9cb79417c5",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
Expand Down
73 changes: 38 additions & 35 deletions docs/public-networks/reference/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"admin_changeLogLevel","params":[

### `admin_generateLogBloomCache`

Generates cached log bloom indexes for blocks. APIs such as [`eth_getLogs`](#eth_getlogs) and [`eth_getFilterLogs`](#eth_getfilterlogs) use the cache for improved performance.
Generates cached log bloom indexes for blocks. APIs calls such as [`eth_getLogs`](#eth_getlogs) and [`eth_getFilterLogs`](#eth_getfilterlogs) use the cache for improved performance.

:::tip

Expand Down Expand Up @@ -3984,6 +3984,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":[
"removed": false,
"blockNumber": "0x233",
"blockHash": "0xfc139f5e2edee9e9c888d8df9a2d2226133a9bd87c88ccbd9c930d3d4c9f9ef5",
"blockTimestamp": "0x55ba4769",
"transactionHash": "0x66e7a140c8fa27fe98fde923defea7562c3ca2d6bb89798aabec65782c08f63d",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
Expand All @@ -3997,6 +3998,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":[
"removed": false,
"blockNumber": "0x238",
"blockHash": "0x98b0ec0f9fea0018a644959accbe69cd046a8582e89402e1ab0ada91cad644ed",
"blockTimestamp": "0x55ba4773",
"transactionHash": "0xdb17aa1c2ce609132f599155d384c0bc5334c988a6c368056d7e167e23eee058",
"transactionIndex": "0x0",
"address": "0x42699a7612a82f1d9c36148af9c77354759b210b",
Expand Down Expand Up @@ -4068,6 +4070,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x
"removed": false,
"blockNumber": "0xb3",
"blockHash": "0xe7cd776bfee2fad031d9cc1c463ef947654a031750b56fed3d5732bee9c61998",
"blockTimestamp": "0x55ba4486",
"transactionHash": "0xff36c03c0fba8ac4204e4b975a6632c862a3f08aa01b004f570cc59679ed4689",
"transactionIndex": "0x0",
"address": "0x2e1f232a9439c3d459fceca0beef13acc8259dd8",
Expand All @@ -4081,6 +4084,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x
"removed": false,
"blockNumber": "0xb6",
"blockHash": "0x3f4cf35e7ed2667b0ef458cf9e0acd00269a4bc394bb78ee07733d7d7dc87afc",
"blockTimestamp": "0x55ba448c",
"transactionHash": "0x117a31d0dbcd3e2b9180c40aca476586a648bc400aa2f6039afdd0feab474399",
"transactionIndex": "0x0",
"address": "0x2e1f232a9439c3d459fceca0beef13acc8259dd8",
Expand Down Expand Up @@ -4122,7 +4126,7 @@ Using `eth_getLogs` to get logs from a large range of blocks, especially an enti
<TabItem value="curl HTTP" label="curl HTTP" default>

```bash
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"earliest", "toBlock":"latest", "address": "0x2e1f232a9439c3d459fceca0beef13acc8259dd8", "topics":[]}], "id":1}' http://127.0.0.1:8545/ -H "Content-Type: application/json"
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x16e2a9a","toBlock":"0x16e2a9a","address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", "topics":[]}], "id":1}' http://127.0.0.1:8545/ -H "Content-Type: application/json"
```

</TabItem>
Expand All @@ -4135,9 +4139,9 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlo
"method": "eth_getLogs",
"params": [
{
"fromBlock": "earliest",
"toBlock": "latest",
"address": "0x2e1f232a9439c3d459fceca0beef13acc8259dd8",
"fromBlock": "0x16e2a9a",
"toBlock": "0x16e2a9a",
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"topics": []
}
],
Expand All @@ -4155,29 +4159,31 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlo
"id": 1,
"result": [
{
"logIndex": "0x0",
"removed": false,
"blockNumber": "0xb3",
"blockHash": "0xe7cd776bfee2fad031d9cc1c463ef947654a031750b56fed3d5732bee9c61998",
"transactionHash": "0xff36c03c0fba8ac4204e4b975a6632c862a3f08aa01b004f570cc59679ed4689",
"logIndex": "0x2",
"transactionIndex": "0x0",
"address": "0x2e1f232a9439c3d459fceca0beef13acc8259dd8",
"data": "0x0000000000000000000000000000000000000000000000000000000000000003",
"transactionHash": "0xf9bde920aba1c0eb632138ae21d3f019977de264a4714a54f1ae2e337cce4e3d",
"blockHash": "0xa02851f445eea915ef51c54f1352a773c3821a1860d49c6d3e94a16659291c19",
"blockNumber": "0x16e2a9a",
"blockTimestamp": "0x693c23db",
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"data": "0x00000000000000000000000000000000000000000000000001112ea12c39c032",
"topics": [
"0x04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce3"
"0xddf252ad1be2c89b69c2b068fc378da...9d4b2b7fad"
]
},
{
"logIndex": "0x0",
"removed": false,
"blockNumber": "0xb6",
"blockHash": "0x3f4cf35e7ed2667b0ef458cf9e0acd00269a4bc394bb78ee07733d7d7dc87afc",
"transactionHash": "0x117a31d0dbcd3e2b9180c40aca476586a648bc400aa2f6039afdd0feab474399",
"logIndex": "0x6",
"transactionIndex": "0x0",
"address": "0x2e1f232a9439c3d459fceca0beef13acc8259dd8",
"data": "0x0000000000000000000000000000000000000000000000000000000000000005",
"transactionHash": "0xf9bde920aba1c0eb632138ae21d3f019977de264a4714a54f1ae2e337cce4e3d",
"blockHash": "0xa02851f445eea915ef51c54f1352a773c3821a1860d49c6d3e94a16659291c19",
"blockNumber": "0x16e2a9a",
"blockTimestamp": "0x693c23db",
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"data": "0x00000000000000000000000000000000000000000000000001112ea12c39c032",
"topics": [
"0x04474795f5b996ff80cb47c148d4c5ccdbe09ef27551820caa9c2f8ed149cce3"
"0xddf252ad1be2c89b69c2b068fc378d...629ba9375161"
]
}
]
Expand All @@ -4189,7 +4195,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlo
<TabItem value="curl GraphQL" label="curl GraphQL">

```bash
curl -X POST -H "Content-Type: application/json" --data '{"query": "{logs(filter:{fromBlock: 1486000, toBlock: 1486010, addresses: [\"0x7ef66b77759e12caf3ddb3e4aff524e577c59d8d\"], topics: [[\"0x8a22ee899102a366ac8ad0495127319cb1ff2403cfae855f83a89cda1266674d\"]]}) {index topics data account{address} transaction{hash} }}"}' http://localhost:8547/graphql
curl -X POST -H "Content-Type: application/json" --data '{"query": "{logs(filter:{fromBlock: 24000026, toBlock: 24000026, addresses: [\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"]}) {index topics data account{address} transaction{hash} }}"}' http://localhost:8547/graphql
```

</TabItem>
Expand All @@ -4198,7 +4204,7 @@ curl -X POST -H "Content-Type: application/json" --data '{"query": "{logs(filter

```text
{
logs(filter: {fromBlock: 1486000, toBlock: 1486010, addresses: ["0x7ef66b77759e12caf3ddb3e4aff524e577c59d8d"], topics: [["0x8a22ee899102a366ac8ad0495127319cb1ff2403cfae855f83a89cda1266674d"]]}) {
logs(filter: {fromBlock: 24000026, toBlock: 24000026, addresses: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]}) {
index
topics
data
Expand All @@ -4221,33 +4227,29 @@ curl -X POST -H "Content-Type: application/json" --data '{"query": "{logs(filter
"data": {
"logs": [
{
"index": 0,
"index": 2,
"topics": [
"0x8a22ee899102a366ac8ad0495127319cb1ff2403cfae855f83a89cda1266674d",
"0x0000000000000000000000000000000000000000000000000000000000000004",
"0x0000000000000000000000000000000000000000000000000000000000508918"
"0xddf252ad1be2c89b69c2b068fc378...d4b2b7fad"
],
"data": "0xa5a04999ec29a8bd19ce32b859280ef9dbb464d846be06f64a1b1012ec08ab03",
"data": "0x00000000000000000000000000000000000000000000000001112ea12c39c032",
"account": {
"address": "0x7ef66b77759e12caf3ddb3e4aff524e577c59d8d"
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
},
"transaction": {
"hash": "0x36a2186344c6a32760e7700fdf3685936220876c51ff39d071eb48c17f7e802f"
"hash": "0xf9bde920aba1c0eb632138ae21d3f019977de264a4714a54f1ae2e337cce4e3d"
}
},
{
"index": 0,
"index": 6,
"topics": [
"0x8a22ee899102a366ac8ad0495127319cb1ff2403cfae855f83a89cda1266674d",
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x0000000000000000000000000000000000000000000000000000000000648c72"
"0xddf252ad1be2c89b69c2b068fc378...9ba9375161"
],
"data": "0x0ee96b660ad82c8010c90760a03edfbb40b4af5e3634a8c214e4ac7fa1f61492",
"data": "0x00000000000000000000000000000000000000000000000001112ea12c39c032",
"account": {
"address": "0x7ef66b77759e12caf3ddb3e4aff524e577c59d8d"
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
},
"transaction": {
"hash": "0x9e2cc9e84a9e78839d6f4b591dfd98cc7a454a8ee3cd6ccd0a18e662e22d3818"
"hash": "0xf9bde920aba1c0eb632138ae21d3f019977de264a4714a54f1ae2e337cce4e3d"
}
}
]
Expand Down Expand Up @@ -4954,6 +4956,7 @@ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","para
"result": {
"blockHash": "0xe7212a92cfb9b06addc80dec2a0dfae9ea94fd344efeb157c41e12994fcad60a",
"blockNumber": "0x50",
"blockTimestamp": "0x55ba43bb",
"contractAddress": null,
"cumulativeGasUsed": "0x5208",
"from": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
Expand Down
5 changes: 4 additions & 1 deletion docs/public-networks/reference/api/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ Parameter for [`eth_newFilter`](index.md#eth_newfilter), [`eth_getLogs`](index.m

## Log object

Returned by [`eth_getFilterChanges`](index.md#eth_getfilterchanges) and [`priv_getLogs`](../../../private-networks/reference/api.md#priv_getlogs).
Returned by [`eth_getFilterChanges`](index.md#eth_getfilterchanges), [`eth_getFilterLogs`](index.md#eth_getfilterlogs), [`eth_getLogs`](index.md#eth_getLogs).

[Transaction receipt objects](#transaction-receipt-object) and [call result objects](#call-result-object) can contain an array of log objects.

| Key | Type | Value |
Expand All @@ -115,6 +116,7 @@ Returned by [`eth_getFilterChanges`](index.md#eth_getfilterchanges) and [`priv_g
| `transactionHash` | Data, 32&nbsp;bytes | Hash of the starting transaction for the log. `null` when log is pending. |
| `blockHash` | Data, 32&nbsp;bytes | Hash of the block that includes the log. `null` when log is pending. |
| `blockNumber` | Quantity | Number of block that includes the log. `null` when log is pending. |
| `blockTimestamp` | Quantity | Hex-encoded unix timestamp (in seconds) of the block that includes the log. |
| `address` | Data, 20&nbsp;bytes | Address the log originated from. |
| `data` | Data | Non-indexed arguments of the log. |
| `topics` | Array of Data, 32&nbsp;bytes each | [Event signature hash](../../concepts/events-and-logs.md#event-signature-hash) and 0 to 3 [indexed log arguments](../../concepts/events-and-logs.md#event-parameters). |
Expand Down Expand Up @@ -264,6 +266,7 @@ Returned by [`eth_getTransactionReceipt`](index.md#eth_gettransactionreceipt).
| --- | :-: | --- |
| `blockHash` | Data, 32&nbsp;bytes | Hash of block containing this transaction. |
| `blockNumber` | Quantity | Block number of block containing this transaction. |
| `blockTimestamp` | Quantity | Hex-encoded unix timestamp (in seconds) of the block that includes this transaction. |
| `contractAddress` | Data, 20&nbsp;bytes | Contract address created, if contract creation transaction, otherwise, `null`. A failed contract creation transaction still produces a contract address value. |
| `cumulativeGasUsed` | Quantity | Total amount of gas used by previous transactions in the block and this transaction. |
| `effectiveGasPrice` | Quantity | The [actual value per gas deducted](../../concepts/transactions/types.md#eip1559-transactions) from the sender's account. |
Expand Down
Loading