aea.helpers.multiaddr.base
This module contains multiaddress class.
MultiAddr Objects
Protocol Labs' Multiaddress representation of a network address.
__init__
| __init__(host: str, port: int, public_key: Optional[str] = None, multihash_id: Optional[str] = None) -> None
Initialize a multiaddress.
Arguments:
host: ip host of the addressport: port number of the addresspublic_key: hex encoded public key. Must conform to Bitcoin EC encoding standard for Secp256k1multihash_id: a multihash of the public key
compute_peerid
Compute the peer id from a public key.
In particular, compute the base58 representation of libp2p PeerID from Bitcoin EC encoded Secp256k1 public key.
Arguments:
public_key: the public key.
Returns:
the peer id.
from_string
Construct a MultiAddr object from its string format
Arguments:
maddr: multiaddress string
Returns:
multiaddress object
public_key
Get the public key.
peer_id
Get the peer id.
host
Get the peer host.
port
Get the peer port.
format
Canonical representation of a multiaddress.
__str__
Default string representation of a multiaddress.