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

Darwin builds (server/plugin) #24

Closed
tiero opened this issue May 28, 2020 · 22 comments
Closed

Darwin builds (server/plugin) #24

tiero opened this issue May 28, 2020 · 22 comments
Labels
enhancement New feature or request
Milestone

Comments

@tiero
Copy link

tiero commented May 28, 2020

Would be nice to have officially built bwt electrum plugin for MacOSX, without having to download rust toolchain, especially for normies. Thanks

@bitnano
Copy link

bitnano commented May 28, 2020

+1

@shesek
Copy link
Collaborator

shesek commented May 30, 2020

The options for supporting macOS are: (1) finding a trusted maintainer to help build and publish the macOS releases, (2) getting myself a macOS, or (3) trusting some cloud provider to build it remotely.

I wouldn't feel comfortable trusting a cloud provider for this, so that leaves us with finding a trusted maintainer, or someone donating to sponsor a macOS that I could use for that (which would also enable me to make iOS releases for Spark 😁)

@shesek
Copy link
Collaborator

shesek commented May 30, 2020

You can also setup the bwt electrum server using docker instead of using the plugin.

This is somewhat more complicated, but not terribly so. Basically docker run --net host -v ~/.bitcoin:/bitcoin shesek/bwt:electrum --xpub <xpub> and you should have the electrum server up and running.

@leshik
Copy link

leshik commented May 30, 2020

@shesek I was able to successfully cross-compile for macOS in Docker using https://github.com/joseluisq/rust-linux-darwin-builder
Could this be integrated into the release script? Should work on CI too. It would be nice to have signed binaries for macOS.

@shesek
Copy link
Collaborator

shesek commented May 30, 2020

@leshik Nice, this makes things much easier! I was under the impression that you need a mac for this. Is osxcross considered stable? Does it have any disadvantages compared to a real macOS host? Does it support signing too?

I'm a bit wary about introducing third party docker images into the build process, but its nothing that some auditing and replicating the dockerfile into this repo couldn't solve.

@leshik
Copy link

leshik commented May 31, 2020

@shesek Unfortunately I don't have answers as I stumbled upon osxcross yesterday just out of curiosity while looking for a solution to compile bwt in Docker.

Before I found this darwin builder Docker image, I was able to do all the steps manually from the fresh debian:buster-slim (this manual helped me a lot). The main obstacle to automating all the things that I discovered is that macOS SDK needs to be downloaded from somewhere.

One possibility is to fetch the XCode xip installer from Apple, then unpack it and repack SDK as described in osxcross readme. Unfortunately, Apple doesn't allow downloading XCode without login. Somebody has to download it manually anyway (all ~8Gb, of which 48Mb only is needed).

Another option is to fetch pre-packaged SDK from somewhere, but this leads to the same issue of trusting somebody.

@shesek shesek added the enhancement New feature or request label Jun 7, 2020
@shesek shesek changed the title Electrum plugin: Darwin build Darwin builds (server/plugin) Jun 21, 2020
@shesek shesek added this to the v0.1.5 milestone Jun 22, 2020
@pox
Copy link

pox commented Jul 23, 2020

@shesek I develop mostly on a mac so I'm happy to help with releases. I believe we share a few connections (Tel Aviv) if you want to explore this option offline.

@shesek
Copy link
Collaborator

shesek commented Jul 23, 2020

@pox Sounds good, happy to explore this! Being able to do an IRL exchange of release pubkeys is also a big plus.

Are you coming to the bitcoin embassy from time to time? Perhaps we could meet there?

I'm reachable at nadav@shesek.info or on freenode (same nickname).

@pox
Copy link

pox commented Jul 26, 2020

@shesek sent an email.

@shesek
Copy link
Collaborator

shesek commented Sep 25, 2020

I think I managed to cross-compile for macOS (via oxscross), but don't have a way to actually test this.

Would anyone like to be a guinea pig? 🐹

