make libsecp256k1 available with a build tag.
This commit is contained in:
19
README.md
19
README.md
@@ -126,6 +126,25 @@ nostr.InfoLogger = log.New(io.Discard, "", 0)
|
||||
go run example/example.go
|
||||
```
|
||||
|
||||
### Using [`libsecp256k1`](https://github.com/bitcoin-core/secp256k1)
|
||||
|
||||
[`libsecp256k1`](https://github.com/bitcoin-core/secp256k1) is very fast:
|
||||
|
||||
```
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
cpu: Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
|
||||
BenchmarkWithoutLibsecp256k1/sign-4 2794 434114 ns/op
|
||||
BenchmarkWithoutLibsecp256k1/check-4 4352 297416 ns/op
|
||||
BenchmarkWithLibsecp256k1/sign-4 12559 94607 ns/op
|
||||
BenchmarkWithLibsecp256k1/check-4 13761 84595 ns/op
|
||||
PASS
|
||||
```
|
||||
|
||||
But to use it you need the host to have it installed as a shared library and CGO to be supported, so we don't compile against it by default.
|
||||
|
||||
To use it, use `-tags=libsecp256k1` whenever you're compiling your program that uses this library.
|
||||
|
||||
## Warning: risk of goroutine bloat (if used incorrectly)
|
||||
|
||||
Remember to cancel subscriptions, either by calling `.Unsub()` on them or ensuring their `context.Context` will be canceled at some point.
|
||||
|
||||
Reference in New Issue
Block a user