Title: How i can use electrum in node js ? Post by: hellossy on November 11, 2020, 07:28:23 AM Hi. I install electrum on my server. How i can connect to electrum from node js script ? I try build website with bitcoin payment;
I have not found examples of using electrum in the node js Title: Re: How i can use electrum in node js ? Post by: HCP on November 11, 2020, 09:08:42 AM This apparently is a "multicurrency" wallet that uses a local version of electrum to work the "btc" functionality: https://github.com/jesobreira/multiwallet
You can see it just uses the Electrum JSONRPC API to communicate with Electrum from within node.js: https://github.com/jesobreira/multiwallet/blob/master/lib/currencies/btc.js#L122 You can read more about the Electrum JSONRPC here: https://electrum.readthedocs.io/en/latest/jsonrpc.html Note, I believe that the full list of available commands is the same as you get when you use help() in the Electrum console: Code: >>> help() The documentation for each one isn't great... but reading the python code here should help: https://github.com/spesmilo/electrum/blob/master/electrum/commands.py Title: Re: How i can use electrum in node js ? Post by: NotATether on November 11, 2020, 06:33:37 PM If you just need middleware that talks to Electrum from node.js, then the JSONRPC API that HCP posted is sufficient.
If you also need a web frontend, you also need to follow the instructions at https://electrum.readthedocs.io/en/latest/merchant.html, which enables the Electrum daemon to generate a webpage people can pay at. The most important command you need to run online your terminal is: Code: electrum -o setconfig payserver_address ecdsa.org:80 Replace ecdsa.org:80 with your domain name and port. This is the site that Electrum will create the payment frontend on. Then you’d use node.js to programmatically pay it using the appropriate JSONRPC command. But to finish the frontend initialization, you need to also run the other commands in the documentation I linked. |