Coder Social home page Coder Social logo

satoshiportal / bullbitcoin-mobile Goto Github PK

View Code? Open in Web Editor NEW
50.0 50.0 14.0 8.09 MB

The Bull Bitcoin Mobile Wallet and Exchange App

License: MIT License

Kotlin 0.01% Dart 98.13% Ruby 0.08% Swift 0.05% Objective-C 0.01% Dockerfile 0.12% Python 0.18% Shell 1.43%

bullbitcoin-mobile's People

Contributors

bullishnode avatar i5hi avatar mocodesmo avatar saiy2k avatar staxolotl avatar yshwanth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bullbitcoin-mobile's Issues

Create default wallet when app is first installed

When user first installs the app, we should create two wallets for him:

  • One for testnet
  • One for mainnet

The wallets will have no passphrase
The wallet label for mainnet will be set as "Bull Wallet"
The wallet label for testnet will be set as "Bull Testnet Wallet"

I don't see any reason why we shouldn't have the same mnemonic seed for both Mainnet and Testnet

Current status
Right now, the user is presented with a "create new wallet" button on the wallet homepage. This button would then be removed, the first load of the homepage would display the mainnet wallet.

Signing Error

Import the following testnet wallet and attempt send:

disorder exile ranch list pitch view base lobster jaguar riot tobacco festival

The fingerprint for public and private wallet matches however we get an Invalid Key error.

Bugs with address generation

Any kind of preview methods should use newAddress.peek() rather than newAddress.new() since new() increments the index in bdk.

If new() is being used, the address must be saved in the wallets Addresses so that when a new wallet is created the previewed address is included.

Currently, when a coldcard is imported for example, the preview before import shows the correct first address but once the wallet is loaded, it starts generating addresses from an incremented index.

Copying XPub in Wallet Settings Bug

If you copy extended public key from wallet settings and quickly close the window, an exception is thrown in debug and user is taken back home.

