Crate xand_ledger

Crate xand_ledger 

Source
Expand description

This crate defines our domain models and logic for the xand ledger. IE: This is the code that determines how transactions are validated/processed, as well as the shape of those transactions. It is free of major dependencies and should remain so to provide a clean environment for concentrating on domain code.

Practically speaking this code is consumed in other places for two purposes:

  • Validating transactions (within the substrate runtime)
  • Constructing transactions (everywhere else)

The crate has an std feature that is enabled by default. Disabling the feature allows the crate to compile in no-std mode. The substrate runtime requires this, and no-std support must be maintained.

Re-exports§

pub use curve25519_dalek;

Modules§

crypto
Zero Knowledge Implementation
esig_payload
verifiable_encryption

Structs§

CashConfirmationTransaction
Issued by the trust to confirm a pending create request
ClearRedeemOutput
ClearRedeemRequestTransaction
A clear (non-confidential) redeem request transaction
ClearTransactionOutput
CompactEncryptedSigner
Compact representation of the verifiable signer encryption. Useful to store the encrypted values after proofs have already been verified.
ConfidentialRedeemRequestRecord
CoreCreateRequestTransaction
Encapsulates all the fields of the create request transaction except the signature.
CoreExitingRedeemRequestTransaction
Encapsulates all the details of a ExitingRedeemRequestTransaction other than the proof with signature.
CoreRedeemRequestTransaction
Encapsulates all the details of a RedeemRequestTransaction other than the proof with signature.
CoreSendClaimsTransaction
The CoreTransaction contains all the details of a Transaction except the signature and proof. A serialized version of the CoreTransaction is then signed as part of the main proof. A Transaction contains a CoreTransaction and a proof cum signature.
CreateCancellationTransaction
Issued by the trust (or intrinsically) to cancel an outstanding create request
CreateRequestProcessor
A collection of repositories that when combined are capable of processing create requests, and implement CreateRequestHandler
CreateRequestRecord
A record of a confidential pending create request - a user does not submit this directly, rather it is created and stored as a result of processing a create request transaction.
CreateRequestTransaction
A create request, as issued by a member
CreateRequestTxnInputs
All the (nonrandom) inputs required to construct a CreateRequestTransaction
CurveVector
Encrypted
EncryptionKey
A Encryption key representing the public portion of some private key, and hence a (potential) sender or receiver of encrypted messages.
ExitingRedeemOutput
ExitingRedeemRequestProcessor
ExitingRedeemRequestTransaction
An exiting redeem request transaction
IdentityTag
An piece of info that identifies an entity as a verified participant. Each (applicable) transaction must include one such valid tag (mixed among decoys).
InvalidCancellationReason
KeyImage
There is a unique key-image for every TransactionOutput, but the key-image cannot be efficiently matched with the corresponding TransactionOutput by any polynomial time probabilistic algorithm with a non-negligible probability without using the private key. If a Transaction contains a key-image that has already been used, then the corresponding TransactionOutput has been spent already, which means that the transaction is invalid.
Milliseconds
Milliseconds - often used as millis since epoch to form a timestamp
MonetaryValue
NotAPublicKey
Error type specifying that a public key cannot be derived from Identity Tag
OneTimeKey
Represents a public key that is specific to an individual txo
OpenedTransactionOutput
An OpenedTransactionOutput represents a UTXO and the information needed to reveal/open it.
PrivateExitingRedeemRequestInputs
Inputs for a participant issuing an exiting redeem request
PrivateInputs
PrivateRedeemRequestInputs
Inputs for a participant issuing a redeem request
Proof
PublicInputSet
PublicKey
A cryptographic public key representing a public identity
RedeemCancellationTransaction
Issued by the trust (or intrinsically) to cancel an outstanding redeem request
RedeemFulfillmentTransaction
Issued by the trust to confirm a redeem fulfillment
RedeemOutput
RedeemRequestProcessor
RedeemRequestTransaction
A redeem request transaction
RewardProcessor
SendClaimsOutput
Transfer TxO and associated data
SendClaimsProcessor
SendClaimsTransaction
A send claims transaction representing the transfer of value from one registered member to another
SpendingOutput
TransactionInputSet
A collection of TransactionOutput(s). The are used in a transaction as a collection of inputs that are summed up to make the total value of the transaction. A transaction includes multiple TransactionInputSets, only one of which is the real TransactionInputSet being spent.
TransactionOutput
A transaction output, or TXO, represents a commitment to some value, and information about who owns the right to spend that value (claims).
VectorTuple
VerifiableEncryptionOfSignerKey

