Crate hopr_lib

Source
Expand description

HOPR library creating a unified Hopr object that can be used on its own, as well as integrated into other systems and libraries.

The Hopr object is standalone, meaning that once it is constructed and run, it will perform its functionality autonomously. The API it offers serves as a high-level integration point for other applications and utilities, but offers a complete and fully featured HOPR node stripped from top level functionality such as the REST API, key management…

The intended way to use hopr_lib is for a specific tool to be built on top of it; should the default hoprd implementation not be acceptable.

For most of the practical use cases, the hoprd application should be a preferable choice.

Modules§

config
Configuration-related public types
constants
Various public constants.
errors
Lists all errors thrown from this library.

Structs§

AccountEntry
Represents a node announcement entry on the block chain. This contains node’s public key and optional announcement information (multiaddress, block number).
AcknowledgedTicket
Contains acknowledgment information and the respective ticket
Acknowledgement
Represents packet acknowledgement
Address
Represents an Ethereum address
AnnouncementData
Structure containing data used for an on-chain announcement. That is the decapsulated multiaddress (with the /p2p/{peer_id} suffix removed) and optional KeyBinding (an announcement can be done with key bindings or without)
ApplicationData
Represents the received decrypted packet carrying the application-layer data.
AtomicHoprState
A wrapper around HoprState which can be safely shared between threads.
Balance
Represents a non-negative balance of some Currency.
ChainNetwork
Holds all information about the protocol network to be used by the client
ChannelEntry
Overall description of a channel
CloseChannelResult
DateTime
ISO 8601 combined date and time with time zone.
EthereumChallenge
Represents and Ethereum challenge. This is a one-way encoding of the secp256k1 curve point to an Ethereum address.
GraphExportConfig
Configuration for the DOT export of the [ChannelGraph].
HalfKeyChallenge
Represents a challenge for the half-key in Proof of Relay. Half-key challenge is equivalent to a secp256k1 curve point. Therefore, HalfKeyChallenge can be obtained from a HalfKey.
Hopr
HOPR main object providing the entire HOPR node functionality
HoprIncomingSession
Wrapper for incoming Session along with other information extracted from the Start protocol during the session establishment.
HoprOffchainKeypair
Represents a keypair consisting of an Ed25519 private and public key
HoprSession
HoprSessionId
Unique ID of a specific Session in a certain direction.
HoprSocket
Represents the socket behavior of the hopr-lib spawned Hopr object.
HostConfig
Configuration of the listening host.
KeyBinding
Holds the signed binding of the chain key and the packet key.
KeyIdent
Identifier of public keys.
Multiaddr
Representation of a Multiaddr.
NetworkContractAddresses
NoSumSMA
Basic implementation of Simple Moving Average (SMA).
OpenChannelResult
PeerId
Identifier of a peer of the network.
PingQueryReplier
Helper object allowing to send a ping query as a wrapped channel combination that can be filled up on the transport part and awaited locally by the Pinger.
ProtocolsConfig
The entire on-chain protocol configuration containing the information about usable networks and chains.
RedeemableTicket
Represents a winning ticket that can be successfully redeemed on-chain.
SerializableLog
A type containing selected fields from the eth_getLogs RPC calls.
SessionClientConfig
Configuration for the session.
SingleSumSMA
Basic implementation of Simple Moving Average (SMA).
SurbBalancerConfig
Configuration for the [SurbBalancer].
Ticket
Contains the overall description of a ticket with a signature.
TicketBuilder
Builder for Ticket and VerifiedTicket.
TicketStatistics
Ticket statistics data exposed by the ticket mechanism.
TransferableWinningTicket
Represents a ticket that could be transferred over the wire and independently verified again by the other party.
UnacknowledgedTicket
Represents a VerifiedTicket with an unknown other part of the [HalfKey]. Once the other [HalfKey] is known (forming a [Response]), it can be acknowledged.
Utc
The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
VerifiedTicket
Holds a ticket that has been already verified. This structure guarantees that Ticket::get_hash() of VerifiedTicket::verified_ticket() is always equal to VerifiedTicket::verified_hash
WinningProbability
Represents a ticket winning probability.
WxHOPR
Represents wxHOPR token Currency.
XDai
Represents xDai coin Currency.

Enums§

