spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.35k stars 3.06k forks source link

maybe replace jsonrpclib-pelix with aiorpcx #4825

Closed SomberNight closed 5 years ago

SomberNight commented 5 years ago

Look into using aiorpcx for "local rpc" instead of jsonrpclib-pelix. (communicating with electrum daemon) e.g.

./run_electrum getfeerate

It might not be easy, as with jsonrpclib-pelix we currently support RPC over HTTP; and it's not clear how to do that with aiorpcx. (e.g. https://github.com/spesmilo/electrum-merchant uses HTTP) e.g.

curl --data-binary '{"id":"curltext","method":"daemon","params":{"config_options":{"subcommand":"load_wallet", "wallet_path":"/home/user/.electrum/testnet/wallets/default_wallet", "password":"1234"}}}' http://user:pass@127.0.0.1:7777

curl --data-binary '{"id":"curltext","method":"getseed","params":{"password":"1234"}}' http://user:pass@127.0.0.1:7777

a "middleware" that speaks HTTP might be needed (aiohttp?)

ecdsa commented 5 years ago

here are two other projects that combine jsonrpc and aiohttp:

ecdsa commented 5 years ago

jsonrpcserver allows to use multiple servers in the same process, see: https://github.com/bcb/jsonrpcserver/issues/86 and also: cf7b43d64ff6e48a2d0794ae2145b415f815bb61

I suggest we try to use it for the daemon RPC, in place of jsonrpclib-pelix; that should be easier than aiorpcx

ecdsa commented 5 years ago

see also https://www.programcreek.com/python/example/90089/aiohttp.BasicAuth

ecdsa commented 5 years ago

done in 5df5aaa96d35acb854cb7e7098e5ef23e85c751e