Skip to content

Instantly share code, notes, and snippets.

@josibake
Created February 17, 2025 12:32
Show Gist options
  • Save josibake/b4743867d15765c83da1c62d23557699 to your computer and use it in GitHub Desktop.
Save josibake/b4743867d15765c83da1c62d23557699 to your computer and use it in GitHub Desktop.
Some thoughts on running Bitcoin Core on a phone

To keep the discussion focused, here are a few assumptions I'm working under when evaluating the feasibility of running a node on a phone. While these assumptions may not be 100% accurate, they are meant to be true for a majority of the discussion.

Assumptions

A user is always running pruned

Given we are fast approaching 1TB for all Bitcoin related data, I don't expect users to be running a phone with 1TB of storage. In the event they have access and can afford a phone with these resources, the recommended setup should instead be one of the platforms we already support, e.g., minipc or SBC running linux.

Running a node means running a wallet

For an end user of Bitcoin who wants to run on Android, I assume they are also running a wallet either on the same device or networked as a data provider to another device (phone wallet, lightning wallet, electrum server, etc). While other use cases for running a node without a wallet may exist, I'd argue they are niche enough to ignore for this discussion.

Compiling for Android == Mobile environment

While android can run on a variety of hardware, it seems primarily for smartphones and tablets, which we can bucket as having similar resource restraints (connectivity, battery, CPU, RAM, storage, etc). For bespoke hardware setups that are not a mobile environment, e.g., SBC's, I'd imagine most of these can also run linux.

Phone users only have a phone

One of the arguments for supporting Android as a build target is that many people only have access to an Android smartphone/tablet as a personal computer. For this user, I think we should also assume they do not also have access to desktop computer. Furthermore, I think we should be skeptical as to what sort of internet they have access to, meaning we cannot assume they have a dedicated home WiFi and are instead using a mix of public internet or metered cell connections. As an example, many phone users use "data free" connections around the world, where a provider is reverse billed for the data costs for certain apps, e.g., Facebook, WhatsApp. This raises questions of how feasible it is for a user to pay for the bandwidth to fully validate the blockchain + pay for the electricity and bandwidth of keeping the node always on and synced to tip.

Concerns and Open Questions

IBD vs keeping up

When thinking of what a user needs in order to be fully validating, doing IBD on a mobile phone seems less interesting to me vs keeping up with the chaintip. Because Bitcoin Core uses assumevalid for the majority of historical blocks, I suspect the majority of the time spent is in validating the last few months of blocks, where assumevalid is not used. This means if the user does not keep the phone on at all times, it will likely not be able to keep up new blocks since every block after IBD is fully validated (scripts + signature checks).

This means a phone user will likely need to keep the phone at home, plugged in, and on a dedicated internet connection in order for this to be a useable node.

Assumeutxo

AssumeUTXO is one way in which a user can sync to chaintip from a snapshot , while fully validating genesis to snapshot height. This could help make the wallet more usable for the user right away, but does not address the issue of a mobile device keeping up. IIUC, assumeUTXO also does full validation without assumevalid during its background sync (although this may have changed, or could be changed). I'm not sure a mobile phone would be able to keep up with the chaintip while also fully validating from genesis, under the assumeUTXO model.

Furthermore, if an Android user only has access to a phone, this presents some challenges in my mind as to how the user is sourcing the AssumeUTXO snapshot and getting it on the phone.

Hardware concerns

For lower end phones (e.g., cheaper than a minipc/SBC setup), are the storage drives well suited for Bitcoin Core? Specifically, for phones with low RAM. The UTXO set is close to or at this point greater than 16GB, which means a node frequently needs to flush to disk / randomly read from disk in order to connect a new block to the chaintip. This historically has created problems for raspi's with older spinning disks/SD cards, as the node quickly chews through the storage and corrupts it. Are there any concerns here of bricking a users phone after a year or so of running Bitcoin Core. This is more a question from my side as I am largely unfamiliar with storage mediums of phones smartphones that would be cheaper than a SBC/minipc setup.

User support

In running Bitcoin Core on a phone, I suspect many issues users will encounter will not be with the GUI App but more with the node itself, e.g., node not keeping up, phone storage getting corrupted, IBD stalled, and other specifics that might arise from running on a variety of hardware that we don't currently test for or build for in the project. These requests for support would necessarily be upstreamed to the Bitcoin Core project, increasing the maintaince and administrative burden. Troubleshooting/reproducing/proposing fixes would also need to come from the upstream project, which is why I remain skeptical that the maintaince burden involved is simply getting Bitcoin Core to cross compile for an additional architecture and is instead much, much more. Said differently, almost every other platform we currently support assumes a certain type of user and maintaining a release for a Mobile OS user introduces a whole new set of assumptions.

