0

I have created an array in contract where I'm pushing a string(concatt = IN23450.001 by concatenating 'IN2345' and '0.001').

Contract

contract BDetails {

struct Details {

    bytes32[] DetailsArray;


}
mapping(string => Details) DetailStructs;

 function appendDetails(string id, bytes32 concatt) payable returns(bool success) {

    DetailStructs[id].DetailsArray.push(concatt); 

}

}

While deploying contract I'm getting an error.

Error: invalid argument 0: json: cannot unmarshal invalid hex string into Go struct field SendTxArgs.data of type hexutil.Bytes

I tried storing string IN23450001 and worked perfectly.

Is it because of the decimal point I'm getting this error?Is there any way to store this string?

  • could you provide some contract code for context? – AnAllergyToAnalogy Mar 27 '18 at 11:49
  • I'm guessing you're missing " around the string - if there's a comma it somehow tries to parse it differently – Lauri Peltonen Mar 27 '18 at 11:56
  • I'm concatenating strings...so " " around the string is not necessary right? If I remove the decimal point it works perfectly – angelmaria Apr 3 '18 at 10:51

Your Answer

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

Browse other questions tagged or ask your own question.