These are chat archives for Nethereum/Nethereum

13th
Feb 2019
Mosin Pathan
@mosinms7711
Feb 13 06:35
i created account with Wallet() function and i am trying to unlock same account but it is giving me error like "Account not found”.Can anyone help me for same.?
Juan Blanco
@juanfranblanco
Feb 13 07:23
@mosinms7711 can you paste a snippet of your code? And environment geth local / infura
Raúl
@rsantirso
Feb 13 08:37
Hi folks! I leave here a tiny doubt: I'm creating Accounts from Wallets using mnemonics and some of the accounts have 33 bytes long private keys instead of 32 bytes. The extra byte is a 0x00 at the front of the string/bytearray. Is it right? Can I strip this extra front byte safely when any account's private key is 33 bytes long?
Juan Blanco
@juanfranblanco
Feb 13 10:21
@mosinms7711 ok so your issue is that you are trying to unlock an account which does not exist as you have just created a new account
EgorovOleg
@EgorovOleg
Feb 13 10:29

@KevinSmall,thanks for your sample code, it works. I create my wallet address:

public async Task<ProxyWallet> GenerateWallet()
        {
            var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
            var privateKey = ecKey.GetPrivateKeyAsBytes().ToHex();
            var account = new Nethereum.Web3.Accounts.Account(privateKey);
            var address = account.Address;

            return new ProxyWallet
            {
                SecretKey = privateKey,
                PublicAddress = address
            };
        }

Then I transfer Eth to the generated public address from the exodus wallet. With the help of the code I want to receive the incoming transaction, but it does not work:

public async Task<BcTransaction[]> GetFreeCoin(string publicAddress)
        {
            try { 
                    var web3 = new Web3("https://mainnet.infura.io");
                    var addr = publicAddress;
                    var transferEventHandlerAnyContract = web3.Eth.GetEvent<TransferEventDTO>();
                    var currentBlockNumber = await web3.Eth.Blocks.GetBlockNumber.SendRequestAsync();
                    var fromBlockNumber = Convert.ToUInt64(Web3.Convert.FromWei(currentBlockNumber, UnitConversion.EthUnit.Wei)) - 200000;
                    BlockParameter fromBlock = new BlockParameter(fromBlockNumber);
                    var filterTransferEventsForAllContractsReceiverAddress2 = transferEventHandlerAnyContract.CreateFilterInput<string, string>(null, addr, fromBlock);
                    var balance = await transferEventHandlerAnyContract.GetAllChanges(filterTransferEventsForAllContractsReceiverAddress2);

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            return null;
        }

How to be in this case? The address of the purse to which the transfer was: 0x03d48A477CEa4B8C5D325862B70617fcA8D0Fa0b

Juan Blanco
@juanfranblanco
Feb 13 10:57
@mosinms7711 check https://nethereum.readthedocs.io/en/latest/accounts/ for more info on the differences
@rsantirso the 0x00 is mainly the sign
Kevin Small
@KevinSmall
Feb 13 11:55
@EgorovOleg that address has no ERC-20 transfers https://etherscan.io/address/0x03d48A477CEa4B8C5D325862B70617fcA8D0Fa0b so nothing will get picked up
EgorovOleg
@EgorovOleg
Feb 13 11:57
@KevinSmall, Yes I know that. How to make it withdraw and other transactions?
Kevin Small
@KevinSmall
Feb 13 12:22
@EgorovOleg if you're looking at ether transfers rather than erc20, then I think you need to examine transactions rather than event logs (@Dave-Whiffin please correct me if I am wrong). See Dave's sample called "Filter Transactions" here: https://github.com/Nethereum/Nethereum.BlockchainProcessing/blob/master/Nethereum.BlockchainProcessing.Samples/README.md