mirror of
https://github.com/bitcoin/bips.git
synced 2025-05-12 12:03:29 +00:00
BIP-352: scanning: add step to skip tx if input pubkeys sum A is point at infinity
The input data for the test vector is taken from the signet transaction fe788cf6578d547819def43d79e6c8f0153d4885f5a343d12bd03f34507aabd6 which spends two P2WPKH inputs with negated pubkeys (x, y) and (x, -y) from the funding transaction 3a286147b25e16ae80aff406f2673c6e565418c40f45c071245cdebc8a94174e (see also https://github.com/bitcoin-core/secp256k1/pull/1519#issuecomment-2143167510 and the output from the script in the previous commit message). Co-authored-by: josibake <josibake@protonmail.com>
This commit is contained in:
parent
47033c62dc
commit
59cc43d727
@ -335,6 +335,7 @@ A scan and spend key pair using BIP32 derivation are defined (taking inspiration
|
|||||||
If each of the checks in ''[[#scanning-silent-payment-eligible-transactions|Scanning silent payment eligible transactions]]'' passes, the receiving wallet must:
|
If each of the checks in ''[[#scanning-silent-payment-eligible-transactions|Scanning silent payment eligible transactions]]'' passes, the receiving wallet must:
|
||||||
|
|
||||||
* Let ''A = A<sub>1</sub> + A<sub>2</sub> + ... + A<sub>n</sub>'', where each ''A<sub>i</sub>'' is the public key of an input from the ''[[#inputs-for-shared-secret-derivation|Inputs For Shared Secret Derivation]]'' list
|
* Let ''A = A<sub>1</sub> + A<sub>2</sub> + ... + A<sub>n</sub>'', where each ''A<sub>i</sub>'' is the public key of an input from the ''[[#inputs-for-shared-secret-derivation|Inputs For Shared Secret Derivation]]'' list
|
||||||
|
** If ''A'' is the point at infinity, skip the transaction
|
||||||
* Generate the ''input_hash'' with the smallest outpoint lexicographically and ''A'', using the method described above
|
* Generate the ''input_hash'' with the smallest outpoint lexicographically and ''A'', using the method described above
|
||||||
* Let ''ecdh_shared_secret = input_hash·b<sub>scan</sub>·A''
|
* Let ''ecdh_shared_secret = input_hash·b<sub>scan</sub>·A''
|
||||||
* Check for outputs:
|
* Check for outputs:
|
||||||
|
@ -300,6 +300,10 @@ if __name__ == "__main__":
|
|||||||
add_to_wallet = []
|
add_to_wallet = []
|
||||||
if (len(input_pub_keys) > 0):
|
if (len(input_pub_keys) > 0):
|
||||||
A_sum = reduce(lambda x, y: x + y, input_pub_keys)
|
A_sum = reduce(lambda x, y: x + y, input_pub_keys)
|
||||||
|
if A_sum.get_bytes() is None:
|
||||||
|
# Input pubkeys sum is point at infinity -> skip tx
|
||||||
|
assert expected["outputs"] == []
|
||||||
|
continue
|
||||||
input_hash = get_input_hash([vin.outpoint for vin in vins], A_sum)
|
input_hash = get_input_hash([vin.outpoint for vin in vins], A_sum)
|
||||||
pre_computed_labels = {
|
pre_computed_labels = {
|
||||||
(generate_label(b_scan, label) * G).get_bytes(False).hex(): generate_label(b_scan, label).hex()
|
(generate_label(b_scan, label) * G).get_bytes(False).hex(): generate_label(b_scan, label).hex()
|
||||||
|
@ -2713,6 +2713,48 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"receiving": [
|
"receiving": [
|
||||||
|
{
|
||||||
|
"given": {
|
||||||
|
"vin": [
|
||||||
|
{
|
||||||
|
"txid": "3a286147b25e16ae80aff406f2673c6e565418c40f45c071245cdebc8a94174e",
|
||||||
|
"vout": 0,
|
||||||
|
"scriptSig": "",
|
||||||
|
"txinwitness": "024730440220085003179ce1a3a88ce0069aa6ea045e140761ab88c22a26ae2a8cfe983a6e4602204a8a39940f0735c8a4424270ac8da65240c261ab3fda9272f6d6efbf9cfea366012102557ef3e55b0a52489b4454c1169e06bdea43687a69c1f190eb50781644ab6975",
|
||||||
|
"prevout": {
|
||||||
|
"scriptPubKey": {
|
||||||
|
"hex": "00149d9e24f9fab4e35bf1a6df4b46cb533296ac0792"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"txid": "3a286147b25e16ae80aff406f2673c6e565418c40f45c071245cdebc8a94174e",
|
||||||
|
"vout": 1,
|
||||||
|
"scriptSig": "",
|
||||||
|
"txinwitness": "0247304402204586a68e1d97dd3c6928e3622799859f8c3b20c3c670cf654cc905c9be29fdb7022043fbcde1689f3f4045e8816caf6163624bd19e62e4565bc99f95c533e599782c012103557ef3e55b0a52489b4454c1169e06bdea43687a69c1f190eb50781644ab6975",
|
||||||
|
"prevout": {
|
||||||
|
"scriptPubKey": {
|
||||||
|
"hex": "00149860538b5575962776ed0814ae222c7d60c72d7b"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||||
|
],
|
||||||
|
"key_material": {
|
||||||
|
"spend_priv_key": "0000000000000000000000000000000000000000000000000000000000000001",
|
||||||
|
"scan_priv_key": "0000000000000000000000000000000000000000000000000000000000000002"
|
||||||
|
},
|
||||||
|
"labels": []
|
||||||
|
},
|
||||||
|
"expected": {
|
||||||
|
"addresses": [
|
||||||
|
"sp1qqtrqglu5g8kh6mfsg4qxa9wq0nv9cauwfwxw70984wkqnw2uwz0w2qnehen8a7wuhwk9tgrzjh8gwzc8q2dlekedec5djk0js9d3d7qhnq6lqj3s"
|
||||||
|
],
|
||||||
|
"outputs": []
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user