This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//original script | |
//0 IF 1 IF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 1 IF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL | |
//OP_IF RULE | |
//If the top stack value is not 0, the statements are executed. The top stack value is removed. | |
//OP_ELSE RULE | |
//If the preceding OP_IF or OP_NOTIF or OP_ELSE was not executed then these statements are and | |
//if the preceding OP_IF or OP_NOTIF or OP_ELSE was executed then these statements are not. | |
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1 OP_IF, OP_IF, OP_1, OP_ELSE, OP_0, OP_ENDIF, OP_ELSE, OP_IF, OP_0, OP_ELSE, OP_1, OP_ENDIF, OP_ENDIF | |
1 | |
OP_IF | |
OP_IF | |
OP_1 | |
OP_ELSE | |
OP_0 | |
OP_ENDIF | |
OP_ELSE | |
OP_IF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//"0", "IF 1 IF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 1 IF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL | |
0 | |
OP_IF | |
1 | |
OP_IF | |
OP_RETURN | |
OP_ELSE | |
OP_RETURN | |
OP_ELSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//OP_0 OP_IF,OP_1, OP_IF,OP_RETURN, OP_ELSE, OP_RETURN, OP_ELSE, OP_RETURN,OP_ENDIF, | |
//OP_ELSE, OP_1,OP_IF,OP_1,OP_ELSE, | |
//OP_RETURN,OP_ELSE,OP_1,OP_ENDIF, OP_ELSE,OP_RETURN,OP_ENDIF,OP_ADD,OP_2,OP_EQUAL | |
OP_0 | |
OP_IF | |
OP_1 | |
OP_IF | |
OP_RETURN | |
OP_ELSE | |
OP_RETURN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); | |
ss << tx; | |
printf("Transaction: %s\n", HexStr(ss).c_str()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chris@chris:~/.../src/test$ ./test_bitcoin -t script_tests/script_valid | |
Running 1 test case... | |
tests: [["Automatically generated test cases"],["0x47 0x304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001","0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG","","P2PK"]] | |
Transaction: 01000000019ce5586f04dd407719ab7e2ed3583583b9022f29652702cfac5ed082013461fe000000004847304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001ffffffff0100000000000000000000000000 | |
Done | |
*** No errors detected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Shows how to print a bitcoin script to stdout | |
#include <iostream> | |
#include "core_write.h" | |
cout << "Script being executed: " << ScriptToAsmStr(script) << std::endl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//prints the op code being executed & the stack state BEFORE op code execution | |
#include "utilstrencodings.h" | |
#include "streams.h" | |
#include "script.h" | |
cout << "Op being executed: " << GetOpName(opcode) << "\n"; | |
for (unsigned int i = 0; i < stack.size(); i++) { | |
for (unsigned int j = 0; j < stack[i].size(); j++) { | |
ss << stack[i][j]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script being executed: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c07703 02d5c25adb51b61339d2b05315791e21bbe80ea470a49db0135720983c905aace0 | |
Op being executed: OP_UNKNOWN | |
Stack: | |
Op being executed: OP_UNKNOWN | |
Stack: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c0770320 | |
Script being executed: OP_DUP OP_HASH160 e52b482f2faa8ecbf0db344f93c84ac908557f33 OP_EQUALVERIFY OP_CHECKSIG | |
Op being executed: OP_DUP | |
Stack: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c077032002d5c25adb51b61339d2b05315791e21bbe80ea470a49db0135720983c905aace020 | |
Op being executed: OP_HASH160 | |
Stack: 3045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c077032002d5c25adb51b61339d2b053157 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait BlockchainElementsGenerator { | |
def block : Gen[Block] = for { | |
header <- blockHeader | |
txs <- Gen.listOfN(randomNumber(10), TransactionGenerators.transactions) | |
} yield Block(header, txs) | |
def blockHeader : Gen[BlockHeader] = for { | |
version <- NumberGenerator.uInt32s | |
previousBlockHash <- CryptoGenerators.doubleSha256Digest |
OlderNewer