-
Notifications
You must be signed in to change notification settings - Fork 0
/
src.cpp
21 lines (16 loc) · 670 Bytes
/
src.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <bitcoin/bitcoin.hpp>
int main() {
// Public key hash (20 bytes)
const std::string pubkey_hash = "3c3fa3d4adcaf8f52d5b1843975e122548269937";
// Create the script
bc::data_chunk script_data;
script_data.push_back(bc::machine::opcode::dup);
script_data.push_back(bc::machine::opcode::hash160);
script_data.push_back(bc::make_chunk(bc::hash_literal(pubkey_hash)));
script_data.push_back(bc::machine::opcode::equalverify);
script_data.push_back(bc::machine::opcode::checksig);
bc::script p2pkh_script(script_data);
std::cout << "P2PKH script: " << bc::encode_base16(p2pkh_script.to_data()) << std::endl;
return 0;
}