Skip to main content

Filtering Transaction Logs

Basement's transactionLogs query is a more advanced equivalent of the eth_getLogs query provided by RPC nodes such as Geth. With Basement you can paginate over a certain log, without specifying a range of block numbers. This API also allows you to scope to a specific transaction address, so you're only querying the logs you need for your users.

Listing approvals

Approvals (Implemented in ERC20 and ERC721-like contracts) are a common interaction for user wallets, they allow another contract to spend a token or NFT on behalf of the user. Users grant this approval to for example DEXs and Marketplaces such as Uniswap and OpenSea.

Aside from the standard topics filters you also find in Geth, Basement allows you to specify a transaction filter, similar to the transactions root query.

query GetApprovalsForAddress {
filter: {
topics: [["ApprovalForAll(address,address,bool)"], [], []]
transaction: { fromAddresses: ["dom.eth"] }
) {
transactionLogs {
address {
reverseProfile {

The example shown lists any ApprovalForAll initiated by dom.eth. The entire history of approvals within this wallet is paginated and can be fetched in a few requests, whereas QuicNode would allow you to index in 10.000 block increments, resulting in a bill of 1.600 eth_getLogs RPC calls. If indexed linearly, Basement offers a performance improvement of 500ms to 30 minutes.