These are chat archives for Nethereum/Nethereum

24th
Dec 2017
Juan Blanco
@juanfranblanco
Dec 24 2017 07:44
@Alex-Gorbach are you writing to the chain?
if you are, you need to use SendTransactionAsync in the function
then you will get the transactionhash
if you are not, and are expecting to query, get value
your contract might have not deployed correctly
dimonkov
@dimonkov
Dec 24 2017 09:56

Hi,
how do I get Contract class in unity?
In other applications I would just do

web3.Eth.GetContract(abi, address);

But how to do that in unity (API's are quite a bit different)?

rboelen
@rboelen
Dec 24 2017 10:19

Hi,
I am currently trying out Ganache in combination with Nethereum. I am able to deploy a contract, but when I try to get a receipt it fails with a conversion exception?

System.Exception: Unable to convert the result to type Nethereum.RPC.Eth.DTOs.TransactionReceipt ---> System.InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.String'

Anybody seen this before?
I like Ganache, but maybe there's a better way to test contracts locally?
Thanks

rboelen
@rboelen
Dec 24 2017 11:11
Same thing when performing transactions on the deployed contract, invalidacastexception.
I checked the recepit rpc result from Ganache and it says:
{ "jsonrpc": "2.0", "result": { "transactionHash": "0xd0ca25e1a72da9bdc464d66c4e32c2a860719e41c44d8902d14fa9a7dbf0d176", "transactionIndex": "0x00", "blockHash": "0x5703d92d0cbcd6cab1434e36c84d5a9091d472f9d8405ec98403364b2710c8a1", "blockNumber": "0x01", "gasUsed": "0x015426", "cumulativeGasUsed": "0x015426", "contractAddress": "0x8cdaf0cd259887258bc13a92c0a6da92698644c0", "logs": [], "status": 1 } }
should be fine I think
Although the hex values starting with 0x0 are a bit strange to me, like gasUsed = 0x015426....
rboelen
@rboelen
Dec 24 2017 11:18
ah I see, status field is incorrect , :trufflesuite/ganache-cli#451
nevermind then..
Devedse
@devedse
Dec 24 2017 12:13
@juanfranblanco , small question about your VSCode solidity compiler, is it possible to generate a complete .sol file which includes all imports? (So that I can upload that to etherscan)?
Juan Blanco
@juanfranblanco
Dec 24 2017 16:25
@dimonkov it will be the same to get the contract class
you will just use the functions etc to generate the call data
@rboelen yes that is the issue :)
@devedse ok so your idea is to combine all the code dependencies into one
nice idea
Victor
@lostmsu
Dec 24 2017 16:41
Hi guys
I am trying to understand how to create a wallet using Nethereum and serialize it so Mist could use it. It seems, that I could just create an instance of Nethereum.HdWallet.Wallet, but it is not clear from documentation how long the seed should be.
Juan Blanco
@juanfranblanco
Dec 24 2017 16:48
@lostmsu if you want to import an account you can create it them using the KeyStore
Victor
@lostmsu
Dec 24 2017 17:03
Thx, seems to be what I need
Devedse
@devedse
Dec 24 2017 17:38
@juanfranblanco , well I suppose yes, the reason mainly being so that I can upload the source code of a contract to etherscan :)
Alex-Gorbach
@Alex-Gorbach
Dec 24 2017 17:54

Hello! I have a testrpc running. I'm trying to deploy a contract and call the "setInstructor" function from it, which writes the string.

var account = new Nethereum.Web3.Accounts.Account(privateKey);
            ulong totalSupply = 1000000;
            var web3 = new Web3(account);
            var receipt = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(abi, contractByteCode, senderAddress, new Nethereum.Hex.HexTypes.HexBigInteger(900000), null, totalSupply);
            var contract = web3.Eth.GetContract(abi, receipt.ContractAddress);

            var multiplyFunction = contract.GetFunction("setInstructor");
            var transactionHash = await multiplyFunction.SendTransactionAsync(senderAddress, "Al");
            return transactionHash;

But I always get an null value of "receipt".

            var receipt = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(abi, contractByteCode, senderAddress, new Nethereum.Hex.HexTypes.HexBigInteger(900000), null, totalSupply);
Devedse
@devedse
Dec 24 2017 18:52
It takes a while for the transaction to be mined
how long did you wait?
And do you see the transaction on etherscan?