@GBKS
Copy link

GBKS commented Feb 18, 2025

Thanks for writing these up. I'll share some thoughts (that might not be 100% thought through).

A user is always running pruned

I can get a 2TB micro SD card on Amazon for ~€200. So a user with an existing phone might choose between that and getting a dedicated device. A Mini PC is probably a better option (better hardware, longer lifespan...), with a similar price tag (quick search shows options ~$180). Not disagreeing, just wanted to look at numbers.

In my testing, a 1 TB card was fine.

Phone users only have a phone

.. I think we should be skeptical as to what sort of internet they have access to, meaning we cannot assume they have a dedicated home WiFi and are instead using a mix of public internet or metered cell connections...

I found this interesting data point (via the Pew Research Center) that 15% of all U.S. adults are “smartphone-only” internet users – meaning they own a smartphone but say they do not subscribe to a home broadband service. That does not say anything directly about the speed/quality of their connection, but this being about the U.S., it's probably pretty good in a global comparison.

IBD vs keeping up

Hope I understand the concern here correctly. I tested the keeping up part (April 2023) and it was not a problem. A system task/notification that runs at all times keeps the process running and syncing. I did not test while being extensively out and about, traveling, shaky connections, etc, so I can't speak to that.

Regarding making transaction, there is also the question of how important it is that the node is synced at all times. Let's say price keeps going up and the minimum economic amount to send/receive increases, then users will make fewer transactions. Might only be rent, large purchases, etc. These do not have the same requirement for immediate availability as the all-important coffee-shop purchase. What still feels like a convenient amount of time to wait for syncing for an important transaction? 5 minutes? Not sure, but there is a difference.

Assumeutxo

I am also curious about the sourcing of the snapshot. My understanding is that this has not been 100% fleshed out in general (manual download, peer-to-peer download...). If it has been, I'd love to hear more about it.

Hardware concerns

Once the Version 2 Preview is live with the basic wallet features, I would love to do run some user research on this. Would be amazing to get 100 people or so across the world to use the application and keep a bit of a diary. This might be the only way we can actually get a feel for performance with real-world devices, which might then inform refining the target audience as well as development.

User support

This can absolutely not be underestimated and is very much worth thinking through and creating a plan for.

I do think that bitcoincore.org can play a role in this, and I tried to consider that in my redesign concepts. Right now, the site speaks to developers. If all of a sudden another type of user shows up, it would be helpful for the site to allow the different user types to self-select to different areas (devs might look for technical docs and GitHub/IRC, while users want a feature list, a FAQ and a forum, etc).

No matter what it looks like in the end, doing more means that more people (or AI agents?) will need to chip in one way or another. Ideally, this can be done gradually at a slow-ish pace to find a natural state and reduce bumps along the way.

@josibake
Copy link
Author

josibake commented Feb 18, 2025

I can get a 2TB micro SD card on Amazon for ~€200

I don't have a source handy, but in the past users would run on a Raspi with everything off the microSD and this would cause problems. As I understand, write intensive loads will wreck an SD card. This may have changed, but this is one of the reasons I'm skeptical about long term use.

15% of all U.S. adults are “smartphone-only” internet users ... speed/quality of their connection

Most "unlimited data plans" in the U.S. are very expensive, ~70 - 100 USD per month. Cheaper plans normally use older cell networks, are pay as you go, or throttle speeds to 2G/3G after 5GBs (or similar) of usage. So if we are seeing 9 days on a dedicated, decent WiFi connection, I don't see any world where a user can do IBD over a cell connection without 1) getting throttled by the provider or 2) paying more than they would for home wifi in data costs.

It also seems users in this category will always prefer the "better UX" option: "Use an electrum style wallet/custodial, or wait up to a month for your node to do IBD." While we in the project understand the trade-offs being made, unless we can compete with the UX of the more popular mobile setups, I seriously doubt users in this category will use this option.

I did not test while being extensively out and about, traveling, shaky connections, etc, so I can't speak to that.

My concern is not about someone swapping out a MiniPC with a phone, meaning the phone is almost always plugged in to the wall and always connected to a dedicated connection. My concern is more about how well does the app work on a phone that is also being used as a phone, e.g., on cell connections, unplugged. If the phone were to not download blocks for say, 1 week, how long does it take it to catch back up to tip? The point here is syncing new blocks is much more CPU intensive than downloading historic blocks, which is why I think IBD is perhaps not the best metric and can be misleading.

