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 a non-negative balance of some
Currency
. - 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 in a certain direction.
- 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.
- KeyIdent
- Identifier of public keys.
- 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.
- Ping
Query Replier - 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
. - 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).
- Surb
Balancer Config - Configuration for the [
SurbBalancer
]. - 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
- Winning
Probability - Represents a ticket winning probability.
- WxHOPR
- Represents wxHOPR token
Currency
. - XDai
- Represents xDai coin
Currency
.
Enums§
- Account
Type - Type of the node account.
- Acknowledged
Ticket Status - Status of the acknowledged ticket.
- Chain
Actions Error - Enumerates all Chain Actions related errors.
- Channel
Change - Lists 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.
- Destination
Routing - Routing information containing forward or return routing options.
- 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.
- Probe
Error - Protocol
Error - Errors generated by the crate.
- Routing
Options - Represents routing options in a mixnet with a maximum number of hops.
- Session
Capability - Individual 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.
- 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§
- 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.
- Currency
- Represents a general currency - like a token or a coin.
- 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.
- 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.
Type Aliases§
- Channel
Id - Alias for the [
Hash
] representing a channel ID. - Encoded
WinProb - Winning probability encoded in 7-byte representation
- Hopr
Balance - Hopr
Pseudonym - Alias for the
Pseudonym
used in the HOPR protocol. - 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. - Session
Capabilities - Set of Session capabilities.
- U256
- XDai
Balance