Advanced NFT — Different transaction statuses

lazymori.eth
Coinmonks
Published in
6 min readApr 19, 2022

--

Last week, we learnt about gas and how it works under the hood. As gas is ultimately a property within transactions, we get to see it at work comparing failed and cancelled transactions. However, what really goes on when we cancel a transaction versus when we allow it to fail? What else goes on in a transaction? Today, we’ll find out.

Previously, we mentioned that gas to be the petrol for cars to reach it’s destination. Therefore, transactions are like cars — the object of transportation. Similar to a car, it’s role is to deliver something or to bring someone to a destination, this is what we call data. In every transaction, we are always transporting data from one address to another within the blockchain network.

Put simply, a transaction consists of 5 main parts:

  • Sender address
  • Destination address
  • Data
  • Gas
  • Cryptographic Lock

The transaction needs to know where it comes from, where it’s going to, what it is bringing, how much gas to push, and it must be locked cryptographically. But how does a transaction gets delivered to the destination address?

When transactions are first submitted, it will be cryptographically locked. And as we learn last week, the gas that we set will determine how incentivized miners will be to mine your transactions. Every transaction starts off as a pending transaction.

If the transaction doesn’t get mined by miners, it will stay as a pending transaction. If the transaction stays unmined for a long time, it might get dropped out of the network — dropped transaction. If the transaction gets mined, it might either fail or succeed. Users can also decide to cancel a transaction.

In a highly competitive scene of a NFT mint, pending transactions could be a sign of unsuccessful mint, and it is highly probable. However, pending transactions are a neutral phenomenon. Users are receiving the speed of service for the price which they are willing to pay. If the transaction is not time sensitive, like if you are doing a simple eth transfer to a friend and you both could afford to wait a long time, then a low gas fee and waiting a long time for the transaction to get prioritized may be a good strategy.

NFT public mints and altcoin launches are examples of time sensitive transactions because the supply and distribution will run out once people have claimed them all up. Many users will step on the gas fees hoping that their pending transactions will be prioritized by the miner. Therefore, when a transaction with lower gas fees hops unto the network, it will not be prioritized by miners. When it doesn’t get prioritized in that duration, this is where transactions remain pending for some time.

In the case of perpetually pending transactions, the silver lining is that it has not yet incurred any cost. Apart from staying in the pending status until kingdom comes, the status could also change.

Successful Transaction

As the name suggests, a successful transaction means that it eventually got prioritized and processed by miners. In the example of an NFT mint, a successful transaction would cost you the price of the NFTs + the gas fees.

However, in most cases with NFT’s limited supply nature, the market will try to outgas one another to hell especially in a public mint. By the time the miners prioritize your perpetually pending transaction, the supply will already run out. This will cause the transaction to fail.

Failed Transaction

A failed transaction happens when the result of the transaction was unexpected. However, it will still consume the gas fees because the miners tried to mine the transaction. Rightfully, you are supposed to receive the NFT after consuming the gas to process the transaction. Unfortunately, the supply ran out and it returned you nothing.

In the case of failed transactions, the price of the NFTs will not be consumes, but gas fees will be.

Dropped Transactions

In the case of dropped transactions, the miner decides to remove the pending transaction from the mempool. This happens when the pending transactions sit in the mempool for too long, and there are way too many new pending transactions enter the mempool that it ran out of space.

What happened is that the miners will begin to drop pending transactions from the mempool starting from the pending transactions with the least gas fees.

For dropped transactions, there will be absolutely no cost involved, not even gas fees.

Cancelled Transactions

As a user, you might want to cancel transactions and there are many ways to do that — whether is it by clicking on a ‘cancel transaction’ button, or by logging out of the application, or creating an overriding transaction manually.

A cancelled transactions is basically a new overriding transaction that has four properties:

  • The creator of the new overriding transaction and the old pending transaction must be the same.
  • The new overriding transaction must have a higher gas fee than the old pending transaction.
  • The new overriding transaction must have the same ‘identification number’ as the old pending transaction.
  • The new overriding transaction’s usage will be to do a 0eth simple transfer back to the creator instead of the old pending transaction’s original usage — mint/buy/sell.

Under the hood, these properties exist because:

  • Only you can cancel your own pending transactions.
  • Both transactions will be in the mempool, but the miner will be incentivized to process the new transaction first.
  • One ‘identification number’ can only represent one transaction. Once the new transaction is processed first, the old transaction will become a dropped transaction.
  • Essentially, the new transaction’s function is a simple transfer rather than a complex mint/buy/sell. This means that the gas (not gas fees) will change because a simple function means less computational work means less gas.

A quick segue: ‘identification number’ is also known as nonce in the technical jargon, like how humans are identified with identity cards and numbers. One nonce can only be used to identify one transaction.

The reason why a cancelled transaction are more complicated is because it’s a user-triggered action, the wallet will actually have to interpret what a ‘cancelled’ transaction actually means — to override with a new and faster transaction — and to take the necessary actions. Whereas the rest of the transactions types are network-triggered, so the network will act accordingly.

This is also why there is a difference in gas cost when it comes to failed versus cancelled transactions.

DevCandy

There is another status, however, only more commonly seen by developers called the “out of gas” transaction status.

This status is hardly seen from the consumers because the gas units are usually provided/estimated by the wallet service and it isn’t recommended to change.

As a developer, however, sometimes in order to test our contract, we might want to send a custom transaction with our self-defined gas parameters. When we do that, and it’s insufficient to complete the function, it will return a “out of gas” transaction status. This is a failed transaction and will consume all the gas fees required as it attempted to complete the transaction, thus running the mileage on the gas.

Conclusion

Of course, there are many other details within a transaction that could be explored, like the different types of transactions, and the different types of data that can be transported in a transaction. These things are also fundamental, but not yet important in the relation to NFTs.

Ultimately, a transaction in the NFT market exist not just for a simple transfer, but to run the functions of a contract. Next week, we will explore how contracts work, and how it is easily exploitable.

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read

--

--

lazymori.eth
Coinmonks

just a man trying to understand this space of nfts, cryptocurrencies, and web3 technologies.