Search code examples
ethereumsolidity

(QTUM) I deployed a contract, used the jsonrpc callcontract to set a value, but got null


set 'hello world' for description() to contract 
qcli callcontract 816e13de2966cc56ca330d089aab849e5928eed5 90c3f38f 0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c48656c6c6f20576f726c64210000000000000000000000000000000000000000

getDescription()
qcli callcontract 816e13de2966cc56ca330d089aab849e5928eed5 7284e416

Output: 00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000

Why does it not return the same as the set method? Whatever I set, it returns 000.

I've already spent a whole day on this, please somebody help.


Solution

  • first, the callcontract can not change data, should call sendtocontract

    and then this is a wrong call qcli sendtocontract 8a0795de06d66bf20940f5ee35b9092483af82a5 90c3f38f 0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c48656c6c6f20576f726c64210000000000000000000000000000000000000000

    it should be qcli sendtocontract 8a0795de06d66bf20940f5ee35b9092483af82a5 90c3f38f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c48656c6c6f20576f726c64210000000000000000000000000000000000000000 the method and param shouldn't have space