0

I know it's not a problem with the contract because when I deploy using Etherem Wallet, all the variables are stored as expected. I'm assuming it's how I pass in the parameters using Nethereum sdk.

.Net code:

transactionHash = await web3.Eth.DeployContract.SendRequestAsync(byteCode,senderAddress, new HexBigInteger(900000), new object[] { sd.docTitle,sd.datetimestamp, sd.author });

Through debugging I know the sd.docTitle, sd.datetimestamp, and sd.author is not null and is a type string when passing.

Constructor in contract:

/* this runs when the contract is executed */
function DocumentValidity(string _docTitle, string _dateTimeStamp,string _author) public {
    docTitle = _docTitle;
    DateTimeStamp = _dateTimeStamp;
    author=_author;
}

Any Ideas as to why this is happening?

2

Fixed it! Forgot to add a variable for returning. Changed the get methods to return (string s), before it was constant return (string). So,

function DocumentTitle() constant returns (string) {
    return docTitle;
}

now looks like

function DocumentTitle() returns (string s) {
    return docTitle;
}

Simple right ?...

0

you don't need to pass the way you are passing in the parameters at the time of deploying contract.

Once you get the successful receipt . do this steps :-

  1. get the contract Address from the receipt.
  2. call your function.

3.Now you can send your parameters by using transaction async.

check below code:-

  var contract = web3.Eth.GetContract(abi, contractAdd);

  var setData = contract.GetFunction("yourFunctionName");

  var hash = await setData.SendTransactionAsync(senderAddress, new 
  HexBigInteger("100000"), null,_docTitle,_dateTimeStamp,_author);

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.