I am currently trying to call a function on my smart contract function adopt(uint petId) public returns (uint) that has already been deployed to the ropsten network...

but here's the catch. I'm trying to call and sign this contract using the json rpc call eth_sendRawTransaction() and I have to do this without any additional libraries besides js like ethereumjs-tx or web3js. Would anyone have any idea how to do this with just the json rpc call? Thanks!

  • Why would you want to do this? You'd have to create the signed and encoded transaction manually which of course is possible but needlessly inconvenient. Libraries exist for a reason.
    – Jannik
    May 24, 2018 at 19:58
  • I'm currently building my program in a server based medium that does not support library installations yet and am aware I would need to do these manually. Do you know how I would do this by any chance? May 24, 2018 at 20:07
  • If installing a package is the issue, I'd probably just copy the browserified version of ethereumjs-tx: github.com/ethereumjs/browser-builds Then, see ethereum.stackexchange.com/questions/10291/…
    – Jannik
    May 24, 2018 at 20:31
  • I'm sorry if i'm being a little unclear, but I'm working in a very limited environment that prevents me from using any minified or browserfied versions. That's one of the main reasons why I'm doing rpc requests. I just want to know, if anyone could help, how to manually interact and sign a transaction using eth_sendRawTransaction(). I've read a lot of stuff online, but I'm still unsure how to do this. May 24, 2018 at 22:44

1 Answer 1


In order to call a function in a contract you need to encode the function name and parameters following Solidity ABI specification.

If you want to do that for any functions and parameters it can be quite complex and using an existing library is easier.

But implementing a subset for a known contract should be doable.

  • would you know how to sign and send a transaction using RPC calls? I've already looked at the json rpc documentation, but it seems very unclear how to properly send a transaction and signing it. May 29, 2018 at 22:27
  • Doing generic calls without a library it is not worth the effort IMHO. I'd first prepare "templates" of the JSON RPC using some placeholders using libraries like in here ethereum.stackexchange.com/a/3955. Now I'd use this "templates" replacing the placeholders with the real data. For transaction you can follow a similar approach, but the problem you will face is you need to sign the transaction and you really need a library for that.
    – Ismael
    May 31, 2018 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.