-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrypto_ops.bscript
More file actions
48 lines (37 loc) Β· 2.6 KB
/
crypto_ops.bscript
File metadata and controls
48 lines (37 loc) Β· 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Crypto
OP_RIPEMD160 β
// - The input is hashed using RIPEMD-160.
// - i/p => top stack element
OP_SHA1 β
// - The input is hashed using SHA-1.
// - i/p => top stack element
OP_SHA256 β
// - The input is hashed using SHA-256.
// - i/p => top stack element
OP_HASH160 β
// - The input is hashed twice: first with SHA-256 and then with RIPEMD-160.
// - i/p => top stack element
OP_HASH256 β
// - The input is hashed two times with SHA-256.
// - i/p => top stack element
OP_CODESEPARATOR β
// - All of the signature checking words will only match signatures to the data after the most recently-executed OP_CODESEPARATOR.
// explanation :
// https://xiaohuiliu.medium.com/op-codeseparator-97dc039a8ec8
// https://wiki.bitcoinsv.io/index.php/OP_CODESEPARATOR
OP_CHECKSIG β
// - The entire transaction's outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.
// - i/p => [ pubkey sig ]
OP_CHECKSIGVERIFY β
// - Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.
// - i/p => [ pubkey sig ]
OP_CHECKMULTISIG β
// - Compares the first signature against each public key until it finds an ECDSA match. Starting with the subsequent public key, it compares the second signature against each remaining public key until it finds an ECDSA match. The process is repeated until all signatures have been checked or not enough public keys remain to produce a successful result. All signatures need to match a public key. Because public keys are not checked again if they fail any signature comparison, signatures must be placed in the scriptSig using the same order as their corresponding public keys were placed in the scriptPubKey or redeemScript. If all signatures are valid, 1 is returned, 0 otherwise. Due to a bug, one extra unused value is removed from the stack.
// - i/p => [ x sig_1 sig_2 2 pub_1 pub_2 2 ]
// - general i/p => [ x sig1 sig2 ... <number of signatures> pub1 pub2 <number of public keys> ]
OP_CHECKMULTISIGVERIFY β
// - Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward.
OP_CHECKSIGADD [Will be released in tapscript mode]
// - Three values are popped from the stack. The integer n is incremented by one and returned to the stack if the signature is valid for the public key and transaction. The integer n is returned to the stack unchanged if the signature is the empty vector (OP_0). In any other case, the script is invalid. This opcode is only available in tapscript.
// - i/p [ sig n pub ]
// IMP : only available in tapscript