Sha256: ad33698bb41445f6d2ed21cf93767937027c81ab15dbbbd3f8adda6f99a1555c
Contents?: true
Size: 617 Bytes
Versions: 8
Compression:
Stored size: 617 Bytes
Contents
module Bitcoin module Wallet class DB def save_key(account, purpose, index, key) pubkey = key.pub id = [account.purpose, account.index, purpose, index].pack('I*').bth k = KEY_PREFIX[:key] + id script_pubkey = Bitcoin::Script.to_p2wpkh(Bitcoin.hash160(pubkey)).to_payload.bth k2 = 'p' + script_pubkey level_db.put(k, pubkey) level_db.put(k2, id) key end def get_key_index(script_pubkey) k = 'p' + script_pubkey id = level_db.get(k) return unless id id.htb.unpack('I*') end end end end
Version data entries
8 entries across 8 versions & 1 rubygems