5

I have a contract that has a function:

function addRequest(uint256 d) {
    ...
}

After compile and deployment, I typed the command below to call it:

curl 192.168.241.128:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{
                "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
                "to": "0x8bed67280f46cc1ffd401cdb3dd5909f254c8f34", 
                "data": "0x4ca1fad8000000000000000000000000000000000000000000000000000000000000022b"
            }, "latest"],"id":1}'

the first 4 byte of data is the first 4 byte result of web3.sha3('addRequest(uint256)'), and then the a uint32 value 555 padded to 32 bytes. I don't think it is wrong.But it shows me the result below:

{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"too many arguments, want at most 1"}}

I need a hand, so can anyone help me to solve the puzzle? thank you very much with all my heart.

4

The problem is that eth_sendTransaction only takes one argument, but you are providing two. You should not pass on the value "latest" since this is meaningless for this function. This should work:

curl 192.168.241.128:8545 -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{ "from": "0x407d73d8a49eeb85d32cf465507dd71d507100c1", "to": "0x8bed67280f46cc1ffd401cdb3dd5909f254c8f34", "data": "0x4ca1fad8000000000000000000000000000000000000000000000000000000000000022b" }],"id":1}'
| improve this answer | |

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.