Benson
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # TRON 网络资源使用量恢复计算 **适用范围** - 本文所述的**资源使用量**与**资源恢复时间**,仅适用于账户中 **通过质押(包括资源代理)获得的资源**,旨在说明 TRON 网络质押资源的使用与恢复机制。 **不适用范围** - 以下两类资源不在本文讨论范围内: * 通过燃烧 TRX 获取的资源:此类资源为一次性消耗,不存在“资源恢复时间”的概念; * 账户的免费带宽:其恢复机制固定为使用后立即重置为 24 小时。 ## 1. 资源使用量&资源恢复时间的计算 ### 1.1 计算公式 当账户发生新的资源消耗(新交易)或资源回收(取消资源代理)时,系统会将本次新增的资源使用量与当前仍处于恢复中的资源使用量进行合并。新的资源恢复时间将根据原有资源已使用量、其剩余恢复时间以及新增使用量等因素进行加权计算。计算公式如下: ``` 资源使用量 = 原资源已使用量 + 新增的资源使用量 ``` ``` 资源恢复时间 = (原资源已使用量 * 资源恢复剩余时间 + 新增的资源使用量 * 新增使用资源的恢复剩余时间)/(原资源已使用量 + 新的资源使用量) ``` **公式参数详解:** * **原资源已使用量**:先前已使用的资源量,可通过 `wallet/getaccount` 接口查询。返回结果包含以下字段: * `account_resource.energy_usage`:能量已使用量 * `net_usage`:带宽已使用量 * **资源恢复剩余时间**:先前的资源已使用量衰减至 0 所需的剩余区块时间数(一个区块时间为 3 秒)。 * **新增的资源使用量**:新增的资源消耗量或者取消代理操作时回收的已使用资源量。 * **新增使用资源的恢复剩余时间**: * **新交易消耗资源的情况**:则为 24 小时对应的区块时间,即 `28800` 个区块时间(一个区块时间为 3 秒)。计算方法:`24 小时 * 60 分钟/小时 * 60 秒/分钟 / 3 秒/区块 = 28800 区块`。 * **取消代理时回收资源的情况**:则为回收资源的已使用量衰减至 0 所需的剩余区块时间数。 ### 1.2 消耗资源示例 假设用户 A 通过质押获得了 200 能量: 1. 在 `0` 时刻,用户 A 使用了 **100** 能量。 2. 在 `12` 小时后,根据能量恢复机制,用户 A 的能量已使用量降至 **50**,还剩下 **12** 小时(即 `14400` 个区块时间)才能完全恢复。 3. 此时,如果用户 A 发起新交易并使用了 **100** 能量,则总的能量已使用量变为 `150`。 根据公式计算,这 `150` 能量的恢复时间为: `恢复时间 = (50 * 14400 + 100 * 28800) / (50 + 100) = 24000 个区块时间` 换算为小时,即 `24000 * 3 / 3600 = 20` 小时。 **结论**:合并之后,总共 150 能量的恢复时间为 20 小时。 ### 1.3 回收资源示例 #### 资源代理回收机制 当代理方执行取消资源代理操作时,系统会按比例收回被代理方账户中的未使用的资源和已使用的资源,以防止资源被恶意重复利用。 回收的已使用资源量的计算公式: ``` 回收的已使用量 = (代理方收回的总资源量 / 被代理方的总资源量) * 被代理方的资源已使用量 ``` 回收的已使用资源量将与代理方自身现有的已使用资源量合并。并且,系统将对这两部分已使用资源量及其各自的剩余恢复时间进行加权平均计算,以确定代理方账户新的资源恢复时间。计算公式请参考 1.1 章节。 #### 示例 > **注意** :资源代理与取消代理均基于 TRX 份额进行,即代理方向被代理方委托 N TRX 份额所对应的能量或带宽资源。当代理方代理 N TRX 份额的资源时,被代理方实际获得的资源数量会随全网质押总量的变化而动态调整。为简化计算流程,以下示例中将直接以“代理给对方的能量数量”进行描述。 **前提条件** 假设用户 X 将 100 Energy 代理给用户 Y。在用户 X 取消代理操作时,两个账户的状态如下: | 账户 | 身份 | 总能量 | 当前能量已使用量 | 剩余恢复时间 | | -------- | -------- | -------- | -------- | -------- | | X | 代理方 | 1000 | 75 | 18 小时(即 `21600` 个区块时间) | | Y | 被代理方 | 500 | 50 | 12 小时(即 `14400` 个区块时间) | **计算步骤** 当用户 X 收回 100 Energy 时: 1. 计算回收的已使用量 ``` 回收的已使用量 = 100 / 500 * 50 = 10 Energy ``` 这 10 Energy 的原剩余恢复时间为 12 小时。 2. 计算新的恢复时间 系统将回收的 10 Energy (恢复时间 12 小时)与 X 当前的已使用量 75 Energy (恢复时间 18 小时) 进行加权合并,得到: ``` X 新的能量已使用量 = 75 + 10 = 85 Energy X 新的能量恢复时间 = ((75 * 18) + (10 * 12)) / (75 + 10) ≈ 17.29 小时 (约20748个区块时间) ``` **最终结果** | 账户 | 身份 | 总能量 | 当前能量已使用量 | 剩余恢复时间 | | -------- | -------- | -------- | -------- | -------- | | X | 代理方 | 1100 (1000+100) | 85 (75+10) | 约17.29小时 | | Y | 被代理方 | 400 (500-100) | 40 (50-10) | 12小时 | ## 2. 账户资源恢复情况的查询 TRON 网络通过“时间窗口”的概念来管理资源的恢复,适用于带宽和能量两种资源。 ### 2.1 时间窗口定义 * **带宽恢复时间窗口 (`net_window_size`)**:表示带宽已使用量衰减到 0 所需的区块时间个数(一个区块时间为 3 秒)。 * **能量恢复时间窗口 (`account_resource.energy_window_size`)**:表示能量已使用量衰减到 0 所需的区块时间个数。 ### 2.2 查询资源恢复状态 用户可通过 `wallet/getaccount` 接口查询账户的资源恢复情况。接口返回以下相关字段: * `net_window_size`:显示带宽恢复时间窗口的具体数值。该值的精度为 3,即当其值为 28,800,000 时,对应的带宽恢复时间为 28,800 个区块时间(24 小时)。 * `account_resource.energy_window_size`:显示能量恢复时间窗口的具体数值。精度也为 3。 ### 2.3 默认恢复时间 当账户的带宽或能量使用量为零时,`net_window_size` 和 `account_resource.energy_window_size` 的默认值均为 `28,800,000`(对应 28,800 个区块时间,即 24 小时),表示在资源未使用状态下,标准完全恢复所需的时间。 ## 3. 总结 TRON 网络中的资源已使用量合并机制,通过其独特的加权平均算法,为 TRON 网络资源管理提供了一种更动态和高效的方法。它不仅允许更快的资源恢复,还通过代理机制实现了更灵活的资源利用,从而显著提升了资源周转效率,降低了用户的等待成本。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully