* WIP: Remove isDummySignature
* Add ECDigitalSignature.LOW_R_SIZE, use it in ECDigitalSignature.dummyLowR
* Regenerated dlc_test.json and dlc_tx_test.json to add hash type to dummy ecdsa signatures in static test vectors
* Regenerated dlc_test.json and dlc_tx_test.json to add hash type to dummy ecdsa signatures in static test vectors
* Fix InputInfoTest maxWitnessLengths checks to be >=
* Fix docs
* Add DigitalSignature, extend it with ECDigitaSignature,SchnorrDigitalSignature
* WIP: Remove EmptyDigitalSignature case object in favor of val
* Fix byte representation of ECDigitalSignature.emptyDigitalSignature
* Simplify names to ECDigitalSignature.{empty, dummy, dummyLowR}
* Fix docs
* Pull over scala3 compatible code for crypto/ project from https://github.com/bitcoin-s/bitcoin-s/pull/3497
* Pull over scala3 compatible code for core/ project from https://github.com/bitcoin-s/bitcoin-s/pull/3497
* Add -Xsource:3 to core/
* Get coreJVM/compile working
* restore files lost from master when checking out core/ from 2021-06-30
* Get entire codebase compiling
* Get bitcoindRpcTest/test:compile working
* Restore P2SHDescriptor constructor
* scalafmt
* Fix UInt8.toByte
* Get all merkle block tests working
* Fix GCS bug
* Add -Xsource:3 to cryptoTest/
* Update scalafmt-core to 3.8.1
* Update .scalafmt.conf settings to be factory default settings
* Fix typo
* scalafmt
* Empty commit to re-run CI
* Revert some scalafmt back to original scalafmt.conf
---------
Co-authored-by: Chris Stewart <stewart.chris1234@gmail.com>
* Add taproot wallet test vectors
* Get parsing logic working
* Get first test case passing
* Add TapLeaf
* Get test cases working with two TapLeaf
* Add TapscriptTree as the top level type for a recursive data structure for TapscriptPath's
* Remove control block parsing for now until we actually test control blocks
* scalafmt
* Make ECPublicKey return bytes that were passed as a parameter rather than always returning compressed byte representation
Cleanup, add invariant
Use proper generator for isCompressed flag in BouncyCastleSecp256k1Test
* Try doing docs last to see if something fails in cryptoTestJVM/coreTestJVM
* Fix BouncyCastleUtil.computePubKey() where we weren't passing isCompressed
* Add OrderedSchnorrSignatures, use it in OracleAttestment, propagate it threw the codebase
* Small cleanups
* Add SortedVecFactory
* Fix test case with out of order nonces
* Represent and handle SIGHASH_DEFAULT correctly in TaprootKeyPath
* Prevent construction of invalid TaprootKeyPath, fix tests
* Have SIGHASH_DEFAULT be SIGHASH_ALL in preTaproot cases
* 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>
* 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
* 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()
* Renamed ECPublicKey.tweakMultiply to just multiply and added CryptoParams.getG
* Used decompressed G in FieldElement.G
* Removed G from FieldElement altogether
* HashType now uses Int instead of Int32
* Moved HashType from core to crypto
* Added HashType helper functions to ECDigitalSignature
* Added tests
* Fixed compile
* Get refactor working where we decouple CETSignatures and the partial refund signature
* Add DLCAcceptWithCetSigs() for the case where we have a refund sig, but no cet signatures
* Fix bugs
* Fix sighash parsing bugs
* Encapsulate initialization of DLCOracle.start() method
* Use internal WalletAppConfig.kmConf rather than passing in custom key manager parameters
* Add KeyManagerAppConfig.defaultAccountType
* Get all tests passing besides TrezorAddressTest
* Get TrezorAddressTest passing with provided entropy
* Add unit test to make sure we can always derive the seed
* Get docs compiling
* Fix dlcWalletTest test cases
* Add more test cases to keymanager
* Add the new configuration to the example configuration
* Add more test cases
* Remove coverage on 2.12 as it isn't accurate
* Rework DLCOracleAppConfig.start() to call kmConf.start() so the oracle can use entropy provided via bitcoin-s.conf
* Removed type parameter from PublicKey
* Deduplicated call to public key decompression in isFullyValid
* Fixed FieldElement
* Added CurveCoordinate to replace FieldElement in places where it was being misused
* Added edge case tests
* Removed ExecutionContext from ECKey
* Refactored ECPublicKey to remove compression state and introduced ECPublicKeyBytes to handle cases where serialization of input is important
* Fixed the rest of bitcoin-s so that it passes all tests
* Made all ECKeys into case classes
* Successfully added isFullyValid invariant to ECPublicKey!
* Fixed docs
* Added scaladocs and fixed a RpcPsbtResult bug
* Reject private keys of length < 32 and fix WIF parsing bug
* Replaced secp256k1 with secp256k1-zkp as submodule pointing to my java-bindings branch
* Built new binaries for schnorr signing and adaptor signing and integrated into LibSecp256k1CryptoRuntime
* Added public key compression function with tests, removed old adaptor signature point serializers
* Implemented ECDSA adaptor signatures in scala according to the most recent spec
* Added static test vectors for adaptor signing from spec
* Moved bouncy castle adaptor signing tests to .jvm
* Added scaladocs and responded to nits
* Added scaladocs with legends to spec naming
* Responded to Ben's review
* Fixed scala 2.12 compile issue
* Fixed BouncyCastle secKeyVerify
* Updated add-to-jni build instructions
* Updated secp256k1-zkp to target bitcoin-s-master
* Add windows binary (#14)
* Added Mac OS binaries
Co-authored-by: benthecarman <benthecarman@live.com>
* Silence scalajs warnings for org.bitcoins.crypto package
* Add comments
* Create 'facades' package, move all js facades into that package. Make the new -Wconf flags work with only scala 2.13.x
* Small cleanups
* Schnorr sigs for Scala.js
* fix build
* put BIP340 test vectors in a shared space
* remove teskit dependency, fix point edge cases
* fix build
* Adaptor signatures for Scala.jsr
* add some more tests
* add unit tests for point addition
* scaladoc
* add more public keys tests
* Add scaladoc
* Remove extra isCompressed flag on CryptoRuntime.toPublicKey() as it is inside of ECPrivateKey already
Co-authored-by: christewart <stewart.chris1234@gmail.com>
* Schnorr sigs for Scala.js
* fix build
* put BIP340 test vectors in a shared space
* remove teskit dependency, fix point edge cases
* fix build
* add unit tests for point addition
* scaladoc
* cleanup
* respond to the comments
* Fix usage of BitcoinSLogger
Co-authored-by: christewart <stewart.chris1234@gmail.com>