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§
- Account
Entry - Represents a node announcement entry on the block chain. This contains node’s public key and optional announcement information (multiaddress, block number).
- Acknowledged
Ticket - Contains acknowledgment information and the respective ticket
- Acknowledgement
- Represents packet acknowledgement
- Address
- Represents an Ethereum address
- Announcement
Data - 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) - Application
Data - Represents the received decrypted packet carrying the application-layer data.
- Atomic
Hopr State - A wrapper around
HoprState
which can be safely shared between threads. - Balance
- Represents balance of some coin or token.
- Chain
Network - Holds all information about the protocol network to be used by the client
- Channel
Entry - Overall description of a channel
- Close
Channel Result - Date
Time - ISO 8601 combined date and time with time zone.
- Ethereum
Challenge - Represents and Ethereum challenge. This is a one-way encoding of the secp256k1 curve point to an Ethereum address.
- Graph
Export Config - Configuration for the DOT export of the
ChannelGraph
. - Half
KeyChallenge - 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
- Hopr
Incoming Session - Wrapper for incoming Session along with other information extracted from the Start protocol during the session establishment.
- Hopr
Offchain Keypair - Represents a keypair consisting of an Ed25519 private and public key
- Hopr
Session - Hopr
Session Id - Unique ID of a specific session.
- Hopr
Socket - Represents the socket behavior of the hopr-lib spawned
Hopr
object. - Host
Config - Configuration of the listening host.
- KeyBinding
- Holds the signed binding of the chain key and the packet key.
- Multiaddr
- Representation of a Multiaddr.
- Network
Contract Addresses - NoSumSMA
- Basic implementation of Simple Moving Average (SMA).
- Open
Channel Result - PeerId
- Identifier of a peer of the network.
- Protocols
Config - The entire on-chain protocol configuration containing the information about usable networks and chains.
- Redeemable
Ticket - Represents a winning ticket that can be successfully redeemed on chain.
- Serializable
Log - A type containing selected fields from the
eth_getLogs
RPC calls. - Session
Client Config - Configuration for the session.
- Single
SumSMA - Basic implementation of Simple Moving Average (SMA).
- TagBloom
Filter - Bloom filter for packet tags to detect packet replays.
- Ticket
- Contains the overall description of a ticket with a signature.
- Ticket
Builder - Builder for Ticket and VerifiedTicket.
- Ticket
Statistics - Ticket statistics data exposed by the ticket mechanism.
- Transferable
Winning Ticket - Represents a ticket that could be transferred over the wire and independently verified again by the other party.
- Unacknowledged
Ticket - 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).
- Verified
Ticket - Holds a ticket that has been already verified.
This structure guarantees that
Ticket::get_hash()
ofVerifiedTicket::verified_ticket()
is always equal toVerifiedTicket::verified_hash
Enums§
- Account
Type - Type of the node account.
- Acknowledged
Ticket Status - Status of the acknowledged ticket.
- Balance
Type - Represents a type of the balance: native or HOPR tokens.
- Chain
Actions Error - Enumerates all Chain Actions related errors.
- Channel
Change - Enumerates possible changes on a channel entry update
- Channel
Direction - Describes a direction of node’s own channel. The direction of a channel that is not own is undefined.
- Channel
Status - Describes status of a channel
- Core
Types Error - Enumeration of all core type related errors.
- Environment
Type - Types of HOPR network environments.
- General
Error - 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.
- Hopr
LibProcesses - Enum differentiator for loop component futures.
- Hopr
State - An enum representing the current state of the HOPR node
- Hopr
Transport Error - Errors produced by the crate.
- Host
Type - Enumeration of possible host types.
- IpProtocol
- Lists some of the IP protocols.
- Networking
Error - Errors that can be generated by the crate.
- Pending
Acknowledgement - 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.
- Protocol
Error - Errors generated by the crate.
- Routing
Options - Represents routing options in a mixnet with a maximum number of hops.
- Session
Capability - Capabilities of a session.
- Session
Target - 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.
Constants§
- ALWAYS_
WINNING - Encodes 100% winning probability
- DEFAULT_
APPLICATION_ TAG - Represent a default application tag if none is specified in
send_packet
. - 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
- DEFAULT_
OUTGOING_ TICKET_ WIN_ PROB - Default ticket winning probability that will be printed on outgoing tickets
- INTERMEDIATE_
HOPS - Number of intermediate hops: 3 relayers and 1 destination
- LOWEST_
POSSIBLE_ WINNING_ PROB - The lowest possible ticket winning probability due to SC representation limit.
- NEVER_
WINNING - Encodes 0% winning probability
- PAYLOAD_
SIZE - Maximum size of the packet payload in bytes.
- RESERVED_
TAG_ UPPER_ LIMIT - SESSION_
USABLE_ MTU_ SIZE - Inner MTU size of what the HOPR payload can take (payload - peer_id - application_tag)
Traits§
- AsUnix
Timestamp - A trait that adds extension method to represent a time object as
Duration
since Unix epoch. - Bytes
Encodable - 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. - Bytes
Representable - 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.
- Hopr
Session Reactor - Interface representing the HOPR server behavior for each incoming session instance supplied as an argument.
- Into
Endian - 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.
- Saturating
Sub - 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.
- Unitary
Float Ops - 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.
- f64_
to_ win_ prob - Encodes [0.0f64, 1.0f64] to [0x00000000000000, 0xffffffffffffff]
- generate_
channel_ id - Generates channel ID hash from
source
anddestination
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.
- win_
prob_ to_ f64 - Decodes [0x00000000000000, 0xffffffffffffff] to [0.0f64, 1.0f64]
Type Aliases§
- Encoded
WinProb - Winning probability encoded in 7-byte representation
- Service
Id - Describes a node service target.
These are specialized
SessionTargets
that are local to the Exit node and have different purposes, such as Cover Traffic. - Tag
- Tags are currently 16-bit unsigned integers
- U256