3

While developing a Smart Contract with Solidity on Remix, after creating the contract I'm trying to call a function by passing Bytes32 datatype parameters:

function addTT(bytes32 _name) public {
...
}

but when I call addTT() by passing parameter "neo" it throws the following error:

transact to Abc.addTT errored: Error encoding arguments: Error: invalid bytes32 value (arg=undefined, type="string", value="asda")

Any idea how can I properly call function addTT()?

2
  • I tried the same way but it is still throwing the error, saying "Unexpected token ' in JSON at position 1. I am getting irritated by this, please help me Oct 3, 2018 at 17:23
  • 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 Oct 3, 2018 at 22:46

2 Answers 2

4

You need to convert the value in hex to be passed. neo is 0x6e656f in hex. If you try to pass '0x6e656f' it will work (don't forget the quote).

0

You can also use string instead of bytes32 in Remix which has higher gas cost and hence less efficient.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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