libauth icon indicating copy to clipboard operation
libauth copied to clipboard

expose secp256k1_ec_pubkey_combine

Open madeken opened this issue 6 years ago • 5 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.

madeken avatar Dec 26 '18 06:12 madeken

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

ArvsIndrarys avatar Jan 18 '19 13:01 ArvsIndrarys

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

ArvsIndrarys avatar Jan 18 '19 16:01 ArvsIndrarys

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

madeken avatar Jan 18 '19 16:01 madeken

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.

ArvsIndrarys avatar Jan 21 '19 15:01 ArvsIndrarys

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 !

ArvsIndrarys avatar Jan 22 '19 11:01 ArvsIndrarys

Solved now by a number of other libraries 👍

bitjson avatar Feb 23 '24 05:02 bitjson