Code Monkey home page Code Monkey logo

bitcoin-s-ts's Introduction

Bitcoin-S logo Build Status Coverage Status Maven Central Gitter chat

Feature-rich toolkit for making Bitcoin and Lightning applications on the JVM.

For a complete guide on how to get started with Bitcoin-S, see our website at Bitcoin-S.org.

Contents

Running bitcoin-s

Docker

In this repo, you can just run

APP_PASSWORD=topsecret docker-compose up

which will spin up a docker environment that starts syncing the backend and will allow you to visit the web frontend of the wallet at localhost:3002

or you can build and run the electron app natively.

git clone https://github.com/bitcoin-s/bitcoin-s-ts.git
cd bitcoin-s-ts && ./build-wallet-electron.sh

Getting setup (developers)

For a complete guide on how to get setup with bitcoin-s, see our Getting setup.

This link is intended for setting up development of bitcoin-s. If you want to just install bitcoin-s rather than develop, see Getting started above.

Adding bitcoin-s to your library

The latest release of bitcoin-s is 1.9.9, here is how you can use the dependencies in your projects:

libraryDependencies += "org.bitcoin-s" % "bitcoin-s-secp256k1jni" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-core" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-crypto" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-chain" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-dlc-oracle" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-oracle-explorer-client" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-app-commons" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-db-commons" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-fee-provider" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-bitcoind-rpc" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-eclair-rpc" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-lnd-rpc" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-key-manager" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-node" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-dlc-node" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-wallet" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-dlc-wallet" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-testkit-core" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-testkit" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-zmq" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-tor" % "1.9.9"

libraryDependencies += "org.bitcoin-s" %% "bitcoin-s-cli" % "1.9.9"

Docker images

We publish docker images to docker hub on every PR merge and tag on github. You can obtain the images for both the app server and oracle server on these docker hub repos

bitcoin-s docker hub repo

oracle-server docker hub repo

Contributing

Bitcoin-S is an open source project where anyone is welcome to contribute. All contributions are encouraged and appreciated, whether that is code, testing, documentation or something else entirely.

See here for more information.

Good first issues

Here is a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with the bitcoin-s contribution process.

License

Bitcoin-s is MIT licensed, as found in the LICENSE file.

bitcoin-s-ts's People

Contributors

christewart avatar cypherpoet avatar greymccarthy avatar rorp avatar user411 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

bitcoin-s-ts's Issues

`local oracleServer oracleName and oracle explorer oracleName do not match`

For some reason the console appears to say the oracle name isn't recoverable when it manages to work? For some reason it says that the oracleName in the oracleServer and the oracle name on the oracle explorer do not match.

Screenshot from 2022-08-12 09-48-06

but appears that my public key and oracleName are the same Chris_Stewart_5 Umbrel

Here is an example announcement on oracle.suredbits.com with public key 3a46bbd9eab0646b12d2fc402373b4886931e9fcb74dcf8a95e9cc2c620ef3e4

https://oracle.suredbits.com/announcement/f4c6d32ce3ad9e4c76e228ec61313e71ce41ca2277733ae15051344ca335d7e7

I just created a test announcement after restoring, so it appears that the backend cryptographic material is correct

Add unit labels to more fields

Related to #73

When browsing through the contract detail pane on c5c473b

I thought we could definitely add one here

Screenshot from 2022-02-02 14-11-24

and possibly add them here. I'm a bit more conflicted about this one as there is a lot going on here already

Screenshot from 2022-02-02 14-11-44

Change “Maturation Time” to “Maturation Date”

Something I found to be a slightly confusing UX was the reference to a “Maturation Time” in the “Create Announcement” form:

maturation-time-1

maturation-time-2

The value here is actually a date, and it corresponds to other fields in the UI that call it just that (i.e.: “Maturation Date”):

maturation-date

It looks like this is the result of referencing an i18n key called maturationTime. Furthermore, maturationTime seems to be used in several places throughout the server endpoint API

With all that being said, though, I still feel like maturationDate is the more intuitive name. It might be somewhat of a wide-sweeping change, but I feel like in the long term, a single, consistent usage of maturationDate would significantly improve both the UX and the maintainability of the codebase.

Layout of landing page doesn't show network information by default

This screenshots are taken on c429658

When I land on my home page, i can't see things like the tor address, the block height, fee rate etc on the home page. On our desktop app, we always display those on the bottom of the page. We might want to move these to the top so a user sees these when they open up the app?

