BenWestgate / Bails

Bails is a Bitcoin solution protecting against surveillance, censorship, and confiscation. It installs Bitcoin Core to Tails encrypted Persistent Storage, creates and recovers Bitcoin Core wallets from Codex32 (BIP93) seed backups, and creates backup Bails USB sticks and shareable blank Bails USB sticks. Learn more in README.md.
MIT License
45 stars 8 forks source link

Rewrite bails-wallet in python #4

Open BenWestgate opened 1 year ago

BenWestgate commented 1 year ago

bails-wallet is longer than expected. The user interface is excellent and bug-free, however the code is not as easy to understand as it could be. The functions especially are not logically grouped or ordered making it more difficult to follow along. As it is the most security critical file in the project it should have great readability.

It may be helpful to:

  1. split it into multiple files based on logical components or functionality.
  2. group and sort the functions logically
  3. move unused functions for non-mvp features to a new file
BenWestgate commented 1 year ago

I started a refactor and organized the functions by their earliest usage in the script.

Functions used only once were removed. Unused variables removed.

There's still a 100 line function that may be better as a library called by bails-wallet as it exclusively processes text, calls no function and returns 0 or 1.

A consistent style to function declarations would benefit.

Postpone the full refactor until L1 is feature complete as that will determine whether more functions used only once can be merged or not.

BenWestgate commented 1 year ago

As mentioned in #5 bails-wallet should be able to run stand-alone by any linux system with bitcoin core.

With start-up parameters or environment variables telling it where to look for blockchain data and other resources.

Fork it to a new repository if necessary.

into it's own repo so that any Bitcoin Core user on Linux can create and restore codex32 backups.

BenWestgate commented 1 year ago

This unfortunately depends on two pull requests I'm involved with from Blockstream Research.

A considerable (up to all of it) could be converted to python. But I will choose the max readability and maintainability gains per time investment.

BenWestgate commented 1 year ago

It has been decreed that bails-wallet will become a stand-alone cross platform python package. So the refactor is occurring as it becomes a python package.

It may even be possible to maintain 3 repositories bitcoin-core-on-tails just installs bitcoin core and shortcuts for it, nothing else.

bails runs bitcoin-core-on-tails and installs and runs bails-wallet plus installs bails menu

bails-wallet runs the wallet code on any platform with python and bitcoin core.

BenWestgate commented 6 months ago

The rewrite will be complete and the bash bails-wallet removed when the L1 features have been tested and working in https://github.com/BenWestgate/Bails-Wallet

github-actions[bot] commented 4 months ago

Stale issue message

BenWestgate commented 4 months ago

It may even be possible to maintain 3 repositories bitcoin-core-on-tails just installs bitcoin core and shortcuts for it, nothing else.

bails runs bitcoin-core-on-tails and installs and runs bails-wallet plus installs bails menu

bails-wallet runs the wallet code on any platform with python and bitcoin core.

@epiccurious do you support moving install-core and some of its supporting files to my "bitcoin-core-on-tails" repo? Then b could clone bitcoin-core-on-tails as a dependency.

It would have a readme with install instructions like Bails but the final result would just be Bitcoin core installed on Tails. Without any extra features beyond what you'd get installing Bitcoin core on Ubuntu from the snap store.

I think that could help close #64 "Spooky Integration"

BenWestgate commented 4 months ago

The same sort of minimum setup could be a launch parameter or a different installation script but I'm unsure the technical level of the issue opener would be satisfied by that and it would require filtering the files to copy or splitting them into 2 directories in this repo i.e. bails and bitcoin-core-on-tails

github-actions[bot] commented 2 months ago

Stale issue message

BenWestgate commented 1 week ago

Actively being worked on.