Introduction to Qtum Economics — A Beginner’s Guide to Gas
Many of you have probably heard the term ‘gas’ and ‘Smart Contract’ before, but how does it work? Why does gas exist, and what does it cost?
Qtum’s gas model is very similar to Ethereum, along with (and currently the only) one of our supported virtual machines; the Ethereum Virtual Machine (EVM). Effectively, gas is the ‘cost’ of the computational resources required to execute a Smart Contract.
The ‘cost’ is based in Qtum Satoshis, which are the lowest unit of a Qtum Token, broken down to 8 decimal points, or .00000001 Qtum. Our platform uses the Base58 binary-to-text mechanism to generate addresses on the blockchain, which can be converted to Ethereum’s hex addresses. To find out more, please see: https://en.wikipedia.org/wiki/Base58
The reason gas exists on Qtum is to disincentive spamming the network. Without this system in place, malicious users could create massive Smart Contracts, and flood the chain with data at no cost. This would effectively fill up every block, making it so transactions would not execute in a timely fashion, requiring larger transaction fees. It would also bloat the size of the Qtum blockchain, which would make it very difficult to run a node or a service for our platform.
Gas Price Breakdown
The gas price for creating a Smart Contract with Qtum is a simple formula:
32000 Qtum Satoshi + (200 * size-in-bytes)
The minimum gas price set by the Qtum Decentralized Governance Protocol (more on this later) is 40 Qtum Satoshi or .00000040 Qtum
Let’s calculate the cost of creating a 1 Kilobyte (KB) Smart Contract:
32000 + (200 * 1024bytes) * 40 Qtum Satoshi = .09472 Qtum (9,472,000 Qtum Satoshis)
Add the network transaction fee of .001 Qtum per KB, and the total is .09572 Qtum.
Let’s assume the price of Qtum is USD $10.00, that means it would cost $0.9572 dollars to deploy a 1kb Smart Contract.
The gas price can be increased however to deploy your quicker during times of network congestion. The stakers can choose to only allow contract transactions with a gas price of 80 Qtum Satoshi. For instance, if they see a lot of network spam and are tired of wasting computational resources executing useless transactions.
The Decentralized Governance Protocol
The price of Qtum fluctuates, which is makes the cost of computational resources in dollars change as a result. If the dollar cost of deploying a Smart Contract suddenly makes it cheap to flood the network, there are protections in place. Traditionally, it would require a hard fork to adjust the base cost of gas. Qtum was designed to be as decentralized as possible, meaning that the project belongs to the community, and should not rely on a central authority to govern itself.
The problems with centralization go beyond scary if the decision making authority is incompetent, missing, malicious, or greedy. The risk of a sudden hard fork can bring colossal disruption to the ecosystem, which should be avoided at any cost. Our solution is to provide a tool that allows gas price to be changed through community consensus. This takes power away from the Qtum team, and transfers it to the community. While we expect a “Qtum Classic” blockchain to arise, we have spent effort to ensure it doesn’t happen because of community exclusion in the decision making process.
Consider that the Qtum blockchain has no masternodes or other centralized liabilities. Anyone can host a node, so long as they have a computing unit and an internet connection. This strips the ability for an entity to attack core services, like masternodes, etc. Think of Qtum like a snake with infinite heads, the code is open source allowing anyone tooperate a node, they don’t even need to hold Qtum tokens.
Community members vote to change select parameters with their tokens, in this case, to modify the base cost of gas from 40 Qtum Satoshi. If the cost to deploy a contract becomes burdensome, a vote can be initiated to lower it, and vice versa. The risk of sudden of a sudden hard fork is negated, allowing time for reasonable discourse.
For more information, please see: https://qtum.org/en/blog/qtum-s-decentralized-governance-protocol
The gas model on Qtum protects the blockchain from attacks, but tries to make it cheap enough for anyone to deploy Smart Contracts. This is done in a decentralized way, to protect users from the dangers of centralization. The Decentralized Governance Protocol ensures that the Qtum project is not subject to a sudden hard fork, and further protects the community from centralization.
For a more technical explanation of Qtum’s gas model, please see: