Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic integration with the electrum server electrs #1633

Merged
merged 10 commits into from Apr 19, 2019

Conversation

dagurval
Copy link
Collaborator

@dagurval dagurval commented Mar 28, 2019

This is a MVP for integrating electrum server with Bitcoin Unlimited.

To enable the server, you need to run make electrs and add electrum=1 to bitcoin.conf. Adding debug=electrum will enable more useful logging.

@dagurval
Copy link
Collaborator Author

A way to test this with Electron Cash is by running

./electron-cash -v --oneserver --server=127.0.0.1:60001:t --testnet

and creating a wallet with the tpub key tpubD6NzVbkrYhZ4YRDtddy5nLmvdH7Qn6oR7euDpjqnZdniaJDTbaL17Gq86bsVNhKMkYwGvSvhamz5QkouzGJ4e2rkyHWbF5mHGX5Up377zBM

Electron Cash also has added a nice feature to rebuild the wallet history Wallet -> Rebuild history.

Beware of this bug in electron cash Electron-Cash/Electron-Cash#1222

Copy link
Collaborator

@sickpig sickpig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dagurval

What about adding some words about what elecrtrs is?

@dagurval dagurval changed the title [electrum] Basic integration with the electrum server electrs [wip] Basic integration with the electrum server electrs Apr 1, 2019
@dagurval dagurval changed the title [wip] Basic integration with the electrum server electrs Basic integration with the electrum server electrs Apr 1, 2019
@gandrewstone
Copy link
Collaborator

I did an out-of-source-tree build but the electrs binary still goes to src/electrs. To replicate this, from your base git checkout dir:
./autogen.sh
mkdir debug
cd debug
../configure [optional: --enable-debug --enable-shared]
make V=1
make electrs

ss << path;
for (auto &a : args)
{
ss << a << " ";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ss << " " << a;

Or you get an executable named "electrs-vvvv", and an extra space at the end I presume, (in the log only).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@gandrewstone
Copy link
Collaborator

I get:

2019-04-03 19:47:16 Electrum: spawning /fast/bitcoin/buelectrum/src/electrs -vvvv --daemon-rpc-addr=localhost:18332 --daemon-dir=/home/stone/.bitcoin/testnet3 --jsonrpc-import --db-dir=/home/stone/.bitcoin/testnet3/electrs --network=testnet --monitoring-addr=127.0.0.1:4224 --cookie=thezerg:34983429q980dkdkdsakd --txid-limit=500
2019-04-03 19:47:16 Electrum: stderr log thread started.
2019-04-03 19:47:16 Electrum: stdout log thread started.
2019-04-03 19:47:16 Electrum: server exited with exit code: 32
2019-04-03 19:47:16 Error: Unable to start RPC services. See debug log for details.

BUT when I run the spawn line directly on the command line I get:

/fast/bitcoin/buelectrum/src/electrs -vvvv --daemon-rpc-addr=localhost:18332 --daemon-dir=/home/stone/.bitcoin/testnet3 --jsonrpc-import --db-dir=/home/stone/.bitcoin/testnet3/electrs --network=testnet --monitoring-addr=127.0.0.1:4224 --cookie=thezerg:34983429q980dkdkdsakd --txid-limit=500
Config { log: StdErrLog { verbosity: Trace, quiet: false, timestamp: Off, modules: [], writer: "stderr", color_choice: Auto }, network_type: testnet, db_path: "/home/stone/.bitcoin/testnet3/electrs/testnet", daemon_dir: "/home/stone/.bitcoin/testnet3/testnet3", daemon_rpc_addr: V4(127.0.0.1:18332), cookie: Some("thezerg:34983429q980dkdkdsakd"), electrum_rpc_addr: V4(127.0.0.1:60001), monitoring_addr: V4(127.0.0.1:4224), jsonrpc_import: true, index_batch_size: 100, bulk_index_threads: 12, tx_cache_size: 10000, txid_limit: 500, server_banner: "Welcome to electrs (Electrum Rust Server)!" }
DEBUG - Server listening on 127.0.0.1:4224
WARN - failed to connect daemon at 127.0.0.1:18332: Connection refused (os error 111)
DEBUG - Running accept thread
WARN - failed to connect daemon at 127.0.0.1:18332: Connection refused (os error 111)
WARN - failed to connect daemon at 127.0.0.1:18332: Connection refused (os error 111)
.
.
.

so it looks like its working from the command line.

@dagurval
Copy link
Collaborator Author

dagurval commented Apr 4, 2019

so it looks like its working from the command line.

Weird. Not sure how to reproduce that. Does the qa test run? ./qa/rpc-tests/electrum_basics.py

@dagurval
Copy link
Collaborator Author

dagurval commented Apr 4, 2019

rebased on top of #1646 and #1645

Makefile.am Outdated
@@ -218,6 +218,9 @@ endif
check-formatting:
$(MAKE) -C src $@

electrs: ${PWD}/src/electrs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PWD is not necessarily the out-of-source dir, use top_builddir. And if ${PWD}/src/electrs does not exist, there's no rule to make it. Instead use a phony target that points to the real target like this:

.PHONY: electrs

electrs: $(top_builddir)/src/electrs

$(top_builddir)/src/electrs:
	$(top_srcdir)/contrib/electrs/build_electrs.py --dst=$(top_builddir)/src

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 8100042

@dagurval
Copy link
Collaborator Author

Rebased again on top of #1645 and added gitian build support on Linux

@gandrewstone gandrewstone merged commit 5cd24e2 into BitcoinUnlimited:dev Apr 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants