Is Ethereum fast sync feasible to get logs

Ethereum Asked by mzaidi on January 3, 2022

I want to get the logs of an contract address by filtering the even with transfer Event. I cant use Infura for its restrictions and limits. So i want to sync my own ethereum node for myself.
Since my own requirement from the node is to query its database for transfer event so will a Fast Sync node will be enough for me or do i have to go for Full SYNC mode ?

2 Answers

Plese note that syncing optimization is up to clients, not to Ethereum, so each client implements its very own optimization method.

When you say fast sync, I think you refer to geth. Fast sync is now the default sync mode for geth, and it is a way to prioritize objects you want to sync so you can start to work with the chain sooner.

In particular, in geth's fast sync you start asking other clients for the state of the network, not all transactions. Once you have all the recent states, your clients start asking for all transactions and it start verifying each states in background for you. At the end of this process, you will have a complete full node.

Tip: if you are really interested in a specific smart contract, you can also look at the txlookuplimit parameter, introduced with geth 1.9.14. This feature can reduce drastically the space required by the node to store the index db.

Ethereum mainnet currently contains over 700M transactions. Each full node maintains a search index, stating that transactions with hash H is stored in block B. This allows you to look up an arbitrary transaction from the past (at a significant storage cost). But how often do you look up transactions from years ago?

Geth v1.9.14 ships a --txlookuplimit flag, which specifies the number of recent blocks you want to maintain the search index for (by default it's 0 = since genesis). At its most extreme, you can set it to 1, to prune all past indexes. At the time of release, this reduces your LevelDB SSD footprint by 32GB! You can modify this flag at will, Geth will unindex/reindex in the background based on the current setting. If you unindex a lot of transactions, you might need to compact your database to reclaim the space immediately via debug.chaindbCompact().

Deleting transaction indexes locally is fine since they are not used in consensus nor in synchronization, so network health is unaffected. Light servers for now do need to maintain the full index since light clients rely on them. Huge props to @rjl493456442 and @holiman for this work (#20302).

Answered by Giuseppe Bertone on January 3, 2022

Fast sync nodes do have all TX receipts, hence all logs.

Answered by coinwalletdev on January 3, 2022

Add your own answers!

Related Questions

web3 ens library – purpose of setText, getText against ENS name

1  Asked on December 27, 2020 by turbanman


eth.sendTransaction successful or not?

2  Asked on December 25, 2020 by askingtoomuch


Ethereum Wallet stuck pending transaction

1  Asked on December 25, 2020 by wga


How to add a field to a struct dynamically?

1  Asked on December 24, 2020 by alireza-zojaji


Can one ERC721 have two type NFT?

0  Asked on December 22, 2020 by shubham-singh


Front running, events, off-chain and on-chain

2  Asked on December 22, 2020 by ceds


How do we get latest value of a key from blockchain?

3  Asked on December 17, 2020 by madan


Trouble while installing truffle-contract module

1  Asked on December 14, 2020 by akshat


I can not call a function dynamically

0  Asked on December 14, 2020 by uzair-kath


How to get new transactions by addresses?

2  Asked on December 13, 2020 by alexxosipov


Mist: how to view private key of an account

1  Asked on December 12, 2020 by webeng


Using MetaMask for payments on a website without jQuery?

0  Asked on December 11, 2020 by kosmosu05


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP