These are chat archives for Nethereum/Nethereum

25th
Mar 2018
EKostan
@EKostan
Mar 25 2018 13:34
hello I cant find web3.Eth.getBlock(blockNum), how I can get block Information by blockNumber ?
Enigmatic
@EnigmaticUnreal_twitter
Mar 25 2018 14:40

@EKostan

You can try web3.Eth.Blocks.GetBlockWithTransactionsByNumber

E.g.

var block = await web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(new HexBigInteger(2410513))

(my web3 points to Ropsten: https://ropsten.etherscan.io/block/2410513)

EKostan
@EKostan
Mar 25 2018 14:52
thx!
this very easy to use, but hard to find (
Jordan Brown
@jmbrown412
Mar 25 2018 15:16

Hello everyone. I am trying to follow the example at https://nethereum.readthedocs.io/en/latest/contracts/functiondtos/. I am straying a little bit from the example by using truffle to deploy the contract rather writing code. When I get to the part where I call the storeFunction
transactionHash = await storeFunction.SendTransactionAsync(senderAddress, new HexBigInteger(900000), null, "key1", "hello", "solidity is great");
nothing happens and my console app dies. I have these calls wrapped in a try-catch.

I also noticed that I cannot access web3.Miner as a namespace. Perhaps this example is no longer relevant with the current version of Nethereum?
Has anybody ran into this and is there a more current example for the scenario of a C# front end doing CRUD on a smart contract?

EKostan
@EKostan
Mar 25 2018 15:45
My example execute transaction:
               var transactionHash =
                    await documentsFunction.SendTransactionAsync(_apiSettings.OwnerAddress,
                        GasLimit,
                        null);

                var receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);

                while (receipt == null)
                {
                    Thread.Sleep(1000);
                    receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);
                }

                if (receipt.Status.Value == 0)
                {
                    throw new Exception($"Error run transaction failed TxHash={transactionHash}, TxStatus={receipt.Status.Value}, GasUsed={receipt.GasUsed.Value}, CumulativeGasUsed={receipt.CumulativeGasUsed.Value} ; lotteryId={lotteryId}, DrawIndex={drawInfo.DrawIndex}");
                }
I work in rinkeby testnet
Jordan Brown
@jmbrown412
Mar 25 2018 15:46
@EKostan Perhaps I am just not waiting long enough?
@EKostan Do you have the complete example of this project that you can share? On github somewhere?
EKostan
@EKostan
Mar 25 2018 15:49
my example show to you how you can waiting end of transaction mining and stored in network
TarrahArshad
@TarrahArshad
Mar 25 2018 15:49
hi friend , see my ICO https://bitbix.co get 5% referral , thank you for advert me
Jordan Brown
@jmbrown412
Mar 25 2018 16:01
@EKostan I will give it a try. Thanks
@EKostan In the example at https://nethereum.readthedocs.io/en/latest/contracts/functiondtos/
Is
var senderAddress = "0x12890d2cce102216644c59daE5baed380d84830c";
any public account that is available in testrpc?
Jordan Brown
@jmbrown412
Mar 25 2018 16:14
var transactionHash = await storeFunction.SendTransactionAsync(senderAddress, new HexBigInteger(900000), null, "key1", "hello", "solidity is great");
This call just kills the app every time, even wrapped in a try-catch.
Jordan Brown
@jmbrown412
Mar 25 2018 17:06

I've switched gears a bit and deployed the contract from code. After deploying, I try to call the contract but I get this
Nethereum.JsonRpc.Client.RpcResponseException: The field to must have byte length of 20 at Nethereum.JsonRpc.Client.RpcClient.HandleRpcError(RpcResponseMessage response) at Nethereum.JsonRpc.Client.RpcClient.<SendInnerRequestAync>d__121.MoveNext()
`

I am using the generated service file that I generated from VisualStudio Code (https://nethereum.readthedocs.io/en/latest/nethereum-code-generation/)

Ryo
@ryoichirooka_twitter
Mar 25 2018 19:50
@iGunSlingeRv2_twitter Hey I'm receiving the same error. Have you found out a clue yet?
Ryo
@ryoichirooka_twitter
Mar 25 2018 20:05
I've added a parameterless constructor to the class and replaced the dll with the change but the same error happens
Ryo
@ryoichirooka_twitter
Mar 25 2018 20:26
image.png
Including the class to link.xmlsolved the error. But now there's another error: NotSupportedExceptionwhich seems a bit hopeless to us