FlutterError (setState() called after dispose(): _TextSectionState#4be29(lifecycle state: defunct, not mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error can occur when code calls setState() from a timer or an animation callback.

When a BIP21 description is added to invoice, make the private label the same as description

I don't there there is really a need to have a BIP21 description that is different from a private label, when receiving payments.

So when we are creating a BIP21 invoice and if the user has entered a description, we can use that description as the private label. If anything, the user can always edit the label later. This will remove one extra step of adding a private label which may be confusing and also it will ensure that everyone that creates a BIP21 description has a private label.

Background snapshots protection

A task-switcher function on mobile devices shows a screenshot of the app's most recent state. However, this snapshot can reveal private data. The secure_application package is made to prevent on-demand viewing of application material.

Include secure application constructor(SecureGate) is directly inside the MaterialApp by using its builder, above your app navigator.

ColdCard First Address Check

Add a check to ensure that the first address generated by the wallet matches the one in the coldcard file.

This will guarantee that the same wallet exported is the one being imported.

In "send" transaction box, let user select amount in fiat instead of just sats and btc

When in the send screen, let user switch from SATS to BTC to PREFERRED CURRENCY (fiat)

When switching to preferred currency, show available balance in preferred currency.

The input amount should be in preferred currency.

In the background, we convert the input amount in the preferred currency (fiat) to Bitcoin.

We keep the "send confirmation" screen as is.

Selecting a utxo during coin selection changes the send amount (bug)

When using the coin selection option, selecting a UTXO will change the send amount (amount required).

The send amount should not change when doing coin selection unless the "send full balance" option is also activated.

If the "send full balance" option is activated at the same time as coins are selected, the amount sent will be the amount of the coins selected. But if the "send full balance" option is not selected, the amount sent is the amount that is input by the user, we do not choose the amount to send, the user chooses it.

Transactions must correctly store vouts

Ensure that when send transaction item is built, it has vins and vouts set correctly.

Ensure that when receive transaction item is built, it has vouts set correctly.

Bug when creating unsigned PSBTs

When creating an unsigned PSBT from a watch-only wallet, the tx builder seems to be trying to add the recipient address as one of the inputs. The end result is that a Coldcard is not able to sign the unsigned PSBT with the error message "Signing failed late. Path (m/84'/0'/0'/0/3) let to the wrong pubkey for input#0). I used a brand new coldcard wallet for this so the path should probably have been (m/84'/0'/0'/0/0). Not exactly sure what is going on, but definitely a bug here in the way the wallet is crafting the unsigned transaction.

Delete wallet should also delete bdk sqlite data

      final appDocDir = await getApplicationDocumentsDirectory();
      final String dbDir = appDocDir.path + '/${wallet.getWalletStorageString()}';

The following directories have to be deleted otherwise the bdk wallet will continue to exist.

Change address must inherint label of outbound transaction label

When making an outbound transaction, the change address utxo must inherit the label of the outbound transaction.

We know which utxo is the change utxo (supplied automatically by txbuilder) by the fact that it is not the recipient's address that was input by the user.

Currently not working as of 0.1.2

Don't remove the test backup function in wallet settings when backup in tested

In version 0.1.3 the test backup function was removed from wallet settings when the test has been completed.

We can use the following design:

  • if backup is not tested, put "Not tested" label in list element in red (C50909)
  • if backup is tested, put "Tested" label in list element in green (12BD23)

Logic: a user may want to test the backup multiple times, not just one time.

Import Xpub With Origin Fails

Attempt to import the following extended pubkey with origin:

[42073c3f/84'/1'/0']tpubD6NzVbkrYhZ4WjQdye2sENVnUnx41NWiaiNJ7Z6TbdEhDJ8hVf5xMVCPYdYg2JFmChTtr2pSg1jYpuoEzR2jFjnRNFi8NLBMLjLA7Fu6d53

Unable to move past wallet selection page.

BIP329 Label Import/Export

This update will complete change the way we are handling labeling.

Here are some notes from our discussions to help us start with implementation:

New label model:

  enum BIP329Type { tx, address, pubkey, input, output, xpub }

  const factory Bip329Label({
    required BIP329Type type,
    required String ref,
    String? label,
    String? origin,
    bool? spendable,
  })

label can be a comma separated list of labels allowing one ref to have many labels. Refs can also share labels.

Wallets now have two additional fields:

Wallet...
    List<String>? labelTags,
    List<Bip329Label>? bip329Labels,

labelTags contains all the existing labels used in a wallet. When a new label is being added to a particular bip329 ref, we will show the existing labelTags as dropdown to easily add an existing label. This will work similar to github issues labels or tags in most platforms like soundcloud.

We will need a helper function to find all related refs and they will by default inherit the same label.

Create new wallet using existing mnemonic and new bip39 passphrase

Currently, the app allows the user to create a new wallet but will automatically generate a new mnemonic for this wallet.

We should add a new wallet creation flow which takes an existing wallet's mnemonic and creates a new wallet with that mnemonic and a passphrase.

The flow should be as follows:

  1. User selects "create new wallet"
  2. A new screen shows two options:
  • create new wallet seed
  • add passphrase to wallet seed
  1. If "add passphrase to wallet seed" option is selected, a third screen displays all the wallet seeds that the wallet is aware of (created by the Bull Bitcoin app or imported by the user)
  2. User selects the wallet seed
  3. On a 4th screen, we display a input field for a bip39 passphrase
  4. From that bip39 passphrase and the mnemonic selected by the user, we create a new wallet.

Finalising PSBTs from Coldcard

Coldcard PSBT is not finalised and I assume it is because it leaves a .psbt that can be finalised by another role within the psbt flow. This makes sense in case of script psbts.

The .txn file is ready to use for broadcasting.

Will have to confirm this is the case with coldcard.

If this is the case, for users to be able to use a .psbt file we will have to be able to finalise a psbt - a requirement from bdk-flutter.

Enforce incognito mode on keyboard for seed input

use enableIMEPersonalizedLearning: false for keyboard when typing seed so that mnemonic words are not logged by GBoard.

Not sure about the equivalent on ios. Wasnt able to find it with a simple google search.

This is required when doing a wallet recovery.

Default wallet naming conventions

We should avoid using the fingerprint as wallet label as much as possible because it is a confusing UX.

Default wallet name = Bull Wallet
Default testnet wallet name = Bull Wallet Testnet
Coldcard import = Coldcard
Other imported wallets = Imported Wallet

New wallets and recovered wallets can keep the wallet fingerprint as wallet name for now.

KeyManager Feature

Now that we have a dedicated Seed model from which many Wallets can be derived, we can introduce the KeyManager/KeyChain that we had discussed.

It would have:

  • a dedicated page either in settings or on its own on the homepage alongside NewWallet and Settings
  • the Seed page will contain a list of all seeds, newSeeds and recovered backup words
  • each seed display row will show how many wallets are derived from it and a Derive Button.
  • clicking the seed will show a more detailed page (will need to figure what details are important to show) Refer to optional features
  • The Derive Button will first ask to add a passphrase and then show all the available/possible scriptTypes. If a particular passphrase exists for a specific scriptType, it won't be shown in the selection.

Additionally:

  • if a user clicks NewWallet, there will be a new button called Derive w/ Passphrase which will redirect to this KeyManager page.

Other notes on behaviour:

  • deleting a Wallet will not delete a Seed
  • Wallet can be re-derived from the Seed
  • deleting a Seed will make a wallet a watch-only of type WalletType.xpub
  • if the Seed is reimported, we check if its fingerprint matches an existing Wallet and convert that Wallet back to a spendable wallet of type WalletType.words

Optional features:

  • Allow importing a Seed just to sign a psbt: where the Seed details page will have an input box to upload/paste/use-a-saved unsigned psbt and sign it. This function will work offline and can make the wallet operate as a cold storage device where a user only maintains their Wallet as a watch-only and always goes offline to import their Seed and sign a transaction. Can seem like an over-kill but its an advanced feature that I would certainly love and use 💯

Handle BDK Errors

Translate errors from bdk into pleb friendly messages.

bdk.Error

The main elements of the Error enum can be matched like an error code, however the message strings can vary within a single variant as well.

For example: Generic(String) - will be a matched type generic but the string could be a variety of different messages which have to be matched by their exact content. This can get tricky if bdk changes these strings.

So this 100% needs to have a test to ensure that we are always matching the strings correctly, especially when we update bdk-flutter. This will also help us keep all bitcoin specific error states well documented.

Add ability for related address and transactions to inherit labels

Change address must inherit label form outgoing transaction.

New receive transaction must inherit label from our deposit address.

Addresses linked to a transaction must update if a transaction label is updated.

All items to have multiple comma separated labels.

Recover Wallet Bugs

Few bugs and nits regarding recover wallet flow:

  • Wallet is not created properly. Currently there is no wallet data shown and I am not able to trigger a sync by dragging down the screen. I assume there is an error with how the wallets descriptor is being constructed. Fix should display the synced wallet data (balance and txs) from previous step on returning home.

  • If a wrong word is used the Recover button stops working even if the spelling of the word is corrected. To reproduce, type in a correct seed and change the spelling of one, click Recover, correct the spelling and click Recover again.

  • If a user goes back after typing words (while 3 potential wallet types are loading) - app freezes - possible something to do with the sync call made to load the potential wallets.

  • when a user types the words, help them finish it with filtered suggestions from the bip39 word list

  • Users are shows the seed in a different ordering to how they have to end up typing it for Recovery or Testing

Typing the seed correctly on first try alone works. However, after wallet is created and return to the Home Screen, there are a few more bugs:

How we display it for users to write:

1. word1          5. word5
2. word2         6. w6
3. w3               7. w7
4. w4               8. w8

How we display it for users to type:

1. word1          2. word2
3. word3         4. w4
5. w5               6. w6
7. w7               8. w8

Add "bump fee" function in transaction page for RBF transactions

We need to add a "bump fee" flow which starts on a transactions' page if the wallet has made an outbound transaction what was RBF enabled.

The general ux flow is as follows:

  1. User makes a transaction that is RBF enabled
  2. We use build_fee_bump (https://docs.rs/bdk/latest/bdk/wallet/struct.Wallet.html#method.build_fee_bump)

If the transaction can be fee bumped then it returns a TxBuilder pre-populated with the inputs and outputs of the original transaction.

Returns an error if the transaction is already confirmed or doesn’t explicitly signal replace by fee (RBF).

  1. We ask the user to select a feerate. We validate that the feerate of the bumped transaction fee is higher than the existing feerate. We can show the fee estimate module to help the user make a selection as to which feerate is appropriate.

  2. We broadcast the new txid.

Important considerations

  • The new transaction will have a different txid, but the same inputs and outputs.
  • We must make sure not to display two different transactions on the transactions list, and not have two different transactions pages for the original and for the replacement transaction.
  • In terms of UI, the best is probably to have a single transaction page that has an extra field for the "original" transaction. So we display the information of the new transaction but we can keep the txid of the old tranascation in a list item that is labelled "Original Transaction".
  • We should add somewhere in the user interface a message or notification that shows that this transaction has been bumped.

Recieve Page Address Label Save

SAVE font is too large for button.

Save button does not give any feedback.

Label not shown in the Receive Page. This makes a labelled address look unlabelled.

Import Wallet Duplicate Error

When importing a seed that already exists, clicking Import does not display the Seed Exists error.

      final err = await walletSensRepository.newSeed(seed: seed!, secureStore: secureStorage);

      if (err != null) {
        emit(
          state.copyWith(
            errSavingWallet: err.toString(), // this is not displayed in the UI
            savingWallet: false,
          ),
        );
        return;
      }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.