New answers tagged

7

How should these two functions be used properly? A simple answer is "not at all". Those functions are not exposed in the public API of libsecp256k1, and that's the reason why they don't have user-targeted documentation. Instead, they're used as internal subroutines, mostly for the implementation of ECDSA and Schnorr signatures. Be advised that ...


1

For me, the key video explaining the math for bitcoin elliptic curve secp256k1 was this: Bitcoin 101 - Elliptic Curve Cryptography - Part 4 - Generating the Public Key (in Python) And if you want to check with a python script I extracted from the video, you can use this: #!/usr/bin/python3 # Super simple Elliptic Curve Presentation. No imported libraries, ...


4

In ECDSA, the private key is a scalar 256-bit number. The public key is a elliptic curve point on the secp256k1 curve. Elliptic curves are abelian groups made up of the set of points resulting from repeatedly applying its group operation starting with its base point G. The group operation is the addition of two points. So, starting with the base point as the ...


2

Have you checked the "Keys, Addresses" chapter from "Mastering Bitcoin"? You can read it for free here: https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04.asciidoc The Generating a Public Key section has also a visual representation for the "multiplication of a point G by an integer k on an elliptic curve"


3

The reason for this error is that secp256k1_context is an opaque type. This means that you cannot create it on the stack; you need to create a heap-allocated version (and destroy it) using the functions from the API (specifically secp256k1_context_create and secp256k1_context_destroy, as Mark H mentioned in a comment). There is no way to access the internals....


3

1). from the secp256k1 code I did not find 27~34 value, all I found are 0~3; so where the difference come from? The serialization as a 65-byte signature + recovery byte happens on the Bitcoin Core side, not in libsecp256k1. See key.cpp: vchSig[0] = 27 + rec + (fCompressed ? 4 : 0); 2). I guess [27~30 and [31~34] such value set does not come from nonsense, ...


3

It is important to note that the Elliptic Curve Discrete Logarithm Problem (ECDLP) is slightly different from the normal Discrete Logarithm Problem (DLP). In DLP, the ^ operator is actually exponentiation and it is operating on integers so mod p is just the normal modulus. However for ECDLP, ^ is actually elliptic curve point multiplication. This is ...


Top 50 recent answers are included