# Gas and Fees
Learn the difference between "Gas" and "Fees" in PVM and Cosmos.
# Introducing Gas and Fees
 In the Cosmos SDK, gas is a special unit used to track resource consumption during execution. gas is normally consumed when reading and writing to storage, but it can also be consumed if expensive computations are required. It has two main purposes:
- Make sure the block doesn't consume too many resources and will be finalized.
- Prevent spam and abuse by end users. To this end, gasconsumed during the execution ofMsgis usually priced, resulting infee(fees = gas * gas-prices).feesmust generally be paid by the sender executing theMsg. Note that the Cosmos SDK does not enforce "gas" pricing by default, as there may be other ways to prevent spam (such as bandwidth schemes). Nonetheless, most applications will implement a "fee" mechanism to prevent spam.
# Cosmos SDK Fees
 - Verify that the gas price offered by the transaction is higher than the local min-gas-prices.min-gas-pricesis a local parameter for each full node and is used duringCheckTxto discard transactions that do not offer minimum fees. This ensures that the mempool is not spammed by spam transactions.
- EQ: fees = gas * gas-price
- For example: gas=200000(default),gas-price=0.0001,fees=20uplugcn
# PVM Fees
 The main difference between PVM and Cosmos state transitions is that PVM uses a gas table (opens new window) for each OPCODE, while Cosmos Use "GasConfig" to charge gas for each CRUD operation by setting the unit of access to the database and the cost per byte.
The gas usage of PVM and EVM is calculated in the same way, but the PVM gas usage is different from the EVM gas usage process. When the gas is enough to pay the transaction, the excess gas will be returned. PVM fee gas will not be returned.
- PVM transactions must first meet the minimum handling fee required by feesgreater than Cosmos SDK(currently the minimum handling fee is 0.0001*200000=20uplugcn)
- The gas provided by the transaction should be greater than or equal to the gas sum calculated according to the gas table (opens new window) transaction bytes /protocol_params.go)
- gasPrice最低为- 7
- 公式: fees = gas * gasPrice / 1000000(Proposal v1.7.0 (opens new window) algorithm after upgrade)