bitcoin-elixir v0.0.2 Bitcoin.Secp256k1

ECDSA Secp256k1 curve operations.

By default erlang’s :crypto.verify is used to make it less problematic when using as a library (no need for gcc).

However, if :libsecp256k1 NIF is available, it’s used. To enable it just uncomment appropriate line in mix.exs deps.

libsecp256k1: https://github.com/bitcoin-core/secp256k1

If gcc and git dependencies are not a problem, use NIF. It’s much faster and it’s the proper way to do it consensus-wise. Do note that even though it seems unlikely, an error in the NIF will bring the whole erlang VM down (not just the process)

Summary

Functions

Secp256k1 parameters

Verify signed message

Functions

params()
params() :: map

Secp256k1 parameters.

http://www.secg.org/sec2-v2.pdf

verify(msg, sig, pk)
verify(binary, binary, binary) :: boolean

Verify signed message.

Returns true if the signature matches public key.

msg should already be a 32 byte long digest.