MsgAddr class

Bitcoin address message for sharing peer addresses This message is used to provide information about other peers on the network. It can be sent unsolicited or in response to a getaddr message.

Inheritance

Constructors

MsgAddr({List<NetworkAddress>? addressList})
MsgAddr.single(NetworkAddress address)
Create address message with single address
factory

Properties

addressList List<NetworkAddress>
getter/setter pair
command String
Get the command string for this message type
no setteroverride
hashCode int
The hash code for this object.
no setteroverride
ipv4Addresses List<NetworkAddress>
Get IPv4 addresses only
no setter
maxPayloadLength int
Get maximum payload length for this message type
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addAddress(NetworkAddress address) → void
Add a network address
addAll(List<NetworkAddress> addresses) → void
Add multiple addresses
contains(String ip, int port) bool
Check if contains a specific address
decode(Uint8List data, int protocolVersion, MessageEncoding encoding) → void
Decode message from bytes
override
deduplicate() → void
Get unique addresses (remove duplicates by IP:port)
encode(int protocolVersion, MessageEncoding encoding) Uint8List
Encode message to bytes
override
filterValid({int? maxAge, bool requireReachable = true}) → void
Filter out addresses that are too old or invalid
getByServices(int services) List<NetworkAddress>
Get addresses supporting specific services
getRecentAddresses(int maxAgeSeconds) List<NetworkAddress>
Get addresses from the last N seconds
getServiceStatistics() Map<String, int>
Get count of addresses by service flags
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeOlderThan(int timestamp) → void
Remove addresses older than specified timestamp
serialize(int protocolVersion, BitcoinNetwork network) Uint8List
Serialize complete message with header
inherited
sortByRecency() → void
Sort addresses by recency (newest first)
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

deserialize(Uint8List data, int protocolVersion, MessageEncoding encoding) MsgAddr
Factory method for deserialization
registerWithFactory() → void
Register this message type with the factory