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
require 'sidetree' | |
require 'bitcoin' | |
require 'net/http' | |
require 'json' | |
include Bitcoin::Opcodes | |
# 鍵生成 | |
recovery_key = Sidetree::Key.generate | |
update_key = Sidetree::Key.generate | |
signing_key = Sidetree::Key.generate(id: 'signing-key') |
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
# Metadata | |
metadata = 'test_metadata' | |
# convert to hex | |
metadata = metadata.unpack("H*")[0] | |
# transaction | |
tx = Tapyrus::Tx.new | |
# inputは省略 |
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
txid = 'xxxx' | |
tx_payload = Glueby::Internal::RPC.client.getrawtransaction(txid, 0) | |
tx = Tapyrus::Tx.parse_from_payload(tx_payload.htb) | |
op_return_data = nil | |
tx.outputs.each do |txout| | |
next if txout.op_return_data.nil? | |
op_return_data = txout.op_return_data.bth | |
end |