# Bitcoinex.Secp256k1 (bitcoinex v0.1.6) View Source

ECDSA Secp256k1 curve operations. libsecp256k1: https://github.com/bitcoin-core/secp256k1

Currently supports ECDSA public key recovery.

In the future, we will NIF for critical operations. However, it is more portable to have a native elixir version.

# Link to this section Summary

## Functions

ecdsa_recover_compact does ECDSA public key recovery.

Returns the y-coordinate of a secp256k1 curve point (P) using the x-coordinate. To get P(y), we solve for y in this equation: y^2 = x^3 + 7.

verify_point verifies that a given point is on the secp256k1 curve

verify whether the signature is valid for the given message hash and public key

# ecdsa_recover_compact(msg, compact_sig, recoveryId)

View Source

## Specs

```ecdsa_recover_compact(binary(), binary(), integer()) ::
{:ok, binary()} | {:error, String.t()}```

ecdsa_recover_compact does ECDSA public key recovery.

# get_y(x, is_y_odd)

View Source

## Specs

`get_y(integer(), boolean()) :: {:ok, integer()} | {:error, String.t()}`

Returns the y-coordinate of a secp256k1 curve point (P) using the x-coordinate. To get P(y), we solve for y in this equation: y^2 = x^3 + 7.

# verify_point(point)

View Source

## Specs

`verify_point(Bitcoinex.Secp256k1.Point.t()) :: bool()`

verify_point verifies that a given point is on the secp256k1 curve

# verify_signature(pubkey, sighash, signature)

View Source

## Specs

```verify_signature(
Bitcoinex.Secp256k1.Point.t(),
integer(),
Bitcoinex.Secp256k1.Signature.t()
) :: boolean()```

verify whether the signature is valid for the given message hash and public key