# CPU Storage Consumption Mechanism

## CPU Consumption Sequence

  1. The CPU frozen by the contract creator will be consumed in the proportion set up in the contract. All of the remaining CPU of the contract creator will be deducted first if insufficiency occurs.

  2. The remaining consumption needs to be provided by the caller.

  3. Caller consumption order (To ensure the normal execution of the contract, CPU frozen by the caller will be consumed first; TRX burn will make up for the insufficient part).

  4. If the creator has no frozen CPU resources, the caller is required to provide all consumption.

## Storage Consumption Order

  1. Storage purchased by the contract creator will be consumed in the proportion set up by the contract. All of the storage owned by the contract creator will be deducted first if insufficiency occurs.

  2. The remaining consumption needs to be provided by the caller.

  3. Caller consumption order (To ensure the normal execution of the contract, the system automatically purchase the insufficient part).

  4. If the Contract Issuer does not provide the Storage resources, all the consumption needs to be provided by the caller.

## Related Interface

### getTransactionInfoById



## Related field



### FreezeBalance



### buyStorage



### buyStorageBytes



Instruction

Pass the parameter “fee_limit” during the process of contract deployment and contract calling

Total consumption of this execution

**Note:**

CPU gained by burning TRX: 1 CPU = 30 SUN

In the contract, calling other contracts and using the gas() method limits the CPU usage, not Storage. Considering that callers may have different understanding of consumption control, it’s not suggested to use the gas() method.

## Related terms:

Contract creator: account that creates the contract

Contract caller: account that calls the contract

CPU resource: resource type corresponding to the consumption time of contract execution

Storage resource: resource type corresponding to disk consumption post contract execution