4
protected async void Page_Load(object sender, EventArgs e)
        {
            var senderAddress = "0x605a1f8d368cbdd4d0a5cbad74f75c428660f17b";
            var password = "zxcasdqwe123";
            var abi = @"[{""constant"":false,""inputs"":[{""name"":""passAddress"",""type"":""address""}],""name"":""isWhitelisted"",""outputs"":[{""name"":"""",""type"":""bool""}],""payable"":false,""type"":""function""},{""constant"":false,""inputs"":[{""name"":""userAddress"",""type"":""address""}],""name"":""userAdd"",""outputs"":[],""payable"":false,""type"":""function""},{""inputs"":[],""payable"":false,""type"":""constructor""}]";
            var web3 = new Nethereum.Web3.Web3();
            var newAddress = "0xE96932536293CF4712180973c6201DDbDf6fa3C0";
            /*var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, password, new HexBigInteger(120));
            Assert.True(unlockAccountResult);
            */
            //var transactionHash = await web3.Eth.DeployContract.SendRequestAsync(abi, byteCode, senderAddress, newAddress);
            //var receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);
            //while (receipt == null)
            //{
            //    Thread.Sleep(5000);
            //    receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);
            //}
            //var contractAddress = receipt.ContractAddress;
            var contract = web3.Eth.GetContract(abi, "0x23699275461c4755377c293bb657e84d3ddfdbd9");
            var fucntion = contract.GetFunction("userAdd");
            var result = await fucntion.CallAsync<String>("0xE96932536293CF4712180973c6201DDbDf6fa3C0");
        }

I have deployed my contract on rinkeby and got the address and now i am calling my fucntion of my contract but it is showing me null.

help thanx in advance

  • always mask passwords when you post stuff here! – RononDex Dec 20 '17 at 12:32
  • Did you ever get an answer to this question? If so, kindly share. – Vishant Patil Jan 30 '18 at 6:29
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation. - From Review – flygoing Jan 30 '18 at 13:15
0

From your ABI it looks like there are no output parameters for the function userAdd?

If you are trying to send a transaction to modify state you should use fucntion.SendTransactionAsync(...) not CallAsync

There will be no value returned from a transaction. Check the status in the receipt.

Also, depending on the version of Nethereum you are using you may need to Unlock the sending account first.

HTH

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.