Commit Graph

10 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
3d9f4484df
btcec/schnorr/musig: update nonce test vectors to musig2 1.0.0 2022-10-20 17:57:50 -07:00
Darioush Jalali
149b0f09aa
go mod tidy in btcetc/ 2022-07-11 16:36:12 -07:00
Olaoluwa Osuntokun
65e4fc0dea
btcec/schnorr/musig2: update nonce generation to support optional inputs
In this commit, we update the nonce generation to support optional
parameters defined in the latest BIP draft. These parameters are
optional, but if specified my mitigate the effect of weak randomness
when generating the nonce.

Given the protocol doesn't require signers to prove how they generate
their nonces, this update is mainly to ensure strict spec compliance,
and is effectively optional.
2022-04-28 16:20:01 -07:00
Olaoluwa Osuntokun
f7168c8663
schnorr/musig2: add native support for taproot output key tweaking
In this commit, we add a series of new options and methods to make it
easier to use the package in the context of a taproot output that
commits to a script root or some other value. Before this series of
changes, the API was hard to use in this context as the taproot tweak
actually includes the internal public key, which in this case is the
aggregated public key. So you actually needed to call that API w/o the
tweak, get that, then recompute the tweak itself.

To make things easier in the taproot context, we've added a series of
new options that'll return the aggregated key before any tweaks (to be
used as the internal key), and also handle computing the BIP 341 tweak
value for the caller.
2022-04-28 16:19:57 -07:00
Olaoluwa Osuntokun
3baa09f33e
build: update to btcec/v2.1.1 and chaincfg/chainhash/v1.00 2022-03-09 18:54:03 -08:00
Oliver Gugger
56dfa0f7e2
mod: add temporary replace 2022-03-09 11:58:42 +01:00
Oliver Gugger
4ad74cd4c2
mod: use chaincfg/chainhash module 2022-03-09 11:58:39 +01:00
Olaoluwa Osuntokun
eb61742c5d
btcec/v2: create new ecdsa package
In this commit, we create a new package to house the ECDSA-specific
logic in the new `btcec/v2` pacakge. Thsi c hange is meant to mirror the
structure of the `dcrec` package, as we'll soon slot in our own custom
BIP-340 implementation.
2022-01-31 14:25:39 -08:00
Olaoluwa Osuntokun
eee3c3b337
multi: switch project over to using btcec/v2 2022-01-26 16:10:17 -08:00
Olaoluwa Osuntokun
87e8fe92c9
btcec: convert package into go module, alias to dcrec
In this commit, we turn the package into a new Go module (version 2),
and then port over the current set of types and functions to mainly
alias to the more optimized and maintained dcrec variant.

Taking a look at the benchmarks, most operations other than
normalization (which IIRC is a bit slower now due to constant time
fixes) enjoy some nice speeds up:
```
benchcmp is deprecated in favor of benchstat: https://pkg.go.dev/golang.org/x/perf/cmd/benchstat
benchmark                            old ns/op     new ns/op     delta
BenchmarkAddJacobian-8               464           328           -29.20%
BenchmarkAddJacobianNotZOne-8        1138          372           -67.27%
BenchmarkScalarBaseMult-8            47336         31531         -33.39%
BenchmarkScalarBaseMultLarge-8       42465         32057         -24.51%
BenchmarkScalarMult-8                123355        117579        -4.68%
BenchmarkNAF-8                       582           168           -71.12%
BenchmarkSigVerify-8                 175414        120794        -31.14%
BenchmarkFieldNormalize-8            23.8          24.4          +2.39%
BenchmarkParseCompressedPubKey-8     24282         10907         -55.08%
```
2022-01-26 16:10:14 -08:00