> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# 常见问题：Web3 Actions

> 关于 Web3 Actions 执行模式、存储类型、触发器、速率限制、运行时库、密钥、本地测试和项目大小限制的解答。

<div className="flex flex-col gap-4 mt-8">
  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="do-i-need-a-paid-plan-to-use-web3-actions" className="text-xl font-semibold">使用 Web3 Actions 需要付费套餐吗？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        是的。Web3 Actions 在付费套餐中提供。要为您的账户启用此功能，请[联系我们的销售团队](https://tenderly.co/contact-us)以安排通话并商讨升级方案。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-the-difference-between-parallel-and-sequent" className="text-xl font-semibold">并行执行与顺序执行有什么区别？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        在配置 Web3 Action 时，您可以在两种执行模式之间选择。

        当有多个被触发的 Web3 Action（例如来自同一区块的交易）时，这两种模式的行为如下：

        * **顺序（sequential）**：执行会遵循触发发生的顺序；在触发 `N-1` 完成之前，触发 `N` 会等待执行。执行顺序有保证。
        * **并行（parallel）**：所有触发都会被提交执行，执行顺序无法保证。

        两者适用不同的[速率限制](#whats-the-rate-limit-for-web3-actions)。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-the-difference-between-write-copy-on-write" className="text-xl font-semibold">WRITE、COPY ON WRITE 和 EMPTY 存储类型有什么区别？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        * **Write**：这是默认选择的类型。它始终用于自动触发器，会将数据写入
          主存储。请注意，此类型可能覆盖主存储中的数据。
          * **Copy on write**：此类型会创建主存储的副本作为临时存储。可用于
            手动触发器。触发器停止运行后，写入临时存储的所有内容都不会
            被保留。
          * **Empty**：此类型会创建临时的空存储。可用于手动触发器。empty
            存储类型对主存储没有任何引用。触发器停止运行后，写入到该类型存储中的所有内容
            都会消失。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="do-contracts-need-to-be-verified-to-be-used-in-web" className="text-xl font-semibold">在 Web3 Actions 中使用的合约需要经过验证吗？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        是的，在 Web3 Action 触发器中使用的合约需要经过验证并添加到您在 Tenderly 上的项目中。
        否则，CLI 将抛出错误。

        在此了解更多关于[触发器及其工作原理](/monitoring/web3-actions/references/functions-events-triggers)的信息。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-is-the-allowed-number-of-web3-actions-per-pro" className="text-xl font-semibold">每个项目允许的 Web3 Actions 数量是多少？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        每个项目允许的 Web3 Actions 数量为 10。如果您在尝试部署 Action 时已达到该限制，
        将收到以下错误消息：

        `The request failed with a status code of 400 and status message of '400 Bad Request'`
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-is-the-storage-limit" className="text-xl font-semibold">存储限制是多少？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        键值存储的限制为 100KB，不受键数量的限制。只要键的总大小小于或等于 100KB，您就可以添加任意多的
        键。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-the-size-limit-to-the-web3-action-project" className="text-xl font-semibold">Web3 Action 项目的大小限制是多少？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        当您使用 CLI 创建 Web3 Action 时，整个 NPM 项目将被压缩并上传到 Tenderly。
        包含 `node_modules` 在内的压缩包最大大小为 **40 MB**。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-the-maximum-duration-of-web3-action-executi" className="text-xl font-semibold">Web3 Action 执行的最长时长是多少？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Web3 Action 的执行时长限制为 30 秒，达到该时间后将被终止。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-is-the-execution-timeout-for-web3-actions" className="text-xl font-semibold">Web3 Actions 的执行超时是多少？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        当前的执行超时为 30 秒，超时后执行将被终止。如需更长时间，
        您可以通过 [support@tenderly.co](mailto:support@tenderly.co) 联系我们的支持团队讨论您的使用场景。获取更多[关于执行状态类型的信息](/monitoring/web3-actions/references/execution)。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="i-have-a-tenderly-yaml-file-with-two-web3-actions" className="text-xl font-semibold">我有一个 `tenderly.yaml` 文件，其中包含两个具有相同触发器（某个合约事件）的 Web3 Actions。清单文件中先声明的 Action 是否总是会先于第二个被调用？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        两个具有相同触发器的独立 Web3 Actions 会并行执行，因为它们是彼此隔离且互不知晓
        的实体。
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-available-in-web3-actions-runtime" className="text-xl font-semibold">Web3 Actions 运行时中提供了哪些库？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/functions-events-triggers#available-libraries-for-dashboard-based-actions"

        以下库可用：

        * Ethers.js
        * Bignumber.js
        * Axios
        * Luxon

        [了解更多 →](/monitoring/web3-actions/references/functions-events-triggers#available-libraries-for-dashboard-based-actions)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-do-web3-actions-interact-with-blockchain-data" className="text-xl font-semibold">Web3 Actions 如何与区块链数据交互？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/introduction"

        Web3 Actions 可以通过读取区块、交易和日志与区块链数据交互，从而实现智能合约监控。
        示例：

        ```js theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        const { ethers } = require("ethers");
        const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
        const latestBlock = await provider.getBlockNumber();
        ```

        [了解更多 →](/monitoring/web3-actions/introduction)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-are-the-trigger-types-available-for-web3-acti" className="text-xl font-semibold">Web3 Actions 可用的触发器类型有哪些？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/functions-events-triggers#external-events-and-trigger-types"

        Web3 Actions 支持 block、transaction、webhook 以及周期性（CRON）触发器，这些触发器定义了何时应执行该 Action。

        [了解更多 →](/monitoring/web3-actions/references/functions-events-triggers#external-events-and-trigger-types)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-do-i-deploy-web3-actions" className="text-xl font-semibold">如何部署 Web3 Actions？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/introduction"

        Web3 Actions 可以通过 Tenderly Dashboard 或使用 CLI 进行部署。CLI 提供了更高级的配置选项。
        示例 CLI 命令：

        ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        tenderly actions deploy --name MyAction --triggers triggers.yaml
        ```

        [了解更多 →](/monitoring/web3-actions/introduction)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-are-errors-handled-in-web3-actions" className="text-xl font-semibold">Web3 Actions 如何处理错误？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/error-reporting"

        Web3 Actions 中的错误会被记录，并可在 Tenderly Dashboard 中查看。失败的 Action 可以重新执行以进行进一步调试。

        [了解更多 →](/monitoring/web3-actions/references/error-reporting)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-s-the-rate-limit-for-web3-actions" className="text-xl font-semibold">Web3 Actions 的速率限制是多少？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/usage-rate-limits"

        速率限制为每个 Web3 Action 每 5 分钟 100 次执行。

        [了解更多 →](/monitoring/web3-actions/usage-rate-limits)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-is-key-value-storage-in-web3-actions" className="text-xl font-semibold">Web3 Actions 中的键值存储是什么？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/context#storage"

        键值存储允许 Web3 Actions 在多次执行之间持久化状态。
        示例：

        ```js theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        await kvStore.put("myKey", "value");
        const value = await kvStore.get("myKey");
        ```

        [了解更多 →](/monitoring/web3-actions/references/context#storage)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="can-i-store-data-in-web3-actions" className="text-xl font-semibold">我可以在 Web3 Actions 中存储数据吗？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/context#storage"

        可以，您可以使用键值存储来持久化数据，并管理 API 密钥等敏感信息的密钥。
        示例：

        ```js theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        const value = await kvStore.get("key");
        await kvStore.put("key", value);
        ```

        [了解更多 →](/monitoring/web3-actions/references/context#storage)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-are-common-use-cases-for-web3-actions" className="text-xl font-semibold">Web3 Actions 有哪些常见使用场景？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/introduction#use-cases-for-web3-actions-and-different-events"

        常见的使用场景包括监控区块链交易、自动化任务，以及为 dapp 构建 webhook 后端。

        [了解更多 →](/monitoring/web3-actions/introduction#use-cases-for-web3-actions-and-different-events)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="can-web3-actions-be-tested-locally" className="text-xl font-semibold">Web3 Actions 可以在本地测试吗？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/local-development"

        可以，使用 `@tenderly/actions-test` npm 包，Web3 Actions 可以在本地进行测试。
        示例：

        ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        npm install @tenderly/actions-test
        tenderly actions run local MyAction.js
        ```

        [了解更多 →](/monitoring/web3-actions/references/local-development)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-are-the-supported-programming-languages-for-w" className="text-xl font-semibold">Web3 Actions 支持哪些编程语言？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Web3 Actions 使用 JavaScript 或 TypeScript 编写。
        示例：

        ```ts theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        async function main() {
          console.log("Running Web3 Action");
        }
        ```
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-can-i-manage-secrets-in-web3-actions" className="text-xl font-semibold">如何在 Web3 Actions 中管理密钥？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/context#secrets"

        您可以使用密钥管理功能安全地存储和检索敏感数据，例如 API 密钥。
        示例：

        ```js theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        const apiKey = await secrets.get("API_KEY");
        ```

        [了解更多 →](/monitoring/web3-actions/references/context#secrets)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="can-web3-actions-interact-with-external-apis" className="text-xl font-semibold">Web3 Actions 可以与外部 API 交互吗？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/introduction"

        可以，您可以使用 Axios 等库进行 HTTP 请求，从而与外部 API 交互。
        示例：

        ```js theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        const axios = require("axios");
        const response = await axios.get("https://api.example.com/data");
        ```

        [了解更多 →](/monitoring/web3-actions/introduction)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-is-the-purpose-of-cron-triggers-in-web3-actio" className="text-xl font-semibold">Web3 Actions 中 CRON 触发器的用途是什么？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/functions-events-triggers#periodic-event"

        CRON 触发器允许 Web3 Actions 以特定时间间隔周期性运行，从而自动化重复性任务。
        示例：

        ```yaml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        cron:
          interval: "*/15 * * * *"
        ```

        [了解更多 →](/monitoring/web3-actions/references/functions-events-triggers#periodic-event)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-are-webhook-based-web3-actions" className="text-xl font-semibold">什么是基于 Webhook 的 Web3 Actions？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "source: https://docs.tenderly.co/monitoring/web3-actions/references/functions-events-triggers#webhook-event "

        基于 Webhook 的 Web3 Actions 由传入的 HTTP 请求触发，使 Web3 Actions 可以充当 dapp 或其他服务的后端。

        [了解更多 →](/monitoring/web3-actions/references/functions-events-triggers#webhook-event)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-are-transaction-based-web3-actions" className="text-xl font-semibold">什么是基于交易的 Web3 Actions？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/functions-events-triggers#transaction-event"

        基于交易的 Web3 Actions 由特定的区块链交易触发，可实现监控和自定义响应。

        [了解更多 →](/monitoring/web3-actions/references/functions-events-triggers#transaction-event)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-are-block-based-web3-actions" className="text-xl font-semibold">什么是基于区块的 Web3 Actions？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "https://docs.tenderly.co/monitoring/web3-actions/references/functions-events-triggers#block-event"

        基于区块的 Web3 Actions 由区块链上的新区块触发，非常适合区块级监控。

        [了解更多 →](/monitoring/web3-actions/references/functions-events-triggers#block-event)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="what-is-the-purpose-of-simulations-in-web3-actions" className="text-xl font-semibold">Web3 Actions 中模拟的用途是什么？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        [//]: # "source: https://docs.tenderly.co/monitoring/web3-actions/introduction#use-cases "

        Web3 Actions 可以运行交易模拟，在广播交易之前测试和验证结果。
        示例：

        ```js theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
        const simulationResult = await simulateTransaction(txData);
        ```

        [了解更多 →](/monitoring/web3-actions/introduction#use-cases)
      </div>
    </div>
  </Card>

  <Card>
    <div className="flex flex-col gap-2">
      <h2 id="how-does-tenderly-handle-logs-for-web3-actions" className="text-xl font-semibold">Tenderly 如何处理 Web3 Actions 的日志？</h2>

      <hr className="dark:border-neutral-800" />

      <div>
        Tenderly 会记录每一次 Web3 Actions 的执行。日志可在 Tenderly Dashboard 上访问和查看，以便进行调试。
      </div>
    </div>
  </Card>
</div>
