mirror of
https://github.com/bitcoin/bips.git
synced 2026-03-30 16:06:44 +00:00
BIP-352: take use of vendored secp256k1lab for reference implementation
This allows to remove secp256k1.py and replace the secp256k1-specific
parts in the reference implementation. Replacement guide:
* ECKey -> Scalar
* ECKey.set(seckey_bytes) -> Scalar.from_bytes_checked(seckey_bytes)
* seckey.get_pubkey() -> seckey * G
* seckey.get_bytes() -> seckey.to_bytes()
* seckey.add(tweak_bytes) -> seckey + Scalar.from_bytes_checked(tweak_bytes)
* seckey.negate() -> seckey = -seckey
* seckey.sign_schnorr -> schnorr_sign(..., seckey.to_bytes(), ...)
* ECPubKey -> GE
* ECPubKey.set(pubkey_bytes) -> GE.from_bytes_{xonly,compressed}(pubkey_bytes)
* pubkey.get_y() % 2 == 0 -> pubkey.has_even_y()
* pubkey.get_bytes(False) -> pubkey.to_bytes_compressed()
* pubkey.get_bytes() -> pubkey.to_bytes_xonly()
* not pubkey.valid -> pubkey.infinity
* pubkey.verify_schnorr -> schnorr_verify(..., pubkey.to_bytes_xonly(), ...)
* TaggedHash -> tagged_hash
* hashlib.sha256(preimage).digest() -> hash_sha256(preimage)
This commit is contained in:
@@ -2,7 +2,7 @@ import hashlib
|
||||
import struct
|
||||
from io import BytesIO
|
||||
from ripemd160 import ripemd160
|
||||
from secp256k1 import ECKey
|
||||
from secp256k1lab.secp256k1 import Scalar
|
||||
from typing import Union
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ class VinInfo:
|
||||
else:
|
||||
self.txinwitness = txinwitness
|
||||
if private_key is None:
|
||||
self.private_key = ECKey()
|
||||
self.private_key = Scalar()
|
||||
else:
|
||||
self.private_key = private_key
|
||||
self.scriptSig = scriptSig
|
||||
|
||||
Reference in New Issue
Block a user