class Ciri::P2P::NodeID

present node id

Attributes

key[R]
public_key[R]

Public Class Methods

from_raw_id(raw_id) click to toggle source
# File lib/ciri/p2p/node.rb, line 34
def from_raw_id(raw_id)
  NodeID.new(Ciri::Key.new(raw_public_key: "\x04".b + raw_id))
end
new(public_key) click to toggle source
# File lib/ciri/p2p/node.rb, line 43
def initialize(public_key)
  unless public_key.is_a?(Ciri::Key)
    raise TypeError.new("expect Ciri::Key but get #{public_key.class}")
  end
  @public_key = public_key
end

Public Instance Methods

==(other) click to toggle source
# File lib/ciri/p2p/node.rb, line 56
def == (other)
  self.class == other.class && id == other.id
end
id() click to toggle source
# File lib/ciri/p2p/node.rb, line 50
def id
  @id ||= key.raw_public_key[1..-1]
end
Also aliased as: to_bytes
short_hex() click to toggle source
# File lib/ciri/p2p/node.rb, line 66
def short_hex
  @short_hex ||= to_hex[0..8]
end
to_bytes()
Alias for: id
to_hex() click to toggle source
# File lib/ciri/p2p/node.rb, line 60
def to_hex
  Ciri::Utils.to_hex id
end
Also aliased as: to_s
to_s()
Alias for: to_hex