class ArkEcosystem::Crypto::Identities::Address
The identity utility for an address.
Public Class Methods
from_passphrase(passphrase, network = nil)
click to toggle source
# File lib/arkecosystem/crypto/identities/address.rb, line 9 def self.from_passphrase(passphrase, network = nil) private_key = PrivateKey.from_passphrase(passphrase) from_private_key(private_key, network) end
from_private_key(private_key, network = nil)
click to toggle source
# File lib/arkecosystem/crypto/identities/address.rb, line 21 def self.from_private_key(private_key, network = nil) network ||= ArkEcosystem::Crypto::Configuration::Network.get public_key = Digest::RMD160.digest(private_key.public_key) version = if network.is_a? Integer network else network.version end BTC::Base58.base58check_from_data([version].pack('c') + public_key) end
from_public_key(public_key, network = nil)
click to toggle source
# File lib/arkecosystem/crypto/identities/address.rb, line 15 def self.from_public_key(public_key, network = nil) private_key = BTC::Key.new(public_key: [public_key].pack('H*')) from_private_key(private_key, network) end
validate(address)
click to toggle source
# File lib/arkecosystem/crypto/identities/address.rb, line 35 def self.validate(address) BTC::Address.parse(address) end