@pox
Copy link

pox commented Sep 25, 2020 via email

@shesek
Copy link
Collaborator

shesek commented Sep 25, 2020

Thanks @pox!

The macOS releases are available here: https://github.com/shesek/bwt/releases/tag/osx-rc

I recently also made the builds reproducible. If you'd like, you can verify that checksums against the builds made on Travis CI (which pulls the code from GitHub). Scroll to the very end of the build log and you'll see the checksums following -----BEGIN SHA256SUM-----.

@pox
Copy link

pox commented Sep 25, 2020

Doesn't seem to quite work.

When I try executing the bwt binary:

dyld: Symbol not found: _rustsecp256k1_v0_1_1_context_no_precomp

😞

@shesek I see you're using Travis. Have you tried executing the binary as part of the build? Could probably be used as some basic smoke test.

@shesek
Copy link
Collaborator

shesek commented Sep 25, 2020

Ugh. I've been running into similar errors in the complication step, I thought I solved them with some compiler flags but it looks like I just pushed it away to the runtime. :(

I'm using Travis, but it's also cross-compiling from Linux environment (to match the binaries produced by my local environment), so I can't run the binary as part of the build. I can, however, create a separate macOS Travis environment specifically for that purpose -- which is an excellent idea. Thanks for bringing that up!

I'll comment here when I make progress. Cheers.

@shesek
Copy link
Collaborator

shesek commented Sep 26, 2020

Ok, I think I got it working for realz this time. :) Care to give it a try @pox? (the binaries are available on that same osx-rc tag)

@pox
Copy link

pox commented Sep 26, 2020

@shesek binary seems to work. Is there any sort of acceptance test you'd like me to perform? Or are you just happy with knowing it's running (spitting out usage, for example)?

$ ./bwt
 ERROR bwt::hd > Please provide at least one xpub to track (via --xpub or --bare-xpub).
Error: no xpubs provided

@shesek
Copy link
Collaborator

shesek commented Sep 26, 2020

@pox Nice, thanks!

Just seeing that its running without crashing down is probably good enough, but it would be cool if you have an handy bitcoin node and could give this a more throughout test.

Basically, if you have bitcoind running with the default directory and ports, ./bwt --xpub <xpub> should Just Work (tm). Otherwise you'll also also need to set --bitcoind-url and --bitcoind-dir. Also recommended that you use a separate bitcoind wallet (bitcoin-cli createwallet <name> true and --bitcoind-wallet <name>).

After it finishes rescanning, you can try connecting to the electrum server on port 50001 (no ssl, so --server 127.0.0.1:50001:t with the t), or try the http api with something like curl localhost:3060/utxos

@pox
Copy link

pox commented Sep 28, 2020

So far so good, it started a rescan. Will update.

btw, definitely a good idea to have a CLI option to specify rescan block height.

@pox
Copy link

pox commented Sep 28, 2020

@shesek I got Electrum to connect to it, but it didn't find any transactions.
In all likelihood this isn't an issue with the osx build. Probably just a matter of usage. I can elaborate if you want (I've used some known public xpubs that have transactions in the last few months, but they don't show up).

Also, I only tested the standalone binary, not the plugin. Is the plugin also available on osx, and if so would you like me to test it? I would need instructions how.

@shesek
Copy link
Collaborator

shesek commented Sep 28, 2020

btw, definitely a good idea to have a CLI option to specify rescan block height.

This is possible via --xpub <xpub>:<height> or using a date with --xpub <xpub>:<yyyy-mm-dd>.

(I know you already figured that out, just mentioning it for others.)

@shesek
Copy link
Collaborator

shesek commented Oct 2, 2020

Implemented in bc9162a.

@shesek shesek closed this as completed Oct 2, 2020
@shesek
Copy link
Collaborator

shesek commented Oct 5, 2020

Released in v0.1.5! https://github.com/shesek/bwt/releases/tag/v0.1.5

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants