Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Blockchain by (12.7k points)

I am new to web3.js and solidity. My question is related to the way we search on the block-chain. It is easy to search for a particular contract if we know the contract address. However, how can we find and identify a specific type of contract using the address used to create the contracts in the first place?

For eg. I have a contract ContractA which is created by 'from' address AddressA using web3.js. Now I want to find all the instances of ContractA created by AddressA.

I tried searching using web3.eth.filter API but noting ever returns. Please help.

I also read about using registry pattern to store all the contracts and ask the registry, but couldn't find any useful example.

1 Answer

0 votes
by (29.5k points)

No, there's no easy way to do this exact thing. web3.eth.filter can be used to apply filters on contract address, or they can be used to search across transaction logs (events emitted by a contract) where the sender is in the topic list.

If you want all transactions submitted by a specific address, you have to traverse each block on the chain and examine each transaction within each block to see if from is set to the address you're interested in.

Browse Categories

...