1. Introduction
When trying to sign a transaction, users often get an error message that displays that there is not enough CPU and asks to pay as much as 10 to 30 milliseconds of CPU or even more. This sort of system behavior can be associated with subjective billing. In this article, I'll guide you on how to handle the situation.
2. What is Subjective Billing?
Subject billing is a feature of the Antelope blockchain that allows a node operator to bill an account locally in its node for resources utilized by failed transactions without sharing billing information with the rest of the network. It was introduced to reduce CPU usage but often leads to persistently failing transactions or lost transactions.
3. Transaction Lifecycle of Antelope Blockchain
The Antelope blockchain adopted Peer-to-Peer (P2P) network connections to propagate transactions across the network. When a transaction moves from one node to another, the path it takes depends upon the configurations of the nodes and the network latency.
Figure from the ENF Website
Figure 1 exhibits the lifecycle of a transaction in the Antelope blockchain. A transaction exists when a user submits it to a node using an API (1.1). The API node passes the submitted transaction to its P2P protocol (1.2). This protocol propagates the transaction from one node to another (1.3) until it reaches the producer of the current block (1.4). Then, the block producer includes the transaction in the current block and bills the account for the utilization of resources. Every node within the network conducts an internal check to determine whether a transaction should be forwarded to the next node or rejected due to resource over-utilization.
When a transaction arrives at a node with subjective billing enabled, the node verifies its signature and identifies which account the transaction belongs to. If the account exceeds its subjective billing limit, the node stops the propagation of the transaction so that it never reaches the current block producer.
Subjective billing is additive; when a transaction arrives at a node from an account, the node increases charges to the account to utilize its resources. To pass a transaction through a node, the account must have sufficient resources to cover subjective billing at that node. Subjective billing is renewed every 24 hours.
4. Under what circumstances might you be overcharged for a transaction?
Each blockchain node keeps track of the CPU usage associated with an account. Your usage counter with that specific node increases whenever you attempt a failed transaction with a node. However, failed transactions do not affect the usage counters of other nodes. So, the node you're connected to will give you information on the fee you're charged for the transaction.
The fee charged by one node is independent of the fee charged by other nodes within the network, meaning that some nodes may charge you more or less than others.
If you continually attempt and fail transactions with a particular node, you'll be required to pay more for each transaction tried with that node.
5. How to avoid paying too much for a transaction
When a free powerup is no longer enough to pay for a transaction or a connected API charges you very high due to subjective billing, you have three options to overcome this situation, as shown in figure 2.
Image by: Sukanta Manna
Option 1: If the transaction is urgent and can’t be delayed, paynode asks as much to pay. Read here how to add resources to your EOS Account.
Option 2: Your subjective billing at other nodes could be much less than the subjective billing at the connected node. Therefore, changing the API could reduce subjective billing for the transaction. Read here how to change the API.
Option 3: Subjective billing is renewed every 24 hours. Therefore, wait 24 hours, powerup your account for free, and try again.
6. Conclusion
Sending numerous failed transactions to the connected node can result in excessive charges due to the cumulative nature of subjective billing. It would be best for you to stop sending unsuccessful transactions to the connected node.
If the transaction holds significant importance, it is recommended that you pay the amount charged by the node. Switching APIs may also be worthwhile, as other nodes may levy different charges than the connected node.
However, if the transaction is not urgent, the best solution is to wait 24 hours, powerup your account, and try again.
Author: Sukanta Manna
Editor: Markus Hinrichs; Randall Roland
Sources & References:
Further reading
Image credits
Subjective billing figure created by Sukanta Manna
"Normal Operation of the P2P Network" figure from the ENF Website