Screenshot from 2021-12-06 10-56-29

Screenshot from 2021-12-06 10-55-47

Screenshot from 2021-12-06 10-59-52

A support for depositing via QR codes

Needed for the DLC demo at bitcoin 2022. QR codes are probably the optimal way to exchange bitcoin addresses in a IRL environment.

As a side note, i guess this does beg the question of how the user is going to share their payout address with us as talked about in bitcoin-s/bitcoin-s#4092

Error while proxying request

When i'm taking images on krystal bull this morning and trying to create an announcement, i'm seeing these errors in my logs. This is on b6f9101

npm run start
[email protected] start
npx ts-node server.ts

2021-09-24T12:49:38.570Z Starting oracle-server-ui-proxy
proxyRoot: /proxy oracleServerEndpoint: http://localhost:9998/ oracleExplorerHost: test.oracle.suredbits.com
[HPM] Proxy created: /  -> undefined
[HPM] Proxy rewrite rule created: "^/oracleexplorer" ~> ""
[HPM] Proxy created: /  -> https://blockstream.info/api
[HPM] Proxy rewrite rule created: "^/blockstream" ~> ""
[HPM] Proxy created: /  -> http://localhost:9998/
[HPM] Proxy rewrite rule created: "^/api/v0" ~> ""
2021-09-24T12:49:38.575Z starting HTTP server
2021-09-24T12:49:38.579Z Web Server started on port: 3001 ⚡
oracleExplorerProxyRoot onError
2021-09-24T12:59:28.801Z onError Error: socket hang up
    at connResetException (internal/errors.js:607:14)
    at TLSSocket.socketCloseListener (_http_client.js:443:25)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at net.js:673:12
    at TCP.done (_tls_wrap.js:563:7) {
  code: 'ECONNRESET'
} 200 undefined
[HPM] Error occurred while proxying request localhost:3001/announcements/bb038c8f4fca7a9bac6880a05c7a03949f6f0e9e53efd074a4ec7923a6059b42 to https://test.oracle.suredbits.com/v1 [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)
oracleExplorerProxyRoot onError
2021-09-24T12:59:28.818Z onError Error: socket hang up
    at connResetException (internal/errors.js:607:14)
    at TLSSocket.socketCloseListener (_http_client.js:443:25)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at net.js:673:12
    at TCP.done (_tls_wrap.js:563:7) {
  code: 'ECONNRESET'
} 200 undefined
[HPM] Error occurred while proxying request localhost:3001/announcements/9bdf90c46d62d92d0f0081414d48d8ef4ae571e215ed646bc9f7d701d988d993 to https://test.oracle.suredbits.com/v1 [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)
oracleExplorerProxyRoot onError
2021-09-24T12:59:28.820Z onError Error: socket hang up
    at connResetException (internal/errors.js:607:14)
    at TLSSocket.socketCloseListener (_http_client.js:443:25)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at net.js:673:12
    at TCP.done (_tls_wrap.js:563:7) {
  code: 'ECONNRESET'
} 200 undefined
[HPM] Error occurred while proxying request localhost:3001/announcements/c59009379119c425b9db31507662c1bfd530a03b4f0455c45aaf0b3aa4b1e54a to https://test.oracle.suredbits.com/v1 [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)
oracleExplorerProxyRoot onError
2021-09-24T12:59:28.820Z onError Error: socket hang up
    at connResetException (internal/errors.js:607:14)
    at TLSSocket.socketCloseListener (_http_client.js:443:25)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at net.js:673:12
    at TCP.done (_tls_wrap.js:563:7) {
  code: 'ECONNRESET'
} 200 undefined
[HPM] Error occurred while proxying request localhost:3001/announcements/57505dcdfe8746d9adf3454df538244a425f302c07642d9dc4a4f635fbf08d30 to https://test.oracle.suredbits.com/v1 [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)
oracleExplorerProxyRoot onError
2021-09-24T12:59:28.821Z onError Error: socket hang up
    at connResetException (internal/errors.js:607:14)
    at TLSSocket.socketCloseListener (_http_client.js:443:25)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at net.js:673:12
    at TCP.done (_tls_wrap.js:563:7) {
  code: 'ECONNRESET'
} 200 undefined
[HPM] Error occurred while proxying request localhost:3001/announcements/315f0027a688d9040d3398f678b1cdaf84372a3486b197de3f13196288e08a12 to https://test.oracle.suredbits.com/v1 [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)
oracleExplorerProxyRoot onError
2021-09-24T12:59:28.822Z onError Error: socket hang up
    at connResetException (internal/errors.js:607:14)
    at TLSSocket.socketCloseListener (_http_client.js:443:25)
    at TLSSocket.emit (events.js:327:22)
    at TLSSocket.EventEmitter.emit (domain.js:467:12)
    at net.js:673:12
    at TCP.done (_tls_wrap.js:563:7) {
  code: 'ECONNRESET'
} 200 undefined
[HPM] Error occurred while proxying request localhost:3001/announcements/f256fd26ac56e6dccf8ab4a71bb397530aadd1ba7b1e3e4b7c08a2f0f76f9e38 to https://test.oracle.suredbits.com/v1 [ECONNRESET] (https://nodejs.org/api/errors.html#errors_common_system_errors)

