Do I have to worry about endian swapping when calculating ECDSA public key values, Creation & Signing of transactions and verification of signature?
This question is more of a straightforward yes/no kind of question because as far as I can tell Bitcoin endianness swapping madness will make you feel like your logic & algorithm are incorrect… Which in a way is true when considering that the algorithm requires bit swapping on almost every turn…
So let’s say I have functions
string CreateTransaction(); string SignTransaction(); bool VerifySignature(string Signature, vector<string> PublicKey); string GeneratePublicKey(BigInteger PrivateKey, vector<string> &PublicKey); // Takes input parameters like amount in Satoshi, receiving address // and other necessary data as required by bitcoin protocol string CreateTransaction(); // returns raw transaction hash // Signs transaction as instructed by BIP rules | DER format string SignTransaction(); // returns signature string // Verifies received signature via parameter bool VerifySignature(string Signature, vector<string> PublicKey); // returns true is signature matches given x point of publicKey // Generates publicKey via ECDSA Secp256k1 protocol string GeneratePublicKey(BigInteger PrivateKey, vector<string> &PublicKey); // updated PublicKey address but returns compressed or Uncompressed public key value (Decimal or hexadecimal)
I know for certain that the
CreateTransaction(); requires endian swapping
But I’d just like to confirm if there is any point in time during the secp256k1 ECDSA curve calculation that I need to swap endianness of any data.
Because I don’t require swapping endianness when carrying out
HASH160() on a privateKey value to get an accurate hash.
Leave a Reply