{"id":16614,"date":"2023-07-25T19:39:46","date_gmt":"2023-07-25T19:39:46","guid":{"rendered":"https:\/\/www.bitnovo.com\/blog\/?p=16614"},"modified":"2025-09-10T15:18:34","modified_gmt":"2025-09-10T15:18:34","slug":"how-to-cancel-or-replace-a-pending-ethereum-transaction","status":"publish","type":"post","link":"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction","title":{"rendered":"How to cancel or replace a pending Ethereum transaction?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Alternar tabla de contenidos\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ffffff;color:#ffffff\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ffffff;color:#ffffff\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#is_it_possible_to_cancel_or_replace_a_pending_ethereum_transaction\" >Is it possible to cancel or replace a pending Ethereum transaction?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#what_is_it_and_how_does_an_ethereum_transaction_work\" >What is it and how does an Ethereum transaction work?<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#what_happens_from_shipment_to_confirmation_of_a_transaction\" >What happens from shipment to confirmation of a transaction?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#what_statuses_can_transactions_have_in_ethereum\" >What statuses can transactions have in Ethereum?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#why_cancel_or_replace_a_tx_in_ethereum\" >Why cancel or replace a tx in ethereum?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#what_information_does_a_transaction_contain\" >What information does a transaction contain?<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#steps_to_cancel_or_replace_a_transaction_in_ethereum\" >Steps to cancel or replace a transaction in Ethereum<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#data_to_take_into_account\" >Data to take into account<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.bitnovo.com\/blog\/en\/how-to-cancel-or-replace-a-pending-ethereum-transaction\/#a_reflection\" >A reflection<\/a><\/li><\/ul><\/nav><\/div>\n<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tiempo de lectura:<\/span> <span class=\"rt-time\"> 5<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span><p>Whoever has never made a mistake when sending a transaction on a blockchain, let him cast the first stone&#8230; Probably no stone will be thrown, which indicates how important it is to know how to cancel or replace a<strong> pending Ethereum transaction.<\/strong><\/p>\n<p>In this article, I will go over the methods to carry out this action, but it is also an opportunity, which I will not miss, to explain <strong>what are and how transactions in Ethereum work.<\/strong><\/p>\n<p>So, let&#8217;s abandon the preambles and get into the action.<\/p>\n<div class=\"is-divider divider clearfix\"><\/div>\n<h2><span class=\"ez-toc-section\" id=\"is_it_possible_to_cancel_or_replace_a_pending_ethereum_transaction\"><\/span><strong>Is it possible to cancel or replace a pending Ethereum transaction?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>The question contains, in itself, the key to this entire article. Yes, it is possible to replace or cancel a transaction in Ethereum, as long as the transaction is pending. Once a transaction is confirmed, this means that it was included in a block on the network and its modification will be impossible.<\/strong><\/p>\n<p>Each transaction we make on the network contains a unique and unrepeatable number, related to our address on the <a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-blockchain-and-how-does-it-work\">blockchain<\/a> or, in other words, to our wallet. This number, called \u00ab<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-the-nonce-number\">Nonce<\/a>\u00ab, can be modified manually to cancel or replace a transaction on the network.<\/p>\n<p>But, perhaps this beginning gives too much knowledge for known. Therefore, it is necessary to take a step back and prior to knowing the method that we must put into practice, it is necessary for me to elaborate on the transactions, per se, on the <a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-ethereum-eth-and-how-does-it-work\">Ethereum<\/a> network.<\/p>\n<div class=\"is-divider divider clearfix\"><\/div>\n<h2><span class=\"ez-toc-section\" id=\"what_is_it_and_how_does_an_ethereum_transaction_work\"><\/span><strong>What is it and how does an Ethereum transaction work?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>When we talk about transactions in Ethereum, we are talking about nothing more than interacting with this blockchain. Within the network, there are two types of transactions:<\/p>\n<ul>\n<li><strong>Regular or customary transactions<\/strong><\/li>\n<li><strong>Contract implementation transactions<\/strong><\/li>\n<\/ul>\n<p>In this article we will focus on the first type. Just to mention them, the second ones are those transactions that those who wish to create an application on the network carry out to \u00abimmortalize\u00bb their \u00ab<a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-a-smart-contract\">smart contracts<\/a>\u00bb in the blockchain.<\/p>\n<p>Regular transactions have both a sender and a recipient, and that is their main difference with the former. These can represent a sending from the wallet of one person to another or a deposit in an application, among other examples.<\/p>\n<p>Now, let&#8217;s learn a little about the life of a transaction.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"what_happens_from_shipment_to_confirmation_of_a_transaction\"><\/span><b>What happens from shipment to confirmation of a transaction?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>When we send a transaction from our wallet, it travels to a place called \u00abmempool\u00bb. This sort of crypto purgatory is where transactions wait to be selected by a miner to be included in a block.<\/strong><\/p>\n<p>Once the transaction is added to a block and the miner, after managing to solve the corresponding mathematical problem, manages to add the block to the network, it only remains to wait for confirmation. In simple words, this confirmation is a certain number of blocks added to the blockchain, which guarantee that the transactions contained in the previous blocks are valid and immutable.<\/p>\n<p>So, now let&#8217;s learn about the different states that transactions go through during their \u00abcryptohistory\u00bb.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"what_statuses_can_transactions_have_in_ethereum\"><\/span><b>What statuses can transactions have in Ethereum?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>If we check the status of a transaction, after sending it, we will see that it is \u00ab<strong>unknown<\/strong>\u00ab. This means that it has not yet been \u00abseen\u00bb or \u00abchecked\u00bb by a node, which will take it to the famous and, at the same time, scary \u00abmempool\u00bb.<\/p>\n<p>Once this happens and our transaction is in the mempool waiting for a miner to take it to include it in a block, its status will be \u00ab<strong>pending<\/strong>\u00bb and it is only here that we will be able to act on it.<\/p>\n<p>If we perform the method I will explain in the next section, the original transaction, replaced or cancelled, will have the status \u00abreplaced\u00bb, once we consult it in a search engine.<\/p>\n<p>Finally, two statuses. \u00ab<strong>In block<\/strong>\u00bb will be the status of our transaction once it has been selected by a miner and included in a block already added to the network. Here, our transaction, together with all the transactions that make up this block, are waiting for the famous confirmation that gives them the \u00ab<strong>Success<\/strong>\u00bb status.<\/p>\n<p>Let us now learn how to act on this pending transaction.<\/p>\n<div class=\"is-divider divider clearfix\"><\/div>\n<div id=\"image_288210395\" class=\"img has-hover x md-x lg-x y md-y lg-y\">\n<div class=\"img-inner dark\"><img fetchpriority=\"high\" decoding=\"async\" class=\"attachment-large size-large lazyloaded\" src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci%C3%B3n-pendiente-de-Ethereum1.jpg\" sizes=\"(max-width: 768px) 100vw, 768px\" srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum1.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum1-300x205.jpg 300w\" alt=\"\u00bfEs posible cancelar o reemplazar una transacci\u00f3n pendiente de Ethereum?\" width=\"768\" height=\"526\" data-srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum1.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum1-300x205.jpg 300w\" data-src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum1.jpg\" data-sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/div>\n<\/div>\n<div class=\"is-divider divider clearfix\"><\/div>\n<h3><span class=\"ez-toc-section\" id=\"why_cancel_or_replace_a_tx_in_ethereum\"><\/span><strong>Why cancel or replace a tx in ethereum?<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>The structure of a network like Ethereum, its organization and consensus, are what today allow us to cancel or replace a transaction.<\/strong><\/p>\n<p>Now, if you wonder why we might want to perform these actions, there are two great examples:<\/p>\n<ul>\n<li><strong>We regret it and are not interested in having it confirmed<br \/>\n<\/strong><\/li>\n<li><strong>It was sent by mistake<\/strong><\/li>\n<\/ul>\n<p>Before knowing how to cancel a transaction, one more step.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"what_information_does_a_transaction_contain\"><\/span><b>What information does a transaction contain?<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The following is a list of the information contained in a transaction:<\/p>\n<ul>\n<li><strong>Recipient: <\/strong>The address that will receive the funds. Either an individual or a contract.<strong><br \/>\n<\/strong><\/li>\n<li><strong>Signature: <\/strong>This is generated when, using the private key, the transaction is signed and confirmed as having been authorized by the sender.<strong><br \/>\n<\/strong><\/li>\n<li><strong>Value: <\/strong>Amount of ETH that the sender transfers to the recipient or equivalent in another currency to be sent.<strong><br \/>\n<\/strong><\/li>\n<li><strong>Data: <\/strong>Optional field in which arbitrary data is included.<strong><br \/>\n<\/strong><\/li>\n<li><strong>Gas Limit: <\/strong>Maximum amount of gas units that can be consumed by the transaction<strong><br \/>\n<\/strong><\/li>\n<li><strong>Gas Price: <\/strong><a href=\"https:\/\/www.bitnovo.com\/blog\/en\/what-is-gas-in-ethereum\">The fee the sender pays per unit of gas<\/a>.<strong><br \/>\n<\/strong><\/li>\n<li><strong>Nonce: <\/strong>A sort of counter, which lists the total number of confirmed transactions sent from the sending Ethereum address<\/li>\n<\/ul>\n<p>This data, the \u00abNonce\u00bb, is the one we will use to cancel or replace a transaction in Ethereum.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"steps_to_cancel_or_replace_a_transaction_in_ethereum\"><\/span><strong>Steps to cancel or replace a transaction in Ethereum<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once we have sent our transaction to the blockchain, and it is still pending, we will still be able to cancel or replace it. If this is what we wish to do we must follow the following simple steps:<\/p>\n<ul>\n<li><strong>Search for the \u00abhash\u00bb or number that identifies the transaction.<\/strong><\/li>\n<li><strong>Paste it into a search engine, such as Etherscan.io and search for the transaction.<\/strong><\/li>\n<li><strong>Among its data, after confirming that the status is \u00abpending\u00bb, click on \u00absee more\u00bb.<\/strong><\/li>\n<li><strong>Once there, look in the \u00abOthers\u00bb row for the number of the \u00abnonce\u00bb.<\/strong><\/li>\n<li><strong>Go back to our wallet and in the options, usually advanced, select the manual creation of the \u00abNonce\u00bb.<\/strong><\/li>\n<li><strong>We create a new transaction from our wallet, selecting a gas that exceeds the one selected in the previous one and before sending it, we modify the \u00abNonce\u00bb number for the one that has the transaction to be replaced.<\/strong><\/li>\n<li><strong>We send the transaction and wait for your confirmation<\/strong><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"data_to_take_into_account\"><\/span><b>Data to take into account<\/b><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>When creating the new transaction we will be able to perform two actions:<\/p>\n<ul>\n<li><strong>Correct the previous transaction<br \/>\n<\/strong><\/li>\n<li><strong>Cancel that transaction<\/strong><\/li>\n<\/ul>\n<p>In the<strong> first case<\/strong>, what we should do is to recreate the same transaction, either sending the same amount to the same address or interacting with the same contract, while correcting the erroneous parameter and selecting a higher gas, so that this transaction is prioritized for a miner. It is important to clarify, that the gas of both, will be consumed and will not be returned to us.<\/p>\n<p>In the <strong>second case<\/strong>, when we do not want the transaction to be executed, the option usually used is to create a transaction in which we send 0 ETH to ourselves.<br \/>\nIn this way, if this transaction has the same nonce, but more gas than the previous one, once confirmed, it will replace the unwanted transaction.<\/p>\n<div class=\"is-divider divider clearfix\"><\/div>\n<div id=\"image_28679857\" class=\"img has-hover x md-x lg-x y md-y lg-y\">\n<div class=\"img-inner dark\"><img decoding=\"async\" class=\"attachment-large size-large lazyloaded\" src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci%C3%B3n-pendiente-de-Ethereum2.jpg\" sizes=\"(max-width: 768px) 100vw, 768px\" srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum2.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum2-300x205.jpg 300w\" alt=\"\u00bfEs posible cancelar o reemplazar una transacci\u00f3n pendiente de Ethereum?\" width=\"768\" height=\"526\" data-srcset=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum2.jpg 768w, https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum2-300x205.jpg 300w\" data-src=\"https:\/\/www.bitnovo.com\/blog\/wp-content\/uploads\/2022\/03\/Es-posible-cancelar-o-reemplazar-una-transacci\u00f3n-pendiente-de-Ethereum2.jpg\" data-sizes=\"(max-width: 768px) 100vw, 768px\" \/><\/div>\n<\/div>\n<div class=\"is-divider divider clearfix\"><\/div>\n<h2><span class=\"ez-toc-section\" id=\"a_reflection\"><\/span><strong>A reflection<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The world behind an Ethereum transaction can be fascinating. This article is but a small sketch of what happens when sending a transaction and the options we have to actively intervene in its future.<\/p>\n<p>Knowing the fundamentals and concepts behind our daily tools is not an obligation or a necessity. But it undoubtedly provides us with the necessary expertise to act with full knowledge of the facts and minimize errors.<\/p>\n<p>An informed community is a community that is able to protect itself and share its knowledge with the world. There are already too many proofs that the road to adoption is built on education.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">Tiempo de lectura:<\/span> <span class=\"rt-time\"> 5<\/span> <span class=\"rt-label rt-postfix\">minutos<\/span><\/span>Whoever has never made a mistake when sending a transaction on a blockchain, let him cast the first stone&#8230; Probably no stone will be thrown, which indicates how important it is to know how to cancel or replace a pending Ethereum transaction. In this article, I will go over the methods to carry out this [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":6985,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[185],"tags":[],"class_list":["post-16614","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blockchain-en"],"_links":{"self":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/16614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/comments?post=16614"}],"version-history":[{"count":2,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/16614\/revisions"}],"predecessor-version":[{"id":24482,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/posts\/16614\/revisions\/24482"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/media\/6985"}],"wp:attachment":[{"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/media?parent=16614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/categories?post=16614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitnovo.com\/blog\/wp-json\/wp\/v2\/tags?post=16614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}