AccountType
Type of the node account.
AcknowledgedTicketStatus
Status of the acknowledged ticket.
ChainActionsError
Enumerates all Chain Actions related errors.
ChannelChange
Lists possible changes on a channel entry update
ChannelDirection
Describes a direction of node’s own channel. The direction of a channel that is not own is undefined.
ChannelStatus
Describes status of a channel
CoreTypesError
Enumeration of all core type related errors.
DestinationRouting
Routing information containing forward or return routing options.
EnvironmentType
Types of HOPR network environments.
GeneralError
Listing of some general re-usable errors
Health
Network health represented with colors, where green is the best and red is the worst possible observed nework quality.
HoprLibProcesses
Enum differentiator for loop component futures.
HoprState
An enum representing the current state of the HOPR node
HoprTransportError
Errors produced by the crate.
HostType
Enumeration of possible host types.
IpProtocol
Lists some of the IP protocols.
NetworkingError
Errors that can be generated by the crate.
PendingAcknowledgement
Contains either unacknowledged ticket if we’re waiting for the acknowledgement as a relayer or information if we wait for the acknowledgement as a sender.
ProbeError
ProtocolError
Errors generated by the crate.
RoutingOptions
Represents routing options in a mixnet with a maximum number of hops.
SessionCapability
Individual capabilities of a Session.
SessionTarget
Defines what should happen with the data at the recipient where the data from the established session are supposed to be forwarded to some target.
Strategy
Lists all possible strategies with their respective configurations.
Tag
Tags are represented by 8 bytes (u64`).

Constants§

DEFAULT_MAXIMUM_INCOMING_TICKET_WIN_PROB
Default maximum incoming ticket winning probability, above which tickets will not be accepted due to privacy.
DEFAULT_MINIMUM_INCOMING_TICKET_WIN_PROB
Default required minimum incoming ticket winning probability
INTERMEDIATE_HOPS
Number of intermediate hops: 3 relayers and 1 destination
REDEEM_CALL_SELECTOR
Define the selector for the redeemTicketCall to avoid importing the entire hopr-bindings crate for one single constant. This value should be updated with the function interface changes.
SESSION_PAYLOAD_SIZE
Number of bytes that can be sent in a single Session protocol payload.

Traits§

AsUnixTimestamp
A trait that adds extension method to represent a time object as Duration since Unix epoch.
BytesEncodable
Represents a type that can be encoded to/decoded from a fixed sized byte array of size N. This requires processing and memory allocation to represent the type in binary encoding.
BytesRepresentable
Represents a type that is already internally represented by a fixed size byte array, and therefore requires no memory allocation to represent the type in binary encoding.
Currency
Represents a general currency - like a token or a coin.
HoprSessionReactor
Interface representing the HOPR server behavior for each incoming session instance supplied as an argument.
IntoEndian
Extension trait for fixed size numbers to allow conversion to/from endian representations.
Keypair
Represents a generic key pair The keypair contains a private key and public key. Must be comparable in constant time and zeroized on drop.
SMA
Simple Moving Average trait.
SaturatingSub
A trait that adds extension method to perform saturated substractions on SystemTime instances.
SendMsg
ToHex
A generic type that can be converted to a hexadecimal string.
UnitaryFloatOps
Allows type to be multiplied and divided by a float in range [0.0, 1.0].

Functions§

chain_events_to_transport_events
Creates a pipeline that chains the indexer-generated data, processes them into the individual components, and creates a filtered output stream that is fed into the transport layer swarm.
decapsulate_multiaddress
Decapsulates the multiaddress (= strips the /p2p/<peer_id> suffix). If it is already decapsulated, the function is an identity.
f64_approx_eq
Approximately compares two double-precision floats.
generate_channel_id
Generates channel ID hash from source and destination addresses.
looks_like_domain
Check whether the string looks like a valid domain.
transfer_session
Convenience function to copy data in both directions between a Session and arbitrary async IO stream. This function is only available with Tokio and will panic with other runtimes.

Type Aliases§

ChannelId
Alias for the [Hash] representing a channel ID.
EncodedWinProb
Winning probability encoded in 7-byte representation
HoprBalance
HoprPseudonym
Alias for the Pseudonym used in the HOPR protocol.
ServiceId
Describes a node service target. These are specialized SessionTargets that are local to the Exit node and have different purposes, such as Cover Traffic.
SessionCapabilities
Set of Session capabilities.
U256
XDaiBalance

Attribute Macros§

async_trait