Preventing Duplicate Transactions
Your backend server may implement retries to handle when an HTTP response from Engine was not received successfully. In these cases, set an idempotency key to drop duplicate submissions of the same transaction.
This approach prevents costly and irreversible errors like transferring funds or minting NFTs more than once.
Set the x-idempotency-key
header to a unique string.
Engine only submits a transaction if there was not another transaction sent with the same idempotency key in the past 24 hours. Subsequent calls with the same idempotency key return the original transaction queueId
.
This example safely retries a request up to three times if a 2xx is not received.