0

I am working on a smart contract that take a data from each node to be stored in the blockchain

What is the best data structure to pass it as a method parameter?. I have done a string but it doesn't work if I pass a long string which contains some special character.

For example, I have the following code:

function push (String str)
{
.....
}

// invoking the method 
push("temp-temp,1234*cent,skgvxcj12497sdf7485t70gsbvw4987ety");

Thanks

0

There's no issue with passing such a string. Tried the following on Remix and it does work:

contract Test {

    string public data;

    function push (string str)
    {
        data = str;
    }

    function pushTheString(){
        push("temp-temp,1234*cent,skgvxcj12497sdf7485t70gsbvw4987ety");
    } 

}
| improve this answer | |
  • Thank you for your answer, but when I try it, EV exception appears, I will try it again and try to detect where the error is, Cheers – sheemar Nov 5 '17 at 12:06
  • @sheemar Operations with strings may require large amounts of gas, be sure you have send enough gas with the transaction. – Ismael Nov 6 '17 at 17:02

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.