cancelPrivateTransaction - SDK
Stops the provided private transaction from being submitted for future blocks. A transaction can only be canceled if the same key signs the request as the sendPrivateTransaction call submitting the transaction in the first place.
Stops the provided private transaction from being submitted for future blocks. A transaction can only be canceled if the same key signs the request as the sendPrivateTransaction
call submitting the transaction in the first place.
Don’t have an API key?
Start using this method in your app today. Get started for free
Description
Stops the provided private transaction from being submitted for future blocks. A transaction can only be canceled if the same key signs the request as the sendPrivateTransaction call submitting the transaction in the first place.
Please note that fast mode transactions cannot be canceled using this method.
Returns a boolean indicating whether the cancellation was successful.
Parameters
Response
Example Request and Response
Prerequisite: You will need to install the Alchemy SDK before making requests with it.
The commands for installing it using npm or yarn are given below:
Request
Response
Use Cases
Here are some potential use cases for the cancelPrivateTransaction
method:
-
Error in transaction parameters: If the sender realizes that they have made an error in the transaction parameters, such as sending the wrong amount or specifying the wrong recipient, they can cancel the transaction before it is processed.
-
Privacy concerns: If the sender realizes that the transaction includes sensitive information that they do not want to be visible on the blockchain, they can cancel the transaction before it is processed.
-
High gas price: If the gas price is too high, the sender may want to cancel the transaction and resubmit it with a lower gas price to save on transaction fees.
Related Methods
Here are the methods related to cancelPrivateTransaction
:
- sendPrivateTransaction: Used to send a single transaction to Flashbots. Flashbots will attempt to send the transaction to miners for the next 25 blocks.