Bitcoin AMiens
"Script : le language de programmation de bitcoin"
Amiens, France
Lola
"Script est un simple langage à pile qui se lit de gauche à droite. Il est intentionnellement non-Turing complet et ne comporte pas de boucle."
Tant que (condition) {
instruction 1
instruction 2
instruction 3
...
}
Une boucle.
Programmation à pile.
Une Transaction Bitcoin
Input:
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6
Index: 0
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501
Output:
Value: 5000000000
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d
OP_EQUALVERIFY OP_CHECKSIG
script condition :
OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d
OP_EQUALVERIFY OP_CHECKSIG
Script solution :
304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501
Condition qui nous permet de dépenser nos bitcoins
opcodes
scriptPubKey:
OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig:
<sig> <pubKey>
OPCODE | DESCRIPTION |
---|---|
OP_DUP | Prend le premier élément de la pile et le copie |
OP_HASH160 | Hash le premier élément de la pile |
OP_EQUALVERIFY | Vérifie que les deux permiers éléments de la pile sont égaux |
OP_CHECKSIG | Vérifie la signature |
<sig>
<pubKey>
OP_DUP
OP_HASH160
<pubKeyHash>
OP_EQUALVERIFY
OP_CHECKSIG
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
<pubKey>
OP_DUP
OP_HASH160
<pubKeyHash>
OP_EQUALVERIFY
OP_CHECKSIG
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| <sig> |
| |
* --------------------------------------------- *
OP_DUP
OP_HASH160
<pubKeyHash>
OP_EQUALVERIFY
OP_CHECKSIG
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| <pubKey> |
| |
* --------------------------------------------- *
| |
| <sig> |
| |
* --------------------------------------------- *
OP_HASH160
<pubKeyHash>
OP_EQUALVERIFY
OP_CHECKSIG
OP_DUP
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| <pubKey> |
| |
* --------------------------------------------- *
| |
| <pubKey> |
| |
* --------------------------------------------- *
| |
| <sig> |
| |
* --------------------------------------------- *
<pubKeyHash>
OP_EQUALVERIFY
OP_CHECKSIG
OP_HASH160
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| <pubKeyHash> |
| |
* --------------------------------------------- *
| |
| <pubKey> |
| |
* --------------------------------------------- *
| |
| <sig> |
| |
* --------------------------------------------- *
OP_EQUALVERIFY
OP_CHECKSIG
* --------------------------------------------- *
| |
| <pubKeyHash> |
| |
* --------------------------------------------- *
| |
| <pubKeyHash> |
| |
* --------------------------------------------- *
| |
| <pubKey> |
| |
* --------------------------------------------- *
| |
| <sig> |
| |
* --------------------------------------------- *
OP_CHECKSIG
OP_EQUALVERIFY
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| <pubKey> |
| |
* --------------------------------------------- *
| |
| <sig> |
| |
* --------------------------------------------- *
OP_CHECKSIG
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| |
| |
* --------------------------------------------- *
| |
| TRUE |
| |
* --------------------------------------------- *
pay-to-pubkey-hash
scriptPubKey:
OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig:
<sig> <pubKey>
Anyone-Can-Spend
scriptPubKey:
(empty)
scriptSig:
OP_TRUE
LOCKTIME SCRIPT
scriptPubKey:
<expiry time> OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig:
<sig> <pubKey>
pay-to-pubkey (obsolete)
scriptPubKey:
<pubKey> OP_CHECKSIG
scriptSig:
<sig>
SCript PUZZLE
scriptPubKey:
OP_HASH256 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 OP_EQUAL
Double hash du genesis block
scriptPubKey:
OP_2DUP OP_EQUAL OP_NOT OP_VERIFY OP_SHA1 OP_SWAP OP_SHA1 OP_EQUAL
Colision sha1 (trouvé par google en 2017)
Conclusion
Bitcoin a un langage de programmation.
Bitcoin Amiens
Meetup Bitcoin à Amiens :
Discord :
Twitter :
BItcoin Amiens : Script
By Lola Rigaut-Luczak
BItcoin Amiens : Script
- 378