Enums§

BannedState
State of banned member
CorrelationIdUsedBy
Expresses reasons a correlation id is already used. Is returned by CorrelationIdRepository::is_used
CreateCancellationReason
The reason a create request was cancelled
EncryptionKeyError
FailureReason
Failures that may occur during transaction validation
LedgerTransaction
All transactions in xand_ledger
MonetaryValueError
RedeemCancellationReason
The reason a redeem request was cancelled
RedeemSigner
TransactionBuilderErrors
TransactionValidationError
TxoStatus
The status of a TransactionOutput
ZkPlmtError

Traits§

BlockInfoRepository
Provides access to info about the currently executing/processing block
CashConfirmationHandler
Implementors are capable of processing cash confirmation transactions
ClearRedeemRequestHandler
Implementors are capable of processing clear redeem request transactions
ClearTransactionOutputRepository
Provides access to information stored in the ledger regarding ClearTransactionOutputs
CorrelationIdRepository
Provides access to information stored in the ledger regarding CorrelationIds
CreateCancellationHandler
Implementors are capable of processing create cancellation transactions
CreateRequestHandler
Implementors are capable of processing create request transactions
CreateRequestRepository
Provides access to and storage of info in the ledger about pending create requests in the form of CreateRequestRecords
DecryptSigner
Dispatcher
A dispatcher is capable of accepting transactions and executing them. This functionality is important because sometimes you would like a transaction to “happen” as a result of processing another transaction, or simply periodically (ex: every block). This mechanism allows us to ensure the other transaction is counted as a proper transaction - and not just an identical modification of state (IE: It shows up as it’s own transaction in the block).
ExitingRedeemRequestHandler
IUtxo
IdentityTagRepository
Provides access to information stored in the ledger regarding IdentityTags
KeyImageRepository
Provides access to information stored in the ledger regarding KeyImages
MemberRepository
Trait for managing the storage of member data
PendingCreateRequestExpireTime
Provides access to configurable expiration time for pending create requests
RedeemCancellationHandler
Implementors are capable of processing redeem cancellation transactions
RedeemFulfillmentHandler
Implementors are capable of processing redeem fulfillment transactions
RedeemRequestHandler
Implementors are capable of processing redeem request transactions
RedeemRequestRepository
Provides access to and storage of info in the ledger about pending unfulfilled redeem requests in the form of RedeemRequestRecords
RewardTransactionHandler
Implementors are capable of processing reward transactions
SendClaimsHandler
Implementors are capable of processing send claims transactions
TotalIssuanceRepository
Trait for tracking the current total number of claims
TransactionDataRepository
Provides access to information stored in the ledger regarding TransactionOutputs
TrustMetadata
Provides access to the metadata about the trust. Specifically, it gives access to the public key of the trust.
ValidatorRepository
Trait for managing the storage of validator data

Functions§

check_identity_tag_ownership
Returns whether the identity tag matches the private key
check_txo_ownership
Given a TransactionOutput, check whether it is owned by the private key provided.
construct_clear_redeem_request_transaction
construct_create_request_transaction
Builds a create request
construct_exiting_redeem_request_transaction
construct_redeem_request_transaction
construct_send_claims_transaction
decode_one_time_key
Determine the PublicKey associated with a given OneTimeKey. The OneTimeKey is derived using the message body, the txo index, and the message sender’s private key to form a random value that is only reproducible for the sender.
find_secret_input_index
Find row in inputs that matches the given key_images and private_key.

Type Aliases§

BlockNumber
A block number
ClearRedeemRequestRecord
CorrelationId
A unique identifier to associate an on-chain transaction with some real-world event, for now, a cash transfer at a Xand-Enabled Bank.
EncryptedBlob
Some blob of binary data that has been encrypted
PrivateKey
A private key, as held by a transaction signer / creator.
RedeemRequestRecord
RewardTransaction
Salt
TransactionResult
The result of processing/validating a transaction