Crate sn_transfers

Crate sn_transfers 

Source

Re-exports§

pub use genesis::GENESIS_CASHNOTE;
pub use genesis::GENESIS_PK;
pub use genesis::GENESIS_SPEND_UNIQUE_KEY;
pub use bls;
pub use bls::rand;

Modules§

rng
This is a helper module to make it a bit easier and regular for API callers to instantiate an Rng when calling sn_transfers methods that require them.

Structs§

CashNote
Types used in the public API Represents a CashNote (CashNote).
CashNoteRedemption
Unspent Transaction (Tx) Output Information can be used by the Tx recipient of this output to check that they received money and to spend it
Ciphertext
An encrypted message.
DEFAULT_NETWORK_ROYALTIES_PK
DEFAULT_PAYMENT_FORWARD_SK
DerivationIndex
Types used in the public API This is used to generate a new UniquePubkey from a MainPubkey, and the corresponding DerivedSecretKey from the MainSecretKey of that MainPubkey.
DerivedSecretKey
Types used in the public API This is the key that unlocks the value of a CashNote. Holding this key gives you access to the tokens of the CashNote with the corresponding UniquePubkey. Like with the keys to your house or a safe, this is not something you share publicly.
FOUNDATION_PK
GENESIS_CASHNOTE
Utilities exposed Load the genesis CashNote. The genesis CashNote is the first CashNote in the network. It is created without a source transaction, as there was nothing before it.
GENESIS_PK
Utilities exposed
GENESIS_SPEND_UNIQUE_KEY
Utilities exposed This is the unique key for the genesis Spend
Hash
Types used in the public API sha3 256 hash used for Spend Reasons, Transaction hashes, anything hash related in this crate
HotWallet
A hot-wallet.
MainPubkey
Types used in the public API This is the MainPubkey to which tokens are send.
MainSecretKey
Types used in the public API A CashNote MainSecretKey is held by anyone who wants to send or receive tokens using CashNotes. It is held privately and not shared with anyone.
NETWORK_ROYALTIES_PK
NanoTokens
Types used in the public API An amount in SNT Nanos. 10^9 Nanos = 1 SNT.
PAYMENT_FORWARD_PK
Payment
PaymentQuote
A payment quote to store data given by a node to a client Note that the PaymentQuote is a contract between the node and itself to make sure the clients aren’t mispaying. It is NOT a contract between the client and the node.
QuotingMetrics
Quoting metrics that got used to generate a quote, or to track peer’s status.
Signature
A signature.
SignedSpend
Types used in the public API SignedSpends are the core of the Network’s transaction system. They are the data type on the Network used to commit to a transfer of value. Analogous to a transaction in Bitcoin. They are signed piece of data proving the owner’s commitment to transfer value. Spends refer to their ancestors and descendants, forming a directed acyclic graph that starts from Genesis.
SignedTransaction
A local transaction that has been signed and is ready to be executed on the Network
Spend
Types used in the public API Represents a spent UniquePubkey on the Network. When a CashNote is spent, a Spend is created with the UniquePubkey of the CashNote. It is then sent to the Network along with the signature of the owner using the DerivedSecretKey matching its UniquePubkey. A Spend can have multiple ancestors (other spends) which will refer to it as a descendant. A Spend’s value is equal to the total value given by its ancestors, which one can fetch on the Network to check. A Spend can have multiple descendants (other spends) which will refer to it as an ancestor. A Spend’s value is equal to the total value of given to its descendants.
SpendAddress
Types used in the public API The address of a SignedSpend in the network. This is used to check if a CashNote is spent, note that the actual CashNote is not stored on the Network.
UniquePubkey
Types used in the public API A Unique Public Key is the unique identifier of a CashNote and its SignedSpend on the Network when it is spent. It is the mechanism that makes transactions untraceable to the real owner (MainPubkey). It is the equivalent to using a different key for each transaction in bitcoin.
UnsignedTransaction
A local transaction that has not been signed yet All fields are private to prevent bad useage
WalletApi
Contains some common API’s used by wallet implementations.
WatchOnlyWallet
This assumes the CashNotes are stored on disk

Enums§

GenesisError
Utilities exposed Main error type for the crate.
SpendReason
Types used in the public API The attached metadata or reason for which a Spend was spent
Transfer
Transfer sent to a recipient
TransferError
Transfer errors
WalletError
Transfer errors.

Constants§

GENESIS_INPUT_DERIVATION_INDEX
Utilities exposed The input derivation index for the genesis Spend.
GENESIS_OUTPUT_DERIVATION_INDEX
Utilities exposed The output derivation index for the genesis Spend.
QUOTE_EXPIRATION_SECS
The time in seconds that a quote is valid for
TOTAL_SUPPLY
Utilities exposed Total supply of tokens that will eventually exist in the network: 4,294,967,295 * 10^9 = 4,294,967,295,000,000,000.
WALLET_DIR_NAME

Functions§

bls_secret_from_hex
Construct a BLS secret key from a hex-encoded string.
calculate_royalties_fee
Utilities exposed Based on the given store cost, it calculates what’s the expected amount to be paid as network royalties. Network royalties fee is expected to be 15% of the payment amount, i.e. 85% of store cost + 15% royalties fees.
create_first_cash_note_from_key
Utilities exposed Create a first CashNote given any key (i.e. not specifically the hard coded genesis key). The derivation index is hard coded to ensure deterministic creation. This is useful in tests.
get_faucet_data_dir
Utilities exposed
get_genesis_sk
Utilities exposed Returns genesis SK (normally for testing purpose).
is_genesis_spend
Utilities exposed Return if provided Spend is genesis spend.
load_genesis_wallet
Utilities exposed
wallet_lockfile_name
Returns the wallet lockfile filename

Type Aliases§

Result
Specialisation of std::Result.
WalletResult
Specialisation of std::Result.