0 votes
1 view
in Blockchain by (12.8k 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.8k 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...