Add feature in DLC table view to alert a user that oracle signatures are availabe to settle a DLC

This is a DLC i have on my wallet, you can see it is Confirmed and the maturation time was 01/25/2022.

Screenshot from 2022-01-27 09-08-46

The signatures are available here for the oracle:

https://oracle.suredbits.com/announcement/bba91c5105f5f59e73b290a63e8a01f3230939d8f45c9a9b1956c0ed700d526e

A nice feature to add would be a "notification" that you can settle this DLC in the table view. I don't think we should necessarily automatically settle it (yet), but an alert/notification would be a nice feature to add

Consider adding links out to the oracle explorer with example contracts

A user could come to this screen and not understand what an offer is, if we link out to existing contracts on the oracle explorer to get an idea of what they look like and that they can copy them into the text field

Maybe this link: https://oracle.suredbits.com/contract/enum

My proposed text

New to DLCs? Check out our [youtube tutorial](https://www.youtube.com/watch?v=oR0I0aHxNMM) or go grab a contract from the [Suredbits Contract Explorer](https://oracle.suredbits.com/contract/enum)

As mentioned on our call, the youtube video is going to need to be updated for the new UI on umbrel

Screenshot from 2022-01-25 12-41-19

Dialogs don't display when DLC is broadcast

Unfortunately downloading the proxy log doesn't work, see #141

Screenshot from 2022-04-19 09-29-24

What was seen on the backend

2022-04-19T14:29:03UTC INFO [DLCClient] connected to kqkv4oihiayhbbekc27bn7fafbhwaxkus47xbclt5yl4q4ovl6ziynid.onion/<unresolved>:2862 via SOCKS5 proxy /10.21.21.11:9050
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Creating DLC Accept for tempContractId 6740e768fea7e87f4dfa3dee358fe5698acb472dfc3a8bef6ebb734e21d92abf
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Attempting to fund a tx for amt=10000 sats with feeRate=3 sats/vbyte
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Reserving utxos=Vector(TransactionOutPoint(282855b97e5d2878da06f88c439979cf3a33239e7342868dd98398fece01b936:1))
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Generated new address=bc1qgxgr9cqsa8jgnlntltalswg3e68kh23kr82zpv path=m/84'/0'/0'/1/318 isChange=true
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Spending UTXOs: Vector(TransactionOutPoint(282855b97e5d2878da06f88c439979cf3a33239e7342868dd98398fece01b936:1) state=ConfirmedReceived)
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] UTXO 0 details: TransactionOutput(96890 sats,wpkh(a82d25961b4f6896f28ca23fd888d9a7705e9a59))
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Initializing DLC from received offer with tempContractId 6740e768fea7e87f4dfa3dee358fe5698acb472dfc3a8bef6ebb734e21d92abf
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Creating CET Sigs for b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:03UTC INFO [DLCWallet$DLCWalletImpl] Created DLCAccept for tempContractId 6740e768fea7e87f4dfa3dee358fe5698acb472dfc3a8bef6ebb734e21d92abf with contract Id b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:05UTC INFO [DLCDataHandler] Received LnMessage DLCSignTLV
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Verifying CET Signatures for contract b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] CET Signatures are valid for contract b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Verifying 1 funding sigs for contract b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] DLC b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb sigs are verified and stored, ready to broadcast
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] broadcasting ByteVector(32 bytes, 0xb11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb)
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Created funding transaction d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074 for contract b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Broadcasting funding transaction d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074 for contract b11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Successfully inserted UTXO d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074:1 amt=86257 sats into DB
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Processing received utxos in tx d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074 for 1 DLC(s)
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Finished processing 1 received outputs, it took=118ms
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] 1 txos are now confirmed!
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Finished processing 1 spent outputs, it took=57ms
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Finished processing of transaction=d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074. Relevant incomingTXOs=1, outgoingTXOs=1
2022-04-19T14:29:05UTC INFO [DLCWallet$DLCWalletImpl] Done broadcast tx ByteVector(32 bytes, 0xb11e47e569884baffbaf4a87520a3a3c336b30a549eb42b6090a419803e74acb)
2022-04-19T14:29:14UTC INFO [DLCWallet$DLCWalletImpl] Processing received utxos in tx d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074 for 1 DLC(s)
2022-04-19T14:29:14UTC INFO [DLCWallet$DLCWalletImpl] Finished processing 1 received outputs, it took=55ms
2022-04-19T14:29:14UTC INFO [DLCWallet$DLCWalletImpl] 1 txos are now confirmed!
2022-04-19T14:29:14UTC INFO [DLCWallet$DLCWalletImpl] Finished processing 1 spent outputs, it took=45ms
2022-04-19T14:29:14UTC INFO [DLCWallet$DLCWalletImpl] Finished processing of transaction=d65ea08d972fa3d0b65577696785df55b9a07788b5d1c95967b132d6223e6074. Relevant incomingTXOs=1, outgoingTXOs=1

