lib/bitcoin.rb in bitcoin-ruby-0.0.8 vs lib/bitcoin.rb in bitcoin-ruby-0.0.9
- old
+ new
@@ -321,11 +321,11 @@
end
def bitcoin_signed_message_hash(message)
message = message.dup.force_encoding('binary')
- magic = "Bitcoin Signed Message:\n"
+ magic = Bitcoin.network[:message_magic]
buf = Protocol.pack_var_int(magic.bytesize) + magic
buf << Protocol.pack_var_int(message.bytesize) + message
Digest::SHA256.digest(Digest::SHA256.digest(buf))
end
@@ -546,10 +546,11 @@
NETWORKS = {
bitcoin: {
project: :bitcoin,
magic_head: "\xF9\xBE\xB4\xD9",
+ message_magic: "Bitcoin Signed Message:\n",
address_version: "00",
p2sh_version: "05",
privkey_version: "80",
extended_privkey_version: "0488ade4",
extended_pubkey_version: "0488b21e",
@@ -650,10 +651,11 @@
})
NETWORKS[:litecoin] = NETWORKS[:bitcoin].merge({
project: :litecoin,
magic_head: "\xfb\xc0\xb6\xdb",
+ message_magic: "Litecoin Signed Message:\n",
address_version: "30",
p2sh_version: "05",
privkey_version: "b0",
extended_privkey_version: "019d9cfe",
extended_pubkey_version: "019da462",
@@ -722,9 +724,10 @@
})
NETWORKS[:dogecoin] = NETWORKS[:litecoin].merge({
project: :dogecoin,
magic_head: "\xc0\xc0\xc0\xc0",
+ message_magic: "Dogecoin Signed Message:\n",
address_version: "1e",
p2sh_version: "16",
privkey_version: "9e",
extended_privkey_version: "02fac398",
extended_pubkey_version: "02facafd",