mirror of
https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line.git
synced 2025-06-07 16:06:26 +00:00
commit
eaf47b9ac7
@ -43,7 +43,7 @@ If this looks familiar, that's because it's the multisig that you deserialized i
|
||||
|
||||
The `scriptSig` for a standard multisig address must then submit the missing operands for `OP_CHECKMULTISIG`: a `0` followed by "m" signatures. For example:
|
||||
```
|
||||
0 $signature1 signature2
|
||||
0 $signature1 $signature2
|
||||
```
|
||||
|
||||
### Run a Raw Multisig Script
|
||||
@ -109,7 +109,7 @@ To create a P2SH multisig, follow the standard steps for creating a P2SH locking
|
||||
|
||||
1. Serialize `2 $address1 $address2 2 OP_CHECKMULTISIG`.
|
||||
1. `<serializedMultiSig>` = "52210307fd375ed7cced0f50723e3e1a97bbe7ccff7318c815df4e99a59bc94dbcd819210367c4f666f18279009c941e57fab3e42653c6553e5ca092c104d1db279e328a2852ae"
|
||||
2. Save `<serialized99Equal>` for future reference as the redeemScript.
|
||||
2. Save `<serializedMultiSig>` for future reference as the redeemScript.
|
||||
1. `<redeemScript>` = "52210307fd375ed7cced0f50723e3e1a97bbe7ccff7318c815df4e99a59bc94dbcd819210367c4f666f18279009c941e57fab3e42653c6553e5ca092c104d1db279e328a2852ae"
|
||||
3. SHA-256 and RIPEMD-160 hash the serialized script.
|
||||
1. `<hashedMultiSig>` = "babf9063cee8ab6e9334f95f6d4e9148d0e551c2"
|
||||
|
@ -30,9 +30,9 @@ Second, the `IF` conditional tends to be in the locking script and what it's che
|
||||
|
||||
Of course, you might say, that's how Bitcoin Script works. Conditionals use reverse Polish notation and they adopt the standard unlocking/locking paradigm, just like _everything else_ in Bitcoin Scripting. That's all true, but it also goes contrary to the standard way we read IF/ELSE conditionals in other programming languages; thus, it's easy to unconsciously read Bitcoin conditionals wrong.
|
||||
|
||||
Consider the following code: `IF OP_DUP OP_HASH160 <pubKeyHashA> ELSE OP_DUP OP_HASH160 <pubKeyHashA> ENDIF OP_EQUALVERIFY OP_CHECKSIG `.
|
||||
Consider the following code: `IF OP_DUP OP_HASH160 <pubKeyHashA> ELSE OP_DUP OP_HASH160 <pubKeyHashB> ENDIF OP_EQUALVERIFY OP_CHECKSIG `.
|
||||
|
||||
Year of looking at conditionals in prefix notation might lead you to read this as:
|
||||
Looking at conditionals in prefix notation might lead you to read this as:
|
||||
```
|
||||
IF (OP_DUP) THEN
|
||||
|
||||
|
@ -181,7 +181,7 @@ Here's where the security falls down:
|
||||
|
||||
First, anyone can redeem them without knowing much of a secret. They do have to have the `redeemScript`, which offers some protection, but once they do, that's probably the only secret that's necessary — unless your puzzle is _really_ tough, such as a computational puzzle.
|
||||
|
||||
Second, the actual redemption isn't secure. Normally, a Bitcoin transction is protected by the signature. Because the signature covers the transaction, no one on the network can rewrite that transaction to instead send to their address without invalidating the signature (and thus the transaction). That isn't true with a transactions whose inputs are just numbers. Anyone could grab the transaction and rewrite it to allow them to steal the funds. If they can get their transaction into a block before yours, they win, and you don't get the puzzle money. There are solutions for this, but they involve mining the block yourself of having a trusted pool mine it, and neither of those options is rational for an average Bitcoin user.
|
||||
Second, the actual redemption isn't secure. Normally, a Bitcoin transction is protected by the signature. Because the signature covers the transaction, no one on the network can rewrite that transaction to instead send to their address without invalidating the signature (and thus the transaction). That isn't true with a transactions whose inputs are just numbers. Anyone could grab the transaction and rewrite it to allow them to steal the funds. If they can get their transaction into a block before yours, they win, and you don't get the puzzle money. There are solutions for this, but they involve mining the block yourself or having a trusted pool mine it, and neither of those options is rational for an average Bitcoin user.
|
||||
|
||||
Yet, Peter Todd's cryptographic bounties prove that puzzle scripts do have some real-world application.
|
||||
|
||||
@ -189,7 +189,7 @@ Yet, Peter Todd's cryptographic bounties prove that puzzle scripts do have some
|
||||
|
||||
Puzzles scripts are a great introduction to more realistic and complex Bitcoin Scripts. They demonstrate the power of the mathematical and stack functions in Bitcoin Script and how they can be carefully combined to create questions that require very specific answers. However, their real-world usage is also limited by the security issues inherent in non-signed Bitcoin transactions.
|
||||
|
||||
_What is the power of puzzle script?_ Despite their limitations, puzzles scripts have been used in the real world as the prizes for computational bounties. Anyone who can figure out a complex puzzle, whose solution presmably has some real-world impact, can win the bounty. Whether they get to actually keep it is another question.
|
||||
_What is the power of puzzle script?_ Despite their limitations, puzzles scripts have been used in the real world as the prizes for computational bounties. Anyone who can figure out a complex puzzle, whose solution presumably has some real-world impact, can win the bounty. Whether they get to actually keep it is another question.
|
||||
|
||||
## What's Next?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user