aea.helpers.multiaddr.base¶
This module contains multiaddress class.
MultiAddr Objects¶
Protocol Labs' Multiaddress representation of a network address.
__
init__
¶
def __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.