Commit Graph

3663 Commits

Author SHA1 Message Date
benthecarman
5df5bf6741
Add support for taproot keyspend PSBTs (#4462) 2022-07-08 09:08:19 -05:00
Chris Stewart
211339f344
Add static test vectors for Taproot (#3769)
* Add static test vectors for Taproot and the ability to parse those test cases

Add TaprootWitness data structure, get parsing working for first static test case

WIP: Distinguish between TaprootKeyPath and TaprootScriptPath

Remove invariants and make val to method in TaprootScriptPath so we can parse test cases

Add TaprootTestCase.{txSigComponents, programs} methods

Try to run test case

WIP

Wrap failure case in Try

Get first test case passing

Fix building of sig component for p2sh

WIP test case legacy/pk-wrongkey

Get more test cases passing

Move where MAX_PUSH_SIZE is checked for segwit

Get another test case passing

Add links to bitcoin core in test case

Fix stack parsing for witness

Get success test cases passing (without signature verification?)

Add failure test cases

Fix basic compile failures except in javascript projects

Get basic TaprootKeyPath parsing working from ScriptWitness

Get invariants implemented correctly for TaprootScriptPath

WIP

WIP

Get first taproot signature serialization test working

Get tagged hash working correctly

Rework test framework, get 2nd success test case passing

Get compile working with rebase

Implement computeTapleafHash with a unit test case

Add scaffolding of computing merkle root test case

Implement computeTaprootMerkleRoot() with a unit test

Implement computeTapTweakHash() with a unit test

WIP: checkTapTweak()

WIP

Implement computeTapTweakHash() unit test

Rebase onto master

Get verifyTaprootCommitment() passing unit test

Refactors to be more readable

* WIP: Tapscript signature checking

* Get taproot script path signature serialization working for unit test

* Add carve out for unknown public key types

* WIP: OP_CHECKSIGADD

* Add test case to detect annex and compute its hash

* Get test case passing when using upgradable public keys with an annex on the stack

* Fix missing pattern match

* Fix bug with tapscript SIGHASH_ALL and add test case

* Add check if taproot flag is enabled

* Get signature verification working with annex hash

* Implement correct handling of fail case for OP_CHECKSIGADD

* Get test case passing

* DRY

* Fix bug, now we only allow tapscript sig checking when pubkey is 32 bytes in size

* Refactor evalChecksigTapscript to use XOnlyPubKey

* Get signature serialization working with OP_CODESEPARATOR

* Get SIGHASH_ANYONECANPAY|SINGLE example working

* Fix bug in BIP342 impl where we don't count op codes if the version is taproot

* Fix OP_CODESEPARATOR bug

* Implement calculating of OP_CODESEPARATOR idx relative to other opcodes, not push operations

* Fix OP_CHECKSIG tapscript bug where we didn't push OP_FALSE onto stack in case of signature validation failure

* Add annex to TaprootKeyPath

* Get signature chcking working with tapscript keypath annex

* Cleanup test framework code a bit to avoid casting exceptions

* Implement handling of OP_SUCCESS

* WIP: Segwit v0 serialization with nonstandard sighash flag

* Fix hash bug in segwit v0 serialization

* WIP

* Fix bug where we weren't defaulting to SIGHASH_DEFAULT when using tapscript

* Add disabled opcodes to OP_SUCCESS case

* Fix parsing for witnesses in test case

* Get a SIGHASH_SINGLE test case working

* Clean up rebase

* Fix default hash type in TaprootKeyPath

* Implement opCodeSeparator counting that does NOT work when OP_CODESEPARATOR is is not executed inside of an OP_IF, otherwise is very simple for the base case

* Cherry-pick ben's commits & rebase

* Remove script size limit for tap scripts

* Fix incorrect handling of unassigned spk

* Fix invariant

* get correct test case failing

* WIP: SIGHASH_ALL_ANYONECANPAY test case

* Cleanup logging/println

* Refactors & fix regressions in some simple unit tests

* Remove logback in core to get the entire project compiling again

* Make TapscriptPath.hasAnnex() more robust against exceptions

* Add validation of XOnlyPubKey to control block

* Implement known leaf versions in the control block

* Add TaprootUnknownPath and UnknownControlBlock

* Fix rebase

* Fix interpreter bug where v0 segwit wasn't failing when a wrong program was used

* Cleanup println

* Clean up println pt2

* Re-enable -Xfatal-warnings

* Turn off logback-test.xml

* Parallelize taproot success test cases

* Try to bump timeout

* Optimization: Reduce number of intersections in ScriptInterpreter.run()

* Ben's code review

* Take ben's clean stack bugfix

Co-authored-by: benthecarman <benthecarman@live.com>
2022-07-07 14:53:28 -05:00
benthecarman
000e7a7930
Have FutureUtil.makeAsync handle thrown exceptions (#4458) 2022-07-07 14:26:38 -05:00
Chris Stewart
83cff9a44c
2022 07 07 issue 4455 (#4457)
* Get simple serialization symmetry working for taproot keypath

* Implement generators for TaprootScriptPath, check serialization symmetry

* Make sure bytes are symmetrical too

* Add check in TaprootScriptPath.hasAnnex() to make sure therer is more than one stack element

* Cleanup

* Address ben's review

* Fix pattern match
2022-07-07 12:04:16 -05:00
Chris Stewart
2b60bbb1c3
Remove .map() and use .foreach() with buffer in CryptoBytesUtil.toByteVector() (#4454) 2022-07-06 18:23:14 -05:00
Nadav Kohen
ae0962d7ed
Musig2 Implementation (#4418)
* An initial (not yet working) implementation with test

* Added custom (non-bip-340) verification for now

* Made KeySet a case class

* Got MuSig2 working with BIP340 verification passing

* Responds to Ben's review

* Fixed hash tags and added parital signature verification

* Added point multiplication that allows infinity and did some refactoring

* Refactored type defs into case classes

* Added tests for more signers and fixed single-party bug

* Added key aggregation test vectors from BIP

* Added nonce generation test vectors from BIP

* Added nonce aggregation test vectors from BIP

* Made nonce aggregation test vectors pass by having MultiNoncePub wrap SecpPoints

* Added remaining static test vectors from BIP

* Implements tweaking support and adds tests, including all of the remaining BIP tests

* Added factory objects for nonce types

* Refactored things into multiple files with renaming and restructuring

* Some minor renaming

* Introduced ParityMultiplier ADT to remove unneccesary computations

* Added scaladocs

* Added messages to invariants

* Fixed a typo

* Nonce generation now takes a SchnorrPublicKey instead of raw bytes

* Made point multiplication more robust

* Responded to Ben nits

* Added musig.md
2022-07-06 12:59:13 -05:00
benthecarman
eae16a52f8
Allow creating input info of simple OP_TRUE script pub key (#4450) 2022-07-06 10:52:06 -05:00
Chris Stewart
11f6c8f024
2022 07 05 UnknownControlBlock (#4449)
* Add TaprootUnknownPath and UnknownControlBlock

* Fix small bugs and make validation more resilient against exceptions

* Take ben's suggestion and use abstract class

* Fix bug in TaprootKeyPath's default hash type

* Fix comment
2022-07-05 19:26:28 -05:00
Chris Stewart
6f6315c1e7
Fix taproot SIGHASH_SINGLE taproot annex hash bug (#4448) 2022-07-04 16:16:57 -05:00
fiatjaf
a5080ad7cd
fix a space typo. (#4447) 2022-07-04 15:47:57 -05:00
Chris Stewart
aca59ca352
Fix test logging (#4446) 2022-07-04 10:49:07 -05:00
benthecarman
64183568fe
Allow creation of TaprootTxSigComponent (#4445)
* Allow creation of TaprootTxSigComponent

* PreviousOutputMap using MapWrapper
2022-07-04 08:46:10 -05:00
Shreyansh
111df25df0
Fix sync issues post #4408 (#4441)
* fix node test shared fixtures bug

The cached bitcoind fixtures were used and stopped in UnsyncedNeutrinoNodeTest which causes an error if NeutrinoNodeTest is run at the same time on high performant systems, which is why it escaped CI. Merges NeutrinoNodeTest and UnsyncedNeutrinoNodeTest

* fix possible issues with PeerMessageReceiverTest

This reverts commit 55e7cafee6c6fd8515650cf65d96f9d92a2a8812.

* fix filter sync issue when wallet creation time indicates already synced

* move switch peer test to NeutrinoNodeWithUnachedBitcoindTest
2022-07-04 08:42:45 -05:00
benthecarman
5f93096c5a
Fix Taproot keyspend serialization (#4443) 2022-07-02 05:05:36 -05:00
benthecarman
93302fea01
Fix TaprootKeyPath.isValid for 64 byte sigs (#4444) 2022-07-02 05:02:47 -05:00
Chris Stewart
0c14fc961b
Add test case for SIGHASH_ALL_ANYONECANPAY in taproot (#4442)
* Add test case for SIGHASH_ALL_ANYONECANPAY in taproot

* Remove spendingTx comment
2022-07-01 16:45:41 -05:00
Chris Stewart
3122e1d0f8
Fix bug in taproot SIGHASH_ANYONECANPAY_SINGLE impl (#4440) 2022-07-01 10:24:09 -05:00
Chris Stewart
38d8f8cdf0
2022 06 30 OP_CODESEPARATOR impl compatible with taproot (#4439)
* Implement OP_CODESEPARATOR index checking

* Remove taproot serialization options

* Refactor name

Co-authored-by: benthecarman <benthecarman@live.com>
2022-06-30 13:59:14 -05:00
benthecarman
678612161b
Fix lnd OutputDetails for outputs that dont have an address (#4438) 2022-06-30 08:57:01 -05:00
GreyMcCarthy
135b9f8a35
Update documentation for UI to use build script Advanced Setup (#4430)
* Updated the instructions for installing the Suredbits wallet app

* Changed npm make to npm run make in instructions

* removed npm run make from the instructions as it is already run in the bash file
2022-06-29 16:28:33 -05:00
Chris Stewart
20bf1e6a08
Remove map on tor to allow access to getdlchostaddress endpoint before tor is fully stated (#4435) 2022-06-28 13:53:44 -05:00
user411
76694a55e9
Add server build matrix, mac,linux electron builds (#4434)
* Github electron release workflow

* Remove setup-node working-directory

* Suredbits Wallet linux workflow

* Build Mac krystalbull, Windows setup/install monorepo

* Build Mac Suredbits Wallet

* Test sign Electron Krystal Bull app

* Try fixed path

* Try different env var notation

* Change env var access notation

* Change env var access notation

* Add "$VAR"

* Quote more variables

* Test sign oracle-electron dmg directly

* Change comment

* Try again

* Try again

* Test build dep

* Test

* Test pull .zip artifact from previous build step

* Build after adding artifact folder support

* Matrix zips building

* os.target -> matrix.target

* Remove unused os references

* matrix zips and electron builds

* Add oses

* shell: bash

* shell: bash

* view artifacts

* Magic colon

* Add back javafx builds

* Optimize zip builds?

* Fix linux electron suredbits wallet

* Single build

* Separate JavaFX builds and cleanup

* Test sign wallet

* Take out non-mac builds for now

* Test build

* Test build with wildcard names directly

* Test build with wildcard names directly

* Test non-wildcard build

* Test keystore auth

* Test keychain again

* Try email as keychain key

* JavaFX build

* Try to notarize with keychain

* test notarize from keychain on javafx

* Try different keychain item name

* Try another keychain item name

* Test another keychain key

* Try another key

* Test Krystal Bull Electron signing/notarization

* Test keychain unlock and Team Id

* Import certs

* Test

* Test

* test

* test

* Test with keychain notarize

* Test

* Test short signing id

* Manually sign .app

* Try again

* Try again

* Try again

* Echo

* Echo

* Echo

* Echo

* server oracle electron build/sign/notarize

* manually sign after electron build

* Again

* Again

* Again

* Again

* Test staple

* Again

* Again

* Adjust password notarizing

* Sign dmg

* Only sign dmg

* Test implied matrix.* env var

* Sign app, sign dmg

* Again

* Electron native signing with keychain name

* again

* Make signing_temp.keychain before electron build

* Change keychain to signing_temp

* Back to signing_temp.keychain

* Notarize .zip

* Remove electron signing

* Add notarytool commands

* Unlock notarytool

* Add AC_PASSWORD

* store-creditials earlier

* Add codesign debugs

* gatekeeper-access: false, sign and notarize with electron forge

* Test run platform specific config

* Remove my-build/

* Test $KB_MAKE in artifact path

* Check dmg signing

* Check signing on wallet

* Again

* Fix env vars

* again

* Fix env var expansion

* again

* again

* again

* again

* again

* Add wallet entitlements.plist

* Turn other platform builds back on

* Mac zip only

* zip only

* cleanup

* macos manual sign apps

* comment

* Remove ubuntu electron build

* Test notarize KB

* Test windows build

* Build Windows KB

* mac,linux,win zips mac,linux electron builds

* Zip signed app

* Test mac zip after sign

* wallet cleanup

* again

* again

* Fix env vars

* No signing

* Move output .zips into /make

* Manual sign KB

* Manual sign again

* Again

* No signing

* Turn all builds back on

* Add debug flag, take out windows electron build

* Remove branch name from bitcoin-s-ts checkout
2022-06-28 10:49:17 -05:00
Shreyansh
42564bc810
Find and switch peers (#4408)
* add support to find and switch peers

* fix compile on 2.12

* allow empty config peers in regtest

* fix test

* minor fixes

changes timeouts, fix issue with ipv6 dns seeds, initDisconnect when disconnected bug, dbPeers order fix

* fix: not removing peers on initialization timeout

* fix: query again when previous failed

* fix: wrong condition for deferred peers

* restore log levels

* clean up

* add PeerStack to allow trying peers based on priority values

* fix migrations

* changes from comments

* use StartStopAsync

* changes from comments

* fix switch if peer down test

* changes from comments
2022-06-28 10:19:13 -05:00
Chris Stewart
305e920784
Remove extra stuff from README so its easier to find important stuff (#4433) 2022-06-27 17:24:22 -05:00
Chris Stewart
a97be26586
Get a SIGHASH_SINGLE test case working (#4431)
* Get a SIGHASH_SINGLE test case working

* Remove println
2022-06-27 15:23:49 -05:00
Chris Stewart
906e1f5c53
Bump previousStableVersion to 1.9.2 (#4432) 2022-06-27 15:22:17 -05:00
benthecarman
c4fd7035be
Add Taproot PSBT fields (#4420) 2022-06-27 08:55:30 -05:00
Chris Stewart
aed92c35af
Implement DISABLE_JLINK env variable to disable jlink jre's usage at runtime (#4426) 2022-06-26 13:20:22 -05:00
benthecarman
828d03c727
Fix out of bounds issues with lnd mappers (#4425) 2022-06-25 07:27:54 -05:00
benthecarman
0b9190f968
Lnd v0.15.0-beta (#4419) 2022-06-24 08:34:54 -05:00
Chris Stewart
124cbe4b67
Add annex to TaprootKeyPath (#4416)
* Add annex to TaprootKeyPath

* Add TaprootWitness.annexHashOpt

* Fix duplicate method
2022-06-23 12:12:38 -05:00
benthecarman
99b75d166f
Fixes support for bitcoind taproot descriptor wallets (#4415) 2022-06-23 07:10:51 -05:00
Chris Stewart
5115d8d076
Move lastCodeSeparator to StartedScriptProgram (#4414) 2022-06-22 09:41:30 -05:00
Chris Stewart
a680f03c04
Implement BIP341 (#4409)
* Implement BIP341

Get coreTest working

* REmove logger

* scalafmt

* Cleanup

* Make checkSigTapScrip() take a SchnorrPublicKey

* Address ben's code review

* Adjust error type on WitenssVersionV1.rebuild()
2022-06-22 09:36:55 -05:00
rorp
a7aad46934
Seed backup API (#4357)
* Seed backup API

* respond to the PR comments

* exportseed/importseed symmetry

* update docs
2022-06-22 08:14:11 -05:00
Shreyansh
a7ba46f67d
Update hardcoded seeds (#4412)
* update hardcoded seeds

* run tests again
2022-06-22 05:59:43 -05:00
Chris Stewart
970b6fd6eb
upgrade scalatest dependencies (#4411) 2022-06-21 15:09:20 -05:00
Shreyansh
4dc1bc7050
add bitcoind v23 rpc (#4368) 2022-06-21 13:20:47 -05:00
Chris Stewart
e25c24dc9b
Fix package name bug so package name is ra… (#4402)
* Fix package name bug so package name is bitcoin-s-server-mac-1.9.2 rather than  bitcoin-s-server-mac.os.x-1.9.2.zip

* Fix whitespace bug on mac

* Fix spacing
2022-06-21 12:41:01 -05:00
benthecarman
531845adfa
Accept keysend and amp in lnd fixtures (#4407) 2022-06-21 07:53:37 -05:00
benthecarman
9b1f8924ab
Fix download lnd command (#4406) 2022-06-19 07:59:26 -05:00
Chris Stewart
0f3c28e23e
Fix UI build instructions (#4405)
* Fix UI build instructions

* Fix 1.9.2 version of docs too
2022-06-19 07:58:40 -05:00
benthecarman
04802ae239
Add peers rpc to lnd (#4403) 2022-06-18 18:42:08 -05:00
Chris Stewart
7f43ef98ad
Default to suredbits node if peers field is left empty (#4404)
* Default to suredbits node if peers field is left empty

* Remove log
2022-06-18 18:40:53 -05:00
benthecarman
a0ab0638f8
Allow for custom channel sizes in LndRpcTestUtil.createNodePair (#4398) 2022-06-16 19:36:03 -05:00
Chris Stewart
3154362f1a
Add platform specific name to bitcoin-s artifacts (#4401)
* Add platform specific name to bitcion-s artificats so they don't overwrite each other on releases

* Fix so artifact name is changed, but startup script name is not changed
2022-06-16 17:08:06 -05:00
Chris Stewart
e2b8fd11c8
Add sports betting examples to 1.9.2 website (#4400) 2022-06-16 14:53:17 -05:00
Chris Stewart
620e19b529
Add some summaries (#4399) 2022-06-16 14:26:37 -05:00
GreyMcCarthy
94872ddebc
sports betting example (#4397)
* added sports betting exercise

* added sports betting exercise

* added sports betting exercise
2022-06-16 13:55:47 -05:00
benthecarman
24a9e6a5e6
Add PaymentSecret, ShortChannelId, and MilliSatoshis Db Mappers (#4396) 2022-06-15 07:32:53 -05:00