irys.utils.verifyReceipt(receipt)
Returns true or false, indicating if a receipt is valid or not.
Parameters
-receipt
: The receipt as a JSON object in the following format
{
id, // Transaction id
public, // Public key of the bundler node used
signature, // A signed deep hash of the JSON receipt
deadlineHeight, // The block number by which the transaction must be finalized on Arweave
timestamp, // Timestamp (UNIX milliseconds) of when the transaction was created and verified
version, // The version of this JSON file, currently 1.0.0
}
Returns
isValid
: A true or false value indicating if the receipt is valid
Example
const irys = await getIrys();
try {
// First get a receipt
const transactionID = "i9tgbHsr6c1sxryAQ-SLM2rfQAYRuyap7RmGgH28mI4"; // Your transaction Id
const receipt = await irys.utils.getReceipt(transactionID);
// Then verify it
const isReceiptValid = await irys.utils.verifyReceipt(receipt);
console.log(isReceiptValid);
} catch (e) {
console.log("Error getting receipt ", e);
}