Class: Bitcoin::Message::Ping
Overview
ping message class bitcoin.org/en/developer-reference#ping
Constant Summary collapse
- COMMAND =
'ping'
Instance Attribute Summary collapse
-
#nonce ⇒ Object
Returns the value of attribute nonce.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(nonce = SecureRandom.random_number(0xffffffff)) ⇒ Ping
constructor
A new instance of Ping.
- #to_payload ⇒ Object
- #to_response ⇒ Object
Methods inherited from Base
Methods included from Util
#byte_to_bit, #calc_checksum, #decode_base58_address, #double_sha256, #encode_base58_address, #hash160, #hkdf_sha256, #hmac_sha256, #pack_boolean, #pack_var_int, #pack_var_string, #padding_zero, #sha256, #tagged_hash, #unpack_boolean, #unpack_var_int, #unpack_var_int_from_io, #unpack_var_string, #valid_address?
Methods included from HexConverter
Constructor Details
#initialize(nonce = SecureRandom.random_number(0xffffffff)) ⇒ Ping
Returns a new instance of Ping.
12 13 14 |
# File 'lib/bitcoin/message/ping.rb', line 12 def initialize(nonce = SecureRandom.random_number(0xffffffff)) @nonce = nonce end |
Instance Attribute Details
#nonce ⇒ Object
Returns the value of attribute nonce.
10 11 12 |
# File 'lib/bitcoin/message/ping.rb', line 10 def nonce @nonce end |
Class Method Details
.parse_from_payload(payload) ⇒ Object
16 17 18 |
# File 'lib/bitcoin/message/ping.rb', line 16 def self.parse_from_payload(payload) new(payload.unpack1('Q')) end |