Windows electron build issues

oracle-electron-ts and wallet-electron-ts don't currently run/shutdown properly on Windows platform. npm run start shows the behavior where the embedded oracleServer / appServer with JRE does not shutdown when process.kill() occurs.

In addition to the above, it seems that using Websockets in Suredbits Wallet on the Windows platform does not allow binding the frontend to the appServer correctly. This has not been diagnosed yet.

Two processes continue to run after shutting down the backend:

https://imgur.com/a/O0OZ3m7
https://imgur.com/a/4tocKuH

The Electron shell application that is left behind after exiting is still running the backend, which you can see when relaunching npm run start and 9998 is already bound. Occasionally it will slip out on its own and end up at the system level as the OpenJDK Platform binary process without the Electron wrapper. Killing either the Electron wrapper or escaped OpenJDK Platform binary instances gets things turned off for me.

Notes:

This works in package.json to build a Windows app with correct icon as "Krystal Bull.exe"

 "config": {
    "forge": {
      "packagerConfig": {
        "icon": "assets/krystal_bull.ico",
        "executableName": "Krystal Bull"
      },
      "makers": [
        {
          "name": "@electron-forge/maker-squirrel",
          "config": {
            "name": "oracle-electron-ts" // Setting name here as "Krystal Bull" fails with:

Making for the following targets: squirrel

  • Making for target: squirrel - On platform: win32 - For arch: x64
    × Making for target: squirrel - On platform: win32 - For arch: x64

An unhandled error has occurred inside Forge:
An error occured while making for target: squirrel
Failed with exit code: 1
Output:
Attempting to build package from 'Krystal Bull.nuspec'.
The package ID 'Krystal Bull' contains invalid characters. Examples of valid package IDs include 'MyPackage' and 'MyPackage.Sample'.

Error: Failed with exit code: 1
Output:
Attempting to build package from 'Krystal Bull.nuspec'.
The package ID 'Krystal Bull' contains invalid characters. Examples of valid package IDs include 'MyPackage' and 'MyPackage.Sample'.

at ChildProcess.<anonymous> (C:\cygwin64\home\user\code\bitcoin-s-ts\oracle-electron-ts\node_modules\electron-winstaller\src\spawn-promise.ts:52:16)
at ChildProcess.emit (node:events:527:28)
at ChildProcess.emit (node:domain:475:12)
at maybeClose (node:internal/child_process:1090:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)


      }
    },

Links

https://js.electronforge.io/maker/squirrel/interfaces/makersquirrelconfig
https://nodejs.org/dist/latest-v18.x/docs/api/child_process.html#subprocesskillsignal
https://stackoverflow.com/questions/515309/what-does-cmd-c-mean

Cannot always sign outcomes on krystal bull

I've attached a screencast where i can only sign the first outcome of an event on Krystal Bull. This was run on a0bbe69 which is a bit old, so perhaps this is fixed in master. This is our last official release of Krystal Bull on umbrel i believe

Screencast from 01-27-2022 09 22 29 AM

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.