Instanciating a contract from JSON RPC a constructor requiring inputs

ThomasRouxThomasRoux Member Posts: 1

I'm having some trouble for the instanciation of a contract via JSON RPC.

Say I have the following dummy contract

contract Dummy {

uint public x;

function Dummy(uint _u) { x = _u; }


Let's assume the byte code of this compiled Dummy contract is 'bytecodedummy'.

According to the documentation, I can make the following call via JSON-RPC :

"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [{"from": "0x....", "data":"0xbytecodedummy"}],
"id": 1

I tried that call. To some extent, it works fine, the contract is created, but created as if _u=0 (to be more specific, _u is not provided). When I make a call to get the value of x, it returns 0.

What would be the JSON if I want to instanciate Dummy(10) for instance? Where can I specify the input _u?




Sign In or Register to comment.