Accessing most services requires resolving a host corresponding the public key of some service provider. This module describes the on-chain component of making this possible.
The Actors module provides a way for member accounts to stake for becoming an actor in the Joystream network, generating a new actor key along the way. This actor key then is used to fulfil the role on behalf of the member.
Due to this structure, discovering a service really means discovering which service-specific endpoint information is associated with an actor key.
The discovery workflow, then, is to retrieve some structured data by providing an actor key, and being able to verify the data has been created by the actor with the help of a cryptographic signature.
As such, the discovery workflow is and should be largely independent on how discovery is performed. The discovery workflow is almost entirely off-chain, but bootstraps from on-chain information.
The publishing workflow does require actors to understand how discovery is performed. This current version uses IPNS as a building block for discovery. The publishing workflow includes modifying on-chain data, albeit relatively rarely.
Discovery
None.
BootstrapEndpoints
: Identifies a URL prefix for querying the discovery system.
IPNSPeerId
: Identifies a peer on the IPFS network, of which IPNS is part.
bootstrapEndpoints
: A vector of bootstrap endpoints maintained by sudo.
PeerIdByAccount
: A map of Account IDs to IPNSPeerId
. The map value also
contains lifetime parameters in order to gracefully remove outdated entries.
AccountInfoLifetime
: A time-to-live for entries in the PeerIdByAccount
table.
Configured from the genesis block.
AccountInfoUpdated
: A mapping from Account ID to IPNSPeerId
was created or
updated. Receiving this event allows client implementations to discard all data
currently cached for the associated Account ID.set_account_info_lifetime
lifetime
: a new lifetime value.Allow root to set the lifetime for entries in the PeerIdByAccount
mapping.
Note that setting this value does not modify
the lifetime of already existing entries, and is only applied to newly
created or updated entries.
AccountInfoLifetime
is updated.
None.
set_bootstrap_endpoints
bootstrapEndpoints
: a vector of URL prefixesAllow root to set the current bootstrap endpoints. Note that the number of endpoints is never expected to grow large, as new nodes are discovered from this set of bootstrap endpoints - therefore always setting the entire vector is sufficient.
bootstrapEndpoints
is updated.
None.
set_ipns_peer_id
origin
: Actor keypeerId
: The IPNS peer ID.Allows actors to set their associated IPNS peer ID for discovery.
peerIdByAccount
is updated to contain the actor key as the key, and the peer
ID as the value.
AccountInfoUpdated
unset_ipns_peer_id
origin
: Actor keyAllows well-behaving actors to clear their IPNS peer ID, e.g. when shutting down.
peerIdByAccount
is updated to remove any value associated with the actor key.
AccountInfoUpdated
Every block, outdated entries are removed and an AccountInfoUpdated
event is
raised for each removed entry.