Receipt
public struct Receipt
extension Receipt: Equatable
extension Receipt: Hashable
Represents a single “output” TxOut from a Transaction. Intended to be serialized and sent to
the recipient of that TxOut. The recipient is able to use Receipt to validate that a
particular TxOut was sent by whoever sent them the Receipt, assuming the public key of the
Receipt and the TxOut in question are the same and various other validation checks pass. The
Receipt also contains the necessary information to determine whether an expected, incoming
TxOut‘s Tx has expired, in which case, if the TxOut is not in the ledger at that point,
then the corresponding Tx is no longer eligible to be accepted into consensus.
Security
The Receipt contains the TxOutConfirmationNumber, which is used by the recipient as evidence
that a particular party is the one who sent the corresponding TxOut that the Receipt
represents. Therefore, care should be taken to ensure that only the sender and the recipient
have access to the Receipt, otherwise the recipient could be tricked into misattributing which
party sent them a particular TxOut.
-
Block index at which the transaction that produced this
Receiptwill no longer be considered valid for inclusion in the ledger by the consensus network.Declaration
Swift
public let txTombstoneBlockIndex: UInt64 -
Declaration
Swift
public init?(serializedData: Data)Return Value
nilwhen the input is not deserializable. -
Declaration
Swift
public var serializedData: Data { get } -
Public key of the
TxOutthat thisReceiptrepresents, in bytes.Declaration
Swift
public var txOutPublicKey: Data { get } -
Validates whether or not
Receiptis well-formed and matchesaccountKey, returningnilif either of these conditions are not met. Otherwise, returns the value of theTxOutrepresented by thisReceipt.Note: Receipt does not provide enough information to distinguish between subaddresses of an
accountKey, so this function only validates that theReceiptwas addressed to a subaddress of theaccountKey, but not which one.Declaration
Swift
@discardableResult public func validateAndUnmaskValue(accountKey: AccountKey) -> UInt64?
View on GitHub
Receipt Structure Reference