there is also the question of how important it is that the node is synced at all times

I'm not sure I understand your point here. The node needs to be synced to chaintip before making any transaction. So if the phone has been offline for 1-month, it will need to process 1-month's worth of new blocks before having an up-to-date UTXO set. Based on your benchmark of IBD taking 9 days, my guess is the phone catching up on 1-months worth of new blocks will take close to a full day, if not longer.

@GBKS
Copy link

GBKS commented Feb 19, 2025

Love how we're digging into this.

Some additional points for extra color:

  1. For SD cards, there seem to be high endurance ones that should last longer (no clue how long that would be).
  2. 70-80% of internet usage on smartphones is over wi-fi. For low-end plans, data usage can be up to 95% wi-fi and only 5% cell data (source). People are wi-fi savvy. We discussed quite a lot to only sync when on wi-fi, but that didn't make it in the app yet.
  3. I am curious how syncing a node compares to playing mobile games. Found a number here that estimates 10-100MB per hour for mobile games.
  4. For the mini PC consideration, there's also the question of accessibility. Installing an app and starting it is 1000x easier than setting up a dedicated PC.

There's a large span here and obviously the more you move to the low-end (hardware quality, bandwidth...) and heavier alternative usage, the less likely it is that this is a good solution for an individual. Great to poke that this from different angles and use data to narrow in. We could probably do some spreadsheet-ing to get a rough idea of where these cut-offs might be.

@josibake
Copy link
Author

I think a spreadsheet would be awesome! I think it would also be very helpful to define the user we intend this work for. In my mind, there are two types of users when talking about running Bitcoin Core on an Android:

Only compute is a smartphone, no dedicated home Wifi

This a user I do not think we will ever be able to support, and one that will be much better served by privacy preserving light clients. Based on our discussion so far, it does not seem cost effective or possible for this user to do IBD and stay synced with the chaintip simply from hopping around to different public Wifis + using cell data. Its also unclear what the benefit for this user would be over simply using one of the existing wallet applications today.

Only compute is a smartphone, has dedicated home Wifi

I am still extremely skeptical that anyone would use Bitcoin Core in this way even if we did support it, I am skeptical that supporting this is a good use of the projects resources, as opposed to improving performance on our current low end platforms. For example, making sure Bitcoin Core can be easily installed and ran on a users existing laptop/desktop, improving performance on Raspi/SBC setups, and improving tutorials and documentation on how to set these up. Ideally, we someday have a "home node" that is as easy to set up as installing a new Wifi router: you plug it in, turn it on, and pair your phone GUI/wallet App via a QR code.


A lot of my thinking on this is framed by the fact there is currently a massive number of "Bitcoin Apps" available to a user in the form of Electrum wallets, custodial wallets, etc. If we put Bitcoin Core on a phone as it is today, my concern is users first touchpoint with Bitcoin will be confusing and frustrating, leading them to think the App is broken (leading to an increased support burden on the project where there is no real solution), or simply abandon it in favour of a "better UX" product. Furthermore, I think there are better ways to support mobile users where we get more bang for the buck, namely:

  • Running Bitcoin Core as a BIP157/158 client
  • Improving light client protocols like BIP157/158
  • Utreexo (e.g., libfloresta)
  • Bitcoin GUI/wallet mobile apps that can pair with a home node (e.g., multiprocess work)

@ryanofsky
Copy link

As I understand, write intensive loads will wreck an SD card.

Just skimmed discussion above, but I'm not sure this necessarily implies pruning needs to be required. Blocks could be written once to an SD card location even if databases are written to another location.

Compiling for Android == Mobile environment

I think this is a reasonable assumption to make but would also point out that chromebooks can run android apps, and some googling indicates that there are about as many chromebooks sold as macbooks

@josibake
Copy link
Author

Blocks could be written once to an SD card location even if databases are written to another location

Good point, this is orthogonal to the node being pruned. I'm still generally skeptical of something like a microSD card in that writing blocks could still be a bottleneck, since as I understand it writes are much slower than SSDs/NVME drives. IIRC, IBD connects and then writes the blocks sequentially before proceeding to the next block (although this could be changed?). This is why I'm arguing hardware that supports adding better peripherals should be our recommended setup.

chromebooks can run android apps

It seems they can also run linux binaries1, a platform we currently support, so I don't see this as a compelling argument for supporting a new platform in our release.

Footnotes

  1. https://www.reddit.com/r/Bitcoin/comments/ycv9ce/running_bitcoin_core_full_node_on_a_99_chromebook/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment