Created
January 28, 2021 13:58
-
-
Save azuchi/f4b8e996f70ec20f55b7cf8898f1cfe9 to your computer and use it in GitHub Desktop.
Bitcoinのホワイトペーパーをチェーン上からデコードするプログラム
This file contains hidden or 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
tx = Bitcoin::Tx.parse_from_payload('Tx 54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713のHexデータ').htb) | |
File.open('bitcoin.pdf', mode = 'w') do |f| | |
tx.outputs[0...-2].map.with_index do |o, i| | |
data = o.script_pubkey.get_multisig_pubkeys.map.with_index do |p, j| | |
if i == 0 && j ==0 | |
p[(p.index("%PDF-"))..-1] | |
elsif i == 945 | |
p[0...-8] | |
else | |
p | |
end | |
end.join | |
f.write data | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment