Giter Club home page Giter Club logo

10101-poc's People

Contributors

1010tom avatar bonomat avatar bors[bot] avatar da-kami avatar dependabot[bot] avatar holzeis avatar klochowicz avatar luckysori avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

Forkers

22388o restioson

10101-poc's Issues

Create seed backup widget

Image

Acceptance Criterias

  • seed phrase is shown like in the screen shots
  • checkbox click should mark the phrase to be backed up (only stored to the state, not to the database yet)

Hot restart breaks rust logging

Performing hot restart...                                               
Restarted application in 366ms.
flutter: {_TenTenOneState} {initState} {Successfully initialised wallet} {LogLevel.INFO} {09 November 2022 08:11:56 AM}
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: FfiException(PANIC_ERROR, Logger to initialise: Failed to init tracing

Caused by:
    a global default trace dispatcher has already been set, null)
#0      FlutterRustBridgeBase._transformRust2DartMessage (package:flutter_rust_bridge/src/basic.dart:101:9)
#1      FlutterRustBridgeBase.executeStream (package:flutter_rust_bridge/src/basic.dart:84:15)
<asynchronous suspension>
#2      _TenTenOneState.setupRustLogging.<anonymous closure> (package:ten_ten_one/main.dart:153:30)
<asynchronous suspension>

Create dashboard widget

Image

Acceptance Criterias

  • Build dedicated widget for the balance.
  • Create card for cfd trading navigate to another route. (empty screen)
  • Create card for sports betting (disabled)
  • Add fund wallet with bitcoin card - navigate to another route. (empty screen)

Add build jobs on the CI

Add jobs that lint and build the whole app for different platforms.
Otherwise we risk inadvertently breaking the builds.

Create wallet upon first start

Upon first start of the app a wallet needs to be generated utilizing the Bip39 standard. This may be implemented using a combination of the bitcoindevkit and the lightningdevkit

Acceptance Criterias

  • lightning wallet (on & off chain) is initialized and ready to use (exposed through the flutter_rust_bridge)
  • a simple view showing the current balance - demonstrating that the wallet can be accessed from the view.

Share log messages

Dependent on #103 and #83.

We need a way to share log files from the TenTenOne App with us. using FLog we can make use of the FLog.exportLogs()

Fund on-chain wallet

We need to be able to fund the on-chain wallet. A screen something like that could be implemented.

Screenshot 2022-11-02 at 17 59 58

Create BIP-39 compatible BDK wallet

Upon the first start of the application, a new bitcoin wallet should be created from with a seed compatible with BIP39.
This should allow us to export the seed words.

Mobile wallet

Mobile wallet

Goal: Develop a mobile lightning wallet which offers non-custodial financial products based on bitcoin. The first financial product will be CFD trading.

