mana-ethereum / ethereumex

Elixir JSON-RPC client for the Ethereum blockchain 0x063D3d782598744AF1252eBEaf3aA97D990Edf72
MIT License
378 stars 73 forks source link

Ethereumex.HttpClient.eth_send_transaction doesnt work for testrpc #1

Closed izelnakri closed 7 years ago

izelnakri commented 7 years ago

Thanks for writing an API that one-to-one matches the Ethereum JSON RPC. The send transaction doesnt seem to work though:

error code:

{:error,
 %{"code" => -32000,
   "message" => "TypeError: callback is not a function\n    at StateManager.queueTransaction (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:83065:5)\n    at GethApiDouble.eth_sendTransaction (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:82631:14)\n    at GethApiDouble.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:82434:10)\n    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:52153:18)\n    at VmSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:59291:12)\n    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:52153:18)\n    at GethDefaults.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:82339:12)\n    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:52153:18)\n    at FilterSubprovider.handleRequest (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:58850:7)\n    at next (/usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:52153:18)"}}
ayrat555 commented 7 years ago

@izelnakri can you give a little more information about your request? what parameters did you pass?

Request with geth client

params = [%{"data" => "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
   "from" => "0xc2b7b953C339c6ec4Bb88fAB5a4d19A033e6c4b1", "gas" => "0x76c0",
   "gasPrice" => "0x9184e72a000",
   "to" => "0xc2b7b953C339c6ec4Bb88fAB5a4d19A033e6c4b1",
   "value" => "0x9184e72a"}]

Ethereumex.HttpClient.eth_send_transaction(params)
{:error, %{"code" => -32000, "message" => "unknown account"}}
izelnakri commented 7 years ago

ohh so it is a map inside a list, not a list, keyword-list or a single map my bad sorry. Would be helpful if we had some typespecs and more tests though.

ayrat555 commented 7 years ago

@izelnakri yes, typespecs would be very helpful. I will add them soon. By the way, pull requests are welcome.