Class: Mastercoin::Util

Inherits:
Object
  • Object
show all
Defined in:
lib/mastercoin-ruby/util.rb

Class Method Summary collapse

Class Method Details

.get_sequence(bitcoin_address) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/mastercoin-ruby/util.rb', line 13

def self.get_sequence(bitcoin_address)
  decoded = Bitcoin.decode_base58(bitcoin_address)

  seq = decoded[2..3].to_i(16) - 1
  if seq > 255
    seq -= 255
  end

  return seq
end

.valid_ecdsa_point?(pub_key) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
# File 'lib/mastercoin-ruby/util.rb', line 3

def self.valid_ecdsa_point?(pub_key)
  begin
    Bitcoin::Key.new(nil, pub_key).addr
  rescue OpenSSL::PKey::EC::Point::Error
    return false
  end

  return true
end