0

I am making a program to monitor who is sending ether to my wallet. I thought I could get the most recent blocks this way, but the repoFactory was empty. What could be the problem?

i want to crawl recent transactions to monitoring who send ethererum to my address

    var _url = "https://mainnet.infura.io/v3/e82040ba35b14761811b286c933ae874";
    var web3 = new Web3(_url);

    var _block_no_to = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();
    var _block_no_from = ((int)_block_no_to.Value - 1000);

    //create an in-memory context and repository factory 
    var context = new InMemoryBlockchainStorageRepositoryContext();
    var repoFactory = new InMemoryBlockchainStoreRepositoryFactory(context);

    //create our processor
    var processor = web3.Processing.Blocks.CreateBlockStorageProcessor(repoFactory);

    //if we need to stop the processor mid execution - call cancel on the token
    var cancellationToken = new CancellationToken();

    //crawl the required block range
    await processor.ExecuteAsync(
      toBlockNumber: new BigInteger(_block_no_to),
      cancellationToken: cancellationToken,
      startAtBlockNumberIfNotProcessed: new BigInteger(_block_no_from)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.