Home指南API 参考手册
指南API 参考手册社区Discord博客FAQ漏洞赏金公告中心English(英文版)Log In
指南

调试资源

CPU存储消耗机制

CPU消耗顺序

  1. 合同创建者冻结的CPU将按合同中设置的比例消耗。 如果出现不足,将首先扣除合同创建者的所有剩余CPU。

  2. 剩余的消费需要由调用者提供。

  3. 调用者消耗订单(为了确保合同的正常执行,调用者冻结的CPU将首先被消耗; TRX销毁将弥补不足的部分)。

  4. 如果创建者没有冻结的CPU资源,则调用者需要提供所有消耗。

存储消耗订单

  1. 合同创建者购买的存储将按合同规定的比例消耗。 如果发生不足,合同创建者拥有的所有存储将被首先扣除。

  2. 剩余的消费需要由调用者提供。

  3. 调用者消耗订单(为确保合同正常执行,系统自动购买不足部分)。

  4. 如果合同签发者未提供存储资源,则调用者需要提供所有消耗。

相关界面

getTransactionInfoById

    getTransactionInfoById需要1个参数,交易ID

相关领域

    CpuFee: //TRX consumed by this contract (TRX burn caused by insufficient CPU remaining)
    2400
    CpuUsage: //CPU consumed by this contract (including CPU consumed by the contract creator and caller, excluding that consumed by CpuFee)
    120
    NetFee: //TRX consumed due to insufficient Bandwidth with this contract
    0
    NetUsage: //Bandwidth consumed by this contract (excluding that related to NetFee)
    252
    StorageFee: //TRX purchased last-minute due to insufficient Storage with this contract
    0
    StorageDelta: //Bandwidth consumed by this contract(**Including**that related to StorageFee)
    0
    OriginCpuUsage: //CPU provided by the contract creator with this contract 
    120
    OriginStorageDelta: //Storage provided by the contract creator with this contract 
    0

FreezeBalance

    freezeBalance frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH,1 CPU]

buyStorage

    buyStorageBytes bytes 

buyStorageBytes

    sellStorage quantity  

介绍

在合同部署和合同调用过程中传递参数“fee_limit”

此执行的总消耗量

注意:

通过销毁TRX获得的CPU:1 CPU = 30 SUN

在合同中,调用其他合同并使用gas()方法限制CPU使用率,而不是存储。 考虑到调用者可能对消费控制有不同的理解,因此不建议使用gas()方法。

相关条款:

合同创建者:创建合同的帐户

合同调用者:调用合同的帐户

CPU资源:与合同执行的消耗时间对应的资源类型

存储资源:合同执行后对应磁盘消耗的资源类型