bitauth / libauth

An ultra-lightweight, zero-dependency TypeScript library for Bitcoin Cash, Bitcoin, and Bitauth applications.

Home Page:https://libauth.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expose secp256k1_ec_pubkey_combine

madeken opened this issue · comments

One missing functionality I am missing from this library is the ability to combine multiple public keys. This is provided by libsecp256k1 with secp256k1_ec_pubkey_combine.

I will be interested to in that feature, is there somewhere some kind of guidelines on how to do that addition?

I nearly implemented that feature but I fall upon that problem : instance.exports._secp256k1_ec_pubkey_combine is not a function.

The thing is, I am sure that this method should exist as it is there .
How could I verify its presence in what bitcoin-ts calls?
My implementations follows what that merge request did, and the error comes from that part in src/lib/bin/secp256k1/secp256k1Wasm.ts :

pubkeyCombine: (
    contextPtr,
    publicKeyPtr,
    otherPublicKeyPtr
  ) =>
    instance.exports._secp256k1_ec_pubkey_combine(
      contextPtr,
      publicKeyPtr,
      otherPublicKeyPtr,
    )

Some implementations already use it too

Did you by any chance forget to add it to:

https://github.com/bitjson/bitcoin-ts/blob/e9399905e0d3abf09f33ada9099397b9d2ba166b/wasm/docker/secp256k1.Dockerfile#L56

By the looks of it, you need to explicitly list each function to export

There was a typo there, thank you !

I am now stuck with some malloc problems. I think it is due to that special argument that the C asks for :
const secp256k1_pubkey * const *pubnonces.
I have trouble sending something similar from the JS.

I found a way to resolve that special argument. But now I got a Source is too large problem.
If you are interested in helping me out, check my fork out. My midifcations are on the feature/publicKey_combine branch.
I'll add my modifications there !

Solved now by a number of other libraries 👍