【问题标题】:How many global variables a smart contract or dapp for Algorand can have?Algorand 的智能合约或 dapp 可以有多少个全局变量?
【发布时间】:2022-08-18 22:52:36
【问题描述】:

嘿,伙计们,我想知道我可以为一个algorand 智能合约或 dapp 拥有多少个全局变量?

我目前正在使用 pyteal 为我的 dapp 编写智能联系人。

    标签: algorand


    【解决方案1】:

    你可以检查一下Pyteals official documentation here

    基本上你可以有 12 个全局变量,包括

    • Global.min_txn_fee()
    • Global.min_balance()
    • Global.max_txn_life()
    • Global.zero_address()
    • Global.group_size()
    • Global.logic_sig_version()
    • 全球.round()
    • Global.latest_timestamp()
    • Global.current_application_id()
    • Global.creator_address()
    • Global.current_application_address()
    • Global.group_id()

    你可以获取区块链的当前状态在您的 dapp 中使用上述全局变量。

    【讨论】:

      【解决方案2】:

      Algorand 上的智能合约目前可以具有:

      • 64 个全局变量(键/值)
      • 每个选择加入的帐户 16 个局部变量(键/值)

      页面https://developer.algorand.org/docs/get-details/parameter_tables/#smart-contract-constraints 表示当前参数。

      您需要在创建时指定多少个全局变量和局部变量及其类型。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2022-12-06
        • 1970-01-01
        • 2022-01-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-23
        • 1970-01-01
        相关资源
        最近更新 更多