This is an exception on compilation I am getting with truffle. The code I am running builds a store from a container contract and then makes a call to get a product from it.

Store s = Store(saddress); // saddress is the address of a store created earlier

var (pid,name,price,description,quantity,enabled) = s.getProduct(store.purchases[id].product_id);

In the Store.sol file getProduct is:

function getProduct(uint id) constant returns (uint , string name, uint price, string description, uint quantity, bool enabled){
    return (

Has anyone encountered a similar problem before?


It turns out that in solidity, you can't go passing around strings from contract to contract. When I removed the two string values my code compiled without a hitch.

| improve this answer | |
  • Any suggestions for how to accomplish string passing? Do you have to just declare everything as bytes32? – Raine Revere May 12 '16 at 0:15
  • I would argue against having string data in general. You might be thinking, "strings are incredibly important for reason X". However, every reason I could think of for having a string was for some sort of user interaction. I would keep that type of stuff out of etherium. The system doesn't have good support for it and it is IMO out of the scope of what etherium should be doing, which is keeping track of relations and changes of mathmatical type data. – unflores May 12 '16 at 9:19
  • Got the same problem and "solution". Short strings now are padded though when calling web3.toAscii(<hexValue>): "Name C1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" (only "Name C1" was the string) – TMOTTM Jul 20 '16 at 18:41
  • Besides, so the two strings you left out were so not important? Did you find a workaround? – TMOTTM Jul 20 '16 at 18:46

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.