Open Decisions

  • What framework should be used for the mobile project? see discussion at #5
  • Do we want to build the wallet in typescript (what library to use) or build a native module using neon (https://neon-bindings.com/)? Second option may be hard to cross-compile for all architectures.
  • The wallet needs to run a background task which is listening for events from the taker daemon, respectively which is monitoring it's own cfds and triggers an action e.g. if it needs to be rolled over. How should we build that part? headless-js? (https://blog.logrocket.com/run-react-native-background-tasks-headless-js/)

Settle confirmation screen

The settle confirmation screen is missing. It is modelled in the wireframes, but was not implemented.

We have a confirmation screen for opening a positions, we should also have one for closing a position.
This gives the user the chance to review the action to be performed.
Confirmation screens are good practice in financial applications.

Create user journey for the TenTenOne wallet

A lowfi set of user interfaces depicting the user journey through the app including the following flows.

  • Initialize wallet
  • Create payment channel with maker.
  • Navigation to the CFD trading app (itchysats)
  • Open a CFD trade (funding through the lightning wallet)
  • Close a CFD trade

Create ADR concerning Rust/Flutter interoperability

Initial exploration of flutter showed that we have a few unknowns.

Some questions:

  • how to communicate with long-running tasks in Rust from Flutter, such as LDK
  • where to keep state - singletons (e.g. conquer_once/lazy_static) in Rust, or keep them in Flutter and pass as parameters? (the latter is more library convention). By state I mean: things like the wallet, the db, the seed file etc.
  • poll for changes or try to add some pub/sub system

Design settings screen

Currently we have not way of configuring the app. Here are a couple of settings I think would make sense on a settings screen.

  • Log level
  • Network (testnet / mainnet, etc.)
  • Electrum endpoint
  • Maker endpoint
  • View seed phrase
  • Share logs with maintainers
  • Preferred fiat currency
  • Preferred display of bitcoin e.g. all as sats.

Acceptance Criteria

  • A wire frame depicting the settings page.

android: Failed to load dynamic library 'libten_ten_one.so'

Regardless if on the emulated android device or through wireless debugging on the physical android device. The following error gets printed repeatedly in the logs. The app gets started though.

E/flutter (29452): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Failed to load dynamic library 'libten_ten_one.so': dlopen failed: library "libten_ten_one.so" not found
E/flutter (29452): #0      _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:12:43)
E/flutter (29452): #1      new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:23:12)
E/flutter (29452): #2      dylib (package:ten_ten_one/ffi.io.dart:12:26)
E/flutter (29452): #3      dylib (package:ten_ten_one/ffi.io.dart)
E/flutter (29452): #4      api (package:ten_ten_one/ffi.io.dart:13:32)
E/flutter (29452): #5      api (package:ten_ten_one/ffi.io.dart)
E/flutter (29452): #6      _MyAppState._callExampleFfiOne (package:ten_ten_one/main.dart:41:33)
E/flutter (29452): #7      runPeriodically.<anonymous closure> (package:ten_ten_one/off_topic_code.dart:137:74)
E/flutter (29452): #8      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter (29452): #9      _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter (29452): #10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter (29452): 

Create balance widget

A widget which can be seen throughout multiple screens and gets updated if the balance changes.

Wire wallet seed with seed screen

Currently the seed is mocked, it should be wired with the seed phrase used to generate the BIP84 wallet.

Acceptance Criteria

  • Seed Phrase is fetched from the rust lib

At some point we should think about storing the seed file to the mobile device, but this is not focus of this issue.

Combine DLCs and Lightning Channels

Goal

We want to build a wallet which speaks lightning and is able to do DLCs.

Possible approaches

Virtual channels

Probably the most complex solution is to have 2 virtual channels. One speaking lightning, the other one speaking DLCs.
E.g. something like this:

Diagram
flowchart LR
    A1((Alice))
    B1((Bob))
   

    txf[tx_fund]
    
    txc_outer[tx_commit]
    
    txs[tx_settle]
    
    txcis[tx_commit_itchysats]
    txcln[tx_commit_ln]
    or{or}
    and{and}


    A1 -- fund --> txf
    B1 -- fund --> txf
    txf --> or
    or --> txs
    or --> txc_outer
    txc_outer --> and
    and --> txcis
    and --> txcln
    
    subgraph ItchySats
      txcet_is[tx_cetN]
      txr_is[tx_refund]
      txp_is[tx_punish]
      or_is{or}
      
      txcis --> or_is
      or_is --> txp_is
      or_is --> txcet_is
      or_is --> txr_is
    end
    
    
    subgraph LN
      htlc1((htlc1))
      htlc2((htlc2))
      htlcN((htlcN))
      txp_ln[tx_punish]

      txcln --> txp_ln
      txcln --> htlc1
      txcln --> htlc2
      txcln --> htlcN

    end

Advantages:

  • we might be able to use ldk, this needs to be evaluated.
  • we might be able to use maia.
  • we should be able to receive standard LN payments from anyone in LN.

Disadvantage:

  • clearly complex
  • channels can only be opened to nodes running the same code because of the custom transaction structure. i.e. you can't open a channel to other LN nodes (LND or CLightning) with this.

Maia speak LN

We could implement the needed bolts into https://github.com/comit-network/maia/

Advantage:

  • full control over the code base. We can decide to only implement what we really need
  • we should be able to receive standard LN payments from anyone in LN.

Disadvantage:

  • complexity
  • only compatible with our own nodes, i.e. you can't open channels to other LN nodes (LND, Clightning) with this.

LN speak DLC

We could add the DLC feature to a lightning implementation (e.g. use LDK and extend it). The it's ok to be odd would allow us to add features to our client without breaking compatibility with other LN implementations.

Advantage:

  • we can open a channel with other LN nodes
  • we speak native lightning out of the box

Disadvantage:

  • Complexity
  • If we build on LDK we probably will need to fork the library to add what we need which could become a nightmare in pulling in upstream changes.

Payment history

Fetch Bitcoin and Lightning payment history from the wallet backend and plug it in instead of the mocked data.

This concerns the Dashboard where we have a combined history of Bitcoin and Lightning, and the specific Lightning and Bitcoin wallet screens.

Furthermore this payment history could serve as the basis for the CFD trading overview (which is basically a subset of the Lightning history + some additional CFD specific data).

Use `ubuntu-latest` as environment for Android integration test on CI

our current job, based on rust-flutter-bridge workflow is using macos-latest, which has strict quotas, which could lead to the jobs piling up in a queue.
There's no advantage to use it over standard linux container, so use ubuntu-latest instead (which would not cause such queuing )

Split wallet into `Dashboard`, `Lightning` and `Bitcoin`

This is necessary to depict our Bitcoin hot-wallet. In the long run we might be able to get rid of this and focus on a pure Lightning wallet, but for the current onboarding / offboarding process it is very hard to abstract this way.

Note: It might be good to have either way, this makes the distinction between Lightning and BTC clearer, one could even allow trading using the BTC wallet, but that is not modelled / planned for now.

Navigation menu

Our app is more complex than just a screen and sub-screens. The trading / bet screens are on the same hierarchy level as the wallet screen (siblings rather than child-parent).

With the introduction of go_router in #99 we are able to depict such kind of routing relationships, but without a proper navigation menu we can't navigate between the main screens (i.e. at the moment we are unable to navigate back to the wallet once on the CFD trading screen).

Introduce a proper navigation menu as depicted in the wireframes.

10101 Vision Idea

Discussed in #2

Originally posted by bonomat October 12, 2022
Hi there,

I've done a bit of research and wrote this wall of text together to foster our vision around TenTenOne.
Let me know what you think below:

TenTenOne

Background

There are a handful of Lightning Wallets available yet. From my limited research I came across:

  • Wallets to connect to your existing node
  • Full nodes
    • Breez
      • Uses a forked LND version
    • Phoenix
      • Uses a custom lighting implementation

And then there are custodial wallets which I leave out for now. Here is a list of other wallets - not sure how up2date this is though.

Form my personal opinion

  • BlueWallet:
    • is great for on-chain transactions. I'm using it myself for that. For LN it sucks a bit
  • Zeus:
    • if it is working, it's great for controlling LND or CLighting. I've been using this myself for a while. However, I constantly have to restart the app due to connection errors. Could be related to connecting to my nodes via Tor but who knows
  • FullyNoded:
    • works great for managing your Bitcoin node. Haven't used it for LN yet
  • Breez & Phoenix:
    • Both look and feel fabulous to me. Great UX and easy to use. It's hard to compete with their UX
    • As far as I can see, they (Breez and Phoenix) manage the channels for you. Or differently said, you have one channel open with them. This is sub-optimal if you want to be close to your usecase.

Conclusion

To the best of my knowledge there is no full lightning node for the phone yet which provides great UX and flexibility to open channels to whoever you want.
Additionally, there is no lightning wallet which allows you to trade in a non-custodial way.
What we can learn from Breez and Phoenix in particular is: they offer a service to open channels and have a great UX. Both of them seem to be well adopted in the wild.

Problem

As of today, there is no awesome lightning wallet which

  • runs on mobile as well as on rpi/desktop (if wanted)
  • has an on-chain wallet and lightning wallet
  • allows non-custodial trading (or other non-custodial financial products)

Proposal

Build an one-stop app for Bitcoiners. A mobile lightning wallet in the first place which offers non-custodial financial products (e.g. CFD trading).

Feature ideas

  1. Mobile & Desktop & RPi
    While mobile seems to be the first option for most users, it does not provide the flexibility for expert users (ourselves). Ideally, there is a lightning wallet which can run on my phone but can also be started on my RPi or server.
    Particularly the latter one would allow usecases which require 24/7 availability (e.g. our current CFD protocol).
    Idea: when starting the app one can chose whether to connect to an existing ItchySats daemon or start from scratch (relevant for [#Approach] further down below)
  2. Ligthning
    The core functionality of this app should be lightning, i.e. a wallet to send and receive lightning payments. This means, it needs to be possible to open channels and get in-bound liquidity somehow.
  3. Trading
    Our bread and butter is non-custodial trading. CFD and other derivatives seem to be the way to go given we don't have any other assets on Bitcoin. If we want to be relevant in the space we would need to provide same or better UX with better features (non-custodial).
    In the long run we could look into Taro and other assets on Bitcoin (if it ever comes).
  4. DCA
    Dollar cost average would be cool
  5. Salary to Bitcoin?
    Receive your USD/AUD/EUR salary directly in Bitcoin
    And many many more :)

Approach for the Tournament:

  1. Build a mobile interface which connects to an itchysats node (we can potential reuse quite some code from our UI).
  2. Add an on-chain wallet to the mobile app: opening a position should then ideally take funds from the mobile wallet, removing the hot wallet from ItchySats
  3. Add lightnig functionality (to be defined)
  4. Add feature to start ItchySats from the App without needing a daemon.

// edit 13.10.2022: @bonomat fixed formatting

Tidy up Flutter FLogs

it would be great if FLog logs were formatted in a more similar fashion to tracing logs (they're pretty ugly right now), and are the main reason I disabled the same logs on the Flutter side from stdout (it's really hard to read them when they're interleaved).

Fix screen overflows and stick to mobile design.

On iPhone SE (3rd gen) we have several screen overflows.

We should arrange the design to be flexible enough to expand on different screens. This usually just requires a decision on what element can expand on the screen.
We can also agree to stick to a specific screen for the tournament to reduce

Screenshots:

image

image


Furthermore, our "confirmation" buttons are placed in different locations on different screens which is not a good design practice.

I looked into using FABs everywhere, but it appears that they are not meant to be disabled, see: flutter/flutter#76120
Instead of using FABs we can make use of the SafeArea widget, so that the bottom of the screen area (where we usually place our button) is correctly located according to screensize.

Legends of Lightning Tournament

This issue summarizes the goals / features for the legends of lightning tournament.

Release app on desktop and android.


The taker gets a full fledged on and off-chain wallet

  • This will allow the user to receive and send on-chain and off-chain funds
  • The taker runs a full lightning node running on her phone.
  • Use electrum (instead of bitcoind) to monitor onchain transactions.
  • Taker opens an uni-directional lightning channel with maker with funds provided by the maker.

The maker runs a full lightning node server side.
(would be cool if this could also work eventually on the phone ๐Ÿ˜‰ )

  • Simple HTTP apis to fetch offers, propose settlement, etc.

Taker can trade a non-perpetual CFD position.

  • Only happy case

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.