Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stake 2.0 - A new TRON stake model #467

Closed
lxcmyf opened this issue Sep 28, 2022 · 225 comments
Closed

Stake 2.0 - A new TRON stake model #467

lxcmyf opened this issue Sep 28, 2022 · 225 comments
Labels
discussions-to enhancement New feature or request good first issue Good for newcomers

Comments

@lxcmyf
Copy link
Contributor

lxcmyf commented Sep 28, 2022

tip: 467
title: Stake 2.0 - A new TRON staking model 
author: lxcmyf@gmail.com
discussions-to: https://github.com/tronprotocol/tips/issues/467
status: Final
type: Standards Track 
category : Core
created: 2022-09-28

Simple Summary

This TIP aims to establish a more flexible stake model, called Stake 2.0, Stake 2.0 can improve the utilization of network resources, and at the same time enhance the stability of the TRON stake system.

Motivation

At present, by staking TRX on the TRON network, you can obtain voting rights called TRON Power, as well as bandwidth or energy as resources. The users need to choose whether to obtain whether energy or bandwidth during the stake operation. The obtained resources can also be delegated to other addresses only if they are specified when staking. Once the staking is completed, it is not allowed to unstake within 3 days. Then, the users can perform the unstake operation and immediately obtain the staked TRX.

The delegating of resources under the current stake mechanism is hardly flexible, resulting in low resource utilization and complicated user operations. The stake and delegating operation are bound together at present. If you want to alter your resource delegating object, you need to perform unstaking first, then make another staking and designate a new delegating object. Additionally, the unstake operation must wait for 3 days after staking, which means that the resources obtained cannot be re-delegated to others within 3 days. If the user has already voted before unstaking, the unstake operation will also result in the automatic cancellation of the vote. Hence, all these rules greatly reduce the efficiency of resource allocation and incur extremely complicated user operations to stake and delegate at will.

Since the TVM does not support stake, vote, or delegate commands, the developers are not able to implement related operations in a smart contract, which limits the applications involved staking and delegating, like tokenization and decentralized resource exchange. In addition, the principal will arrive immediately after the stake is released, when the TRX market fluctuates violently, a large number of staking or unstaking operations will be triggered, which will also have a certain impact on the overall stake model.

Therefore, we need a new stake mechanism to solve these problems, separate low-frequency staking operations and high-frequency resource delegating operations, support resource re-delegating without unstaking, and improve resource utilization. Add stake, delegate, vote, and related commands should be added in the TVM, meanwhile, the new mechanism should implement the delayed arrival of unstaking TRX, improve the stability of the stake model under extreme market conditions, and help network participants to form more stable expectations for the total circulation of the entire network.

Specifications

Based on the description above, a newly designed staking model is shown as below, seven new APIs should be added to the java-tron client:

  • /wallet/freezebalancev2
  • /wallet/unfreezebalancev2
  • /wallet/delegateresource
  • /wallet/undelegateresource
  • /wallet/withdrawexpireunfreeze
  • /wallet/getavailableunfreezecount
  • /wallet/getcanwithdrawunfreezeamount
  • /wallet/getcandelegatedmaxsize
  • /wallet/getdelegatedresourcev2
  • /wallet/getdelegatedresourceaccountindexv2

and six new opcodes should be added to TVM:
FREEZEBALANCEV2, UNFREEZEBALANCEV2, DELEGATERESOURCE, UNDELEGATERESOURCE, CANCELALLUNFREEZEV2, WITHDRAWEXPIREUNFREEZE

Mechanism

The mechanism of Stake 2.0 is shown as follows:

  • User calls /wallet/freezebalancev2 to stake TRX and obtain resources, specifing the type of resource. The corresponding resource goes to the owner address that has staked TRX.
  • After staking and obtaining resources, the owner is able to call /wallet/delegateresource to delegate resources to multiple recipients respectively. The delegating time locker is an optional, if selected, the delegated resources cannot be undelegated within 3 days, if not selected, there will not be lock-up period. When the owner repeat the delegating operation with time lock of same amount to the same receiver address, the lock-up period will be reset to 3 days.
  • The owner call /wallet/undelegateresource to cancel the resource delegating for a recipient, supporting partial cancellation by amount.
  • Call /wallet/unfreezebalancev2 to unstake TRX, partial unstaking is supported, but only for the available part, TRX related to the delegated resources are considered locked and not available, therefore, cannot be unstaked.
  • After the owner performs the unstaking operation, he needs to wait N days, then call /wallet/withdrawexpireunfreeze to get back TRX,N is a TRON network parameter.

Specification in undelegateresource

If the recipient has consumed a part of the resource, after undelegating, this part of resources will still be not available status in the owner account, and needs some time to recover. The owner can only delegate the available resources to others.

Example:

  • Assuming that A has 1000 units of energy, delegate all of them to B. After B used 400 units, A called /wallet/undelegateresource to undelegate all the energy left. Now, A has a balance of 600 units of energy in the account, 400 units are in recovering.

Specification in unstake

TRX partial unstaking is supported, but a maximum of 32 partial unstaking operations is allowed simultaneously, in other words, there should be no more than 32 delay arrivals of the unstaking assets in progress at the same time.

Example,

  • Assuming N is 3, and the user staked 50 TRX. On day 1, the user unstakes 1 TRX, he needs to wait for 3 days, that is, on day 4, the user will be able to get back 1 TRX. Then on day 2, the user unstakes another 1 TRX, he would be able to get it back on day 5. Each unstaking operation needs to wait for 3 days before redeeming.
    There could be at most 32 unstaking operations in processing at the same time in the new model.

Unstaking will first reclaim the idle TRON Power, then the TRON Power that has been used. For the reclaiming of TRON Power that has been used, if vote for multiple SRs, it will revoke votes in proportion.

Example:

  • Suppose that a user stakes 2000 TRX and gets 2000 TRON Power, 1,000 TRON Power is idle and 1,000 TRON Power votes for 5 SRs. Each SR gets 200 votes. Now the user unstake 1500 TRX, which means 1500 TRON Power needs to be reclaimed, in this case, the 1000 idle TRON Power will be reclaimed first, then revoke 100 votes from each SR.

  • Revoked votes from SR(A) = (Total revoked votes from all SRs/ Total previous votes to all SRs) * Total previous votes to SR(A)

Specification of HTTP APIs

/wallet/freezebalancev2

Description: stake TRX to obtain TRON Power (voting rights) and bandwidth or energy.

Params:

  1. owner_address - Address of transaction initiator, data type is string
  2. frozen_balance - Amount of TRX to be staked, unit is sun, data type is uint256
  3. resource - Resource type, "BANDWIDTH" or "ENERGY", data type is string
  4. visible - Whether the address is in Base58 format, data type is bool

Returns - unsigned transaction, data type is json string

Example:

curl -X POST  http://127.0.0.1:8092/wallet/freezebalancev2 -d  \
'{"owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
 "frozen_balance":1000000,
 "resource":"BANDWIDTH",
 "visible":true
}'

/wallet/unfreezebalancev2

Description: Unstake TRX to release bandwidth and energy and at the same time TRON Power will be reduced and all corresponding votes will be canceled.

Params:

  1. owner_address - Address of transaction initiator, data type is string
  2. unfreeze_balance - Amount of TRX to be unstaked, unit is sun, data type is uint256
  3. resource - Resource type, "BANDWIDTH" or "ENERGY", data type is string
  4. visible - Whether the address is in base58 format, data type is bool

Returns - unsigned transaction, data type is json string

Example:

curl -X POST  http://127.0.0.1:8092/wallet/unfreezebalancev2 -d  \
'{"owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
 "unfreeze_balance":1000000,
 "resource":"BANDWIDTH",
 "visible":true
}'

/wallet/delegateresource

Description: delegate resource

Params:

  1. owner_address - Address of transaction initiator, data type is string
  2. receiver_address - Receiver address of resource to be delegated to
  3. balance - Amount of TRX staked for resource to be delegated, unit is sun, data type is unit256
  4. resource - Resource type, "BANDWIDTH" or "ENERGY", data type is string
  5. lock - Whether it is locked, if it is set to true, the delegated resources cannot be undelegated within 3 days.When the lock time is not over, if the owner delegates the same resources using the lock to the same address, the lock time will be reset to 3 days
  6. visible - Whether the address is in base58 format, data type is bool

Returns - unsigned transaction, data type is json string

Example:

curl -X POST  http://127.0.0.1:8092/wallet/delegateresource -d  \
'{"owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
 "receiver_address":"TQ4gjjpAjLNnE67UFbmK5wVt5fzLfyEVs3",
 "balance":1000000,
 "resource":"BANDWIDTH",
 "lock": true,
 "visible":true
}'

/wallet/undelegateresource

Description: undelegate API

Params:

  1. owner_address - Address of transaction initiator, data type is string
  2. receiver_address - Receiver address of resource to be delegated to
  3. balance - Amount of TRX staked for resource to be undelegated, unit is sun, data type is unit256
  4. resource - Resource type, "BANDWIDTH" or "ENERGY", data type is string
  5. visible - Whether the address is in base58 format, data type is bool

Returns - unsigned transaction, data type is json string

Example:

curl -X POST  http://127.0.0.1:8092/wallet/undelegateresource -d  \
'{"owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
 "receiver_address":"TQ4gjjpAjLNnE67UFbmK5wVt5fzLfyEVs3",
 "balance":1000000,
 "resource":"BANDWIDTH",
 "visible":true
}'

/wallet/withdrawexpireunfreeze

Description: withdraw unfrozen balance API

Params:

  1. owner_address - Address of transaction initiator, data type is string
  2. visible - Whether the address is in base58 format, data type is bool

Returns - unsigned transaction, data type is json string

Example:

curl -X POST  http://127.0.0.1:8092/wallet/withdrawexpireunfreeze -d  \
'{
  "owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
  "visible":true
 }'

/wallet/getavailableunfreezecount

Description: remaining times of available unstaking API

Params:

  1. owner_address - account address, data type is string.
  2. visible - whether the address is in base58 format, data type is bool

Returns - Remaining times of available unstaking, data type is number.

Example:

curl -X POST  http://127.0.0.1:8092/wallet/getavailableunfreezecount -d  \
'{
  "owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
  "visible":true
 }'

/wallet/getcanwithdrawunfreezeamount
Description: query the withdrawable balance at the specified timestamp

Params:

  1. owner_address - account address, data type is string.
  2. timestamp - query cutoff timestamp, in millisecond.
  3. visible - Whether the address is in Base58 format, data type is bool

Returns - withdrawable balance,unit is sun.

Example:

curl -X POST  http://127.0.0.1:8092/wallet/getcanwithdrawunfreezeamount -d  \
'{
  "owner_address":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
  "timestamp": 1667977444000
  "visible":true
 }'

/wallet/getcandelegatedmaxsize
Description: query the amount of delegatable resources of the specified resource Type for target address, unit is sun.

Params:

  1. owner_address - account address, data type is string.
  2. type - resource type,data type is number, 0 is bandwidth, 1 is energy
  3. visible - whether the address is in base58 format, data type is bool

Returns - the amount of delegatable resource, unit is sun.

Note: The interface indicates the return of the maximum amount of delegated resources for normal transactions, but there are some special transactions in actual situations, such as multi-signature, memo and other transactions that will deduct a part of the resource usage. At this time, the maximum value of specific resources that can be used may be smaller than the recommended value returned through this interface.

Example:

curl -X POST  http://127.0.0.1:8092/wallet/getcandelegatedmaxsize -d  \
'{
  "owner_address": "TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
  "type": 1,
  "visible": true
 }'

/wallet/getdelegatedresourcev2

Description: query the amount of resources detail delegated by fromAddress to toAddress

Params:

  1. fromAddress - resource from address, data type is string.
  2. toAddress - resource to address, data type is string.
  3. visible - whether the address is in base58 format, data type is bool

Returns - Resource delegation information

Example:

curl -X POST  http://127.0.0.1:8092/wallet/getdelegatedresourcev2 -d  \
'{
  "fromAddress": "TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
  "toAddress": "TQ4gjjpAjLNnE67UFbmK5wVt5fzLfyEVs3",
  "visible": true
 }'

/wallet/getdelegatedresourceaccountindexv2

Description: query the resource delegation index by an account

Params:

  1. value - account ddress, data type is string.
  2. visible - whether the address is in base58 format, data type is bool

Returns - Resource delegation index

Example:

curl -X POST  http://127.0.0.1:8092/wallet/getdelegatedresourceaccountindexv2 -d  \
'{
  "value":"TJAVcszse667FmSNCwU2fm6DmfM5D4AyDh",
  "visible": true
 }'

Specification of TVM instructions

0xda: FREEZEBALANCEV2

The FREEZEBALANCEV2 takes 2 operands pop up from stack:

  • amount: amount to freeze in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

0xdb: UNFREEZEBALANCEV2

The UNFREEZEBALANCEV2 takes 2 operands pop up from stack.

  • amount: amount to unfreeze in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

0xdc: CANCELALLUNFREEZEV2

The CANCELALLUNFREEZEV2 takes no operand pop up from stack.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

0xdd: WITHDRAWEXPIREUNFREEZE

The WITHDRAWEXPIREUNFREEZE takes no operand pop up from stack.

If operation succeed, push the actual withdrawal amount to stack, otherwise push 0 to stack.

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

0xdf: UNDELEGATERESOURCE

The UNDELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to undelegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to return the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

Specification of precompile contracts

0x100000b: GetChainParameter

The GetChainParameter takes 1 parameters:

index: index of the parameter to be queried.

Query the specific chain parameters, and push the query result to stack. The solidity syntax is shown below.

  • chain.totalNetLimit
  • chain.totalNetWeight
  • chain.totalEnergyCurrentLimit
  • chain.totalEnergyWeight
  • chain.unfreezeDelayDays

0x100000c: AvailableUnfreezeV2Size

The AvailableUnfreezeV2Size takes 1 parameters:

target: target account address.

Query the size of the available unfreeze queue for target address, and push the query result to stack.

0x100000d: UnfreezableBalanceV2

The UnfreezableBalanceV2 takes 2 parameters:

target: target account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the unfreezable balance of a specified resourceType for target address, and push the query result to stack.

0x100000e: ExpireUnfreezeBalanceV2

The ExpireUnfreezeBalanceV2 takes 2 parameters:

target: target account address.

timestamp: query cutoff timestamp.

Query the withdrawal balance at the specified timestamp for target address, and push the query result to stack.

0x100000f: DelegatableResource

The DelegatableResource takes 2 parameters:

target: target account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the amount of delegatable resources(unit: SUN) of the specified resourceType for target address, and push the query result to stack.

0x1000010: ResourceV2

The ResourceV2 takes 3 parameters:

target: target account address.

from: from account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the amount of resources(unit: SUN) of a specific resourceType delegated by from address to target address

0x1000011: CheckUnDelegateResource

The CheckUnDelegateResource takes 3 parameters:

target: target account address.

amount: resource amount to undelegate in SUN.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Check whether the contract can recycle the specified amount of resources of a specific resourceType that have been delegated to target address, and push the amount of clean resource(unit: SUN), the amount of dirty resource(unit: SUN) and the restore time to stack.

0x1000012: ResourceUsage

The ResourceUsage takes 2 parametes:

target: target account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the usage of a specific resourceType of resources for target address, and push the amount of usage(unit: SUN) and the restore time to stack.

0x1000013: TotalResource

The TotalResource takes 2 parameters:

target: target account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the total amount of available resources(unit: SUN) of a specific resourceType for target address, and push the query reslut to stack.

0x1000014: TotalDelegatedResource

The TotalDelegatedResource takes 2 parameters:

target: target account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the amount of delegated resources of a specific resourceType for target address, and push the query reslut to stack.

0x1000015: TotalAcquiredResource

The TotalAcquiredResource takes 2 parameters:

target: target account address.

resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.

Query the amount of acquired resources(unit: SUN) of a specific resourceType for tareget address, and push the query reslut to stack.

Solidity example

Here is an example showing how to call the above TVM instructions in solidity:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

contract FreezeV2Example {

    event BalanceFreezedV2(uint, uint);
    event BalanceUnfreezedV2(uint, uint);
    event AllUnFreezeV2Canceled();
    event ExpireUnfreezeWithdrew(uint);
    event ResourceDelegated(uint, uint, address);
    event ResourceUnDelegated(uint, uint, address);

    constructor() payable {}

    fallback() payable external {}

    receive() payable external {}

    function freezeBalanceV2(uint amount, uint resourceType) external {
        freezebalancev2(amount, resourceType);
        emit BalanceFreezedV2(amount, resourceType);
    }

    function unfreezeBalanceV2(uint amount, uint resourceType) external {
        unfreezebalancev2(amount, resourceType);
        emit BalanceUnfreezedV2(amount, resourceType);
    }

    function cancelAllUnfreezeV2() external {
        cancelallunfreezev2();
        emit AllUnFreezeV2Canceled();
    }

    function withdrawExpireUnfreeze() external returns(uint amount) {
        amount = withdrawexpireunfreeze();
        emit ExpireUnfreezeWithdrew(amount);
    }

    function delegateResource(uint amount, uint resourceType, address payable receiver) external {
        receiver.delegateResource(amount, resourceType);
        emit ResourceDelegated(amount, resourceType, receiver);
    }

    function unDelegateResource(uint amount, uint resourceType, address payable receiver) external {
        receiver.unDelegateResource(amount, resourceType);
        emit ResourceUnDelegated(amount, resourceType, receiver);
    }

    function getChainParameters() view public returns(uint, uint, uint, uint, uint) {
        return (chain.totalNetLimit, chain.totalNetWeight,
                chain.totalEnergyCurrentLimit, chain.totalEnergyWeight,
                chain.unfreezeDelayDays);
    }

    function getAvailableUnfreezeV2Size(address target) view public returns(uint) {
        return target.availableUnfreezeV2Size();
    }

    function getUnfreezableBalanceV2(address target, uint resourceType) view public returns(uint) {
        return target.unfreezableBalanceV2(resourceType);
    }

    function getExpireUnfreezeBalanceV2(address target, uint timestamp) view public returns(uint) {
        return target.expireUnfreezeBalanceV2(timestamp);
    }

    function getDelegatableResource(address target, uint resourceType) view public returns(uint, uint) {
        return (target.delegatableResource(resourceType), block.number);
    }

    function getResourceV2(address target, address from, uint resourceType) view public returns(uint) {
        return target.resourceV2(from, resourceType);
    }

    function checkUnDelegateResource(address target, uint amount, uint resourceType) view public returns(uint, uint, uint, uint) {
        (uint clean, uint dirty, uint restoreTime) = target.checkUnDelegateResource(amount, resourceType);
        return (clean, dirty, restoreTime, block.number);
    }

    function getResourceUsage(address target, uint resourceType) view public returns(uint, uint, uint) {
        (uint dirty, uint restoreTime) = target.resourceUsage(resourceType);
        return (dirty, restoreTime, block.number);
    }

    function getTotalResource(address target, uint resourceType) view public returns(uint) {
        return target.totalResource(resourceType);
    }

    function getTotalDelegatedResource(address from, uint resourceType) view public returns(uint) {
        return from.totalDelegatedResource(resourceType);
    }

    function getTotalAcquiredResource(address target, uint resourceType) view public returns(uint) {
        return target.totalAcquiredResource(resourceType);
    }

    function killme(address payable target) external {
        selfdestruct(target);
    }
}

Backward Compatibility

After the proposal of the new mechanism is opened, it will not affect the previously frozen TRX. For those TRX frozen through the old mechanism, it can be redeemed using the old unstake interface. If needed, the only way to stake in the future is through the new mechanism.

@ethan1844 ethan1844 added enhancement New feature or request good first issue Good for newcomers discussions-to labels Sep 28, 2022
@BlueSkyXN
Copy link

GOOD

@clarklee186
Copy link

Great thought.

@CryptoRhinoGH
Copy link

CryptoRhinoGH commented Sep 28, 2022

It sounds like not such a bad idea, however the implementation is not clear at all. In tron currently, there is a huge market for selling energy. In that sense, the current model provides stability and security to these buyers who are expecting to receive the energy for at least 3 days with the current model.
I believe, due to this reason, redelegating should just be implemented with the current time frame(min freeze time). Apart from this, the max freeze time should be increased allowing users to freeze for more number of days as set while freezing. Once the amount is frozen, the redelegation should not be until The unfreeze time has been reached as set in the freeze/redelegation transaction. This would ensure protection of buyers of energy, apart from it having an inclination towards lesser unfreezes (for improved TRX stability which might be very less, but could also be pretty effective) as well.

The redelgation of resources would be a wonderful idea if/when implemented, as it would reduce bandwidth costs of having to vote, unfreeze and refreeze, which could just be written over with a simple method of changing the address the resources are delegated to.

On the other hand, as a developer, I can see this having a slight number of issues with choosing the best lath for implementation. One such main issue that immediately comes to mind is the amount which you're redelgating. What if someone wants to redelegate a larger amount than that frozen for one account? Would you allow them to input a larger for TRX staked and use another frozen amount from another account (from lowest to highest unfreeze time that has passed)?

To make this question more clear, let's stake an example. For example addr x had 3000 TRX staked, addr y (with a larger unfreeze time than x which has also passed) has 3000 TRX staked. You redelegate 4000 TRX. In terms of efficiency, would it be better to use 3000 from addr x and 1000 from addr y? Or to limit the usage to 3000 and redelagting from just addr x and then redelgating 1000 from addr y? Even in this case, does the remaining 2000 for addr y have a new unfreeze time or not?

There are plenty of ways to implement this. Although I would love to hear more about specifically how redelgation would help in times of market fluctuations to keep TRX stable? And what implications (as mentioned by you) does it have on the stake model currently?

@caohuiboss
Copy link

I agree with this proposal, which is conducive to the efficient use of tron's resources, but I still have the following questions

  1. Do I need to wait for three days to transfer the resources that I have frozen to user a's address directly to user b's address without unfreezing?
  2. Will the voting change after the transfer?
  3. Will unfreezeBalance in tronweb be canceled directly in the future, or is it only used when I need to recover all the resources in the end?
  4. If there is no freeze time limit, does it mean that we can flexibly choose the freeze time? What is the time interval?
  5. Suppose my address has a trx of 2w resources. Now I have frozen 10,000 resources for user a, and I will freeze 2w resources for user b in the next two days. Will there be a dynamic merge operation, such as automatically merging the resources of user a? Should I freeze b with my remaining resources, or can I only do it step by step?
  6. Assuming the proposal is implemented, will it affect me if I still use the previous model?

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Sep 28, 2022

@CryptoRhinoGH
My expectation is that after upgrading, unstaking can only be released from the available resources. The resources that have been delegated can not be released from the unstaking, and there is no longer time to unfreeze them. Instead, the assets will be retrieved in a way of delayed receipt. I am thinking about how to specify this scheme, which will be updated later.

@Binulaj
Copy link

Binulaj commented Sep 28, 2022

I suggest we need a function to stake our Tron for a customized unstake period, like 1 week or 2 months or 2 years with minimum 3 days mandatory unstake period, this will further improve longer period tron staking in the tron network and it also helps the tron energy and bandwidth renting market

@Phoenix-Fragrant
Copy link

Phoenix-Fragrant commented Sep 28, 2022

@Binulaj

I think the problem is not the unstake period, but how to make full use of the mortgage resources to make them better used

@joker-gdb
Copy link

I suggest we need a function to stake our Tron for a customized unstake period, like 1 week or 2 months or 2 years with minimum 3 days mandatory unstake period, this will further improve longer period tron staking in the tron network and it also helps the tron energy and bandwidth renting market

Chain itself should not implement this, it is generally implemented through smart contracts, but requires EVM/TVM to support staking-related instructions.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Sep 28, 2022

@caohuiboss
Thanks,

  1. In my expectation, there should be no 3 day limit before unstaking. In my opinion, we can retrieve delegated resource and transfer to another one without unstaking.
  2. If without unstaking, voting would not change a bit.
  3. Not sure about that. There might be new commands for the new mechanism.
  4. As I state above, I hope the 3 day limit should be revoked, staked TRX can be released at any time, but the arrival of TRX could be delayed to the account, to play a similar part of the 3 day limit, in which the delay period is configurable.
  5. Step by step I think.
  6. No, the upgrade will be compatible

@Binulaj
Copy link

Binulaj commented Sep 28, 2022

@Phoenix-Fragrant

To clear my idea again, The issue is about the unstake period because if we implement a customised unstake period then this gives energy/bandwidth buyers a guarantee, this will be highly positive for the energy/bandwidth renting market and also improve long period unstakeble tron on the network, we can publicly shill this information on Twitter or social media

@fbsobreira
Copy link

Great news! IMO this TIP is a great opportunity to enhance the stake/resources system! Would love to see this implementation

@Binulaj
Copy link

Binulaj commented Sep 28, 2022

This proposal will lead to stop the deflation of tron if the majority of srs start to sell energy at cheap

@dmf3030
Copy link

dmf3030 commented Sep 28, 2022

This feels like a way for very large wallets to be able to sell energy into the market without having to worry about missing voting rewards or potentially shifting SR rankings. The energy market is a solid part of the Tron community now, and lets not forget that a bit of energy scarcity is a good thing, it drives users to buy TRX to the point where they then can freeze to offset their cost. I'm not convinced that this is a good idea. It feels like it would take a system that is running relatively well and introduce a good bit of uncertainty.

I predict the first thing that happens if you can redelegate energy without restaking is that all the large wallets that are frozen to bandwidth will then freeze for energy. This will reduce network energy for everyone else. Then those large wallets will sit on that energy, without missing any voter rewards, they can then sell it at the leisure, those controlling the energy market and driving more money into the very top wallets. Currently the energy market is serviced by mid range holders and even small holders who fill energy orders. I see this going away and many of those smaller and mid range holders who have been accruing TRX to continue to rent it would then likely return to selling daily rewards.

In short I see this potentially creating an energy cartel of the topmost whales at the expense of the smaller more open energy market that exists today.

@DmytroShalaiev
Copy link

Good idea but I think we can face problems with redelegating resources from the account when it already used resources
And resource owner wants to re-delegate these resources to the second account.

Problem: how the first account should repair resources, they will be in minus after re-delegating by the owner?

Solution: allow redelegation of resources from the first account to the second only when the first account repairs all used delegated resources

@otakuinny
Copy link

otakuinny commented Sep 28, 2022

This proposal is short on clear details. But if I understand it right, it is proposing the following main things

  1. Resources can be delegated to different addresses without having to perform unstake operation
  2. It says "the new mechanism should implement the delayed arrival of unstaking TRX" but doesn't explain exactly how

First of all, it proposes too many changes. Second, it says several times that the current resource utilization is in-efficient and this proposal will improve it but I just don't see how. How would being able to delegate resources whenever you want be beneficial to anyone other than those with big TRX bags. This sounds like it is only helpful to those that want to delegate their energy for a fees without having to wait for 3 days. So, in this case, they'd be able to delegate energy for 1 day instead of 3 days. This would help big whales corner the resource renting market and hurt smaller holders

Another TIP that is disguised as something that benefits the whole TRON community when it actually only benefits those with large TRX accounts to sell their energy resources. There is already too many TRX in circulation which is one of the factors affecting the price. Like someone above said, this will burn fewer TRX everyday as people would just rent energy instead of burning TRX for their transactions. This will be very bad for the price of TRX as there will be more and more TRX everyday.

For me, this proposal is a big NO because it doesn't solve any current problems, but creates a few new problems, the most glaringly obvious one being that it stops TRX from being deflationary.

@Jakevsky
Copy link

Jakevsky commented Sep 29, 2022

@otakuinny It is motivation, not a solution bro, no need to show how at this step.
I think the "delayed arrival of unstaking TRX", is the answer to the revoke of the 3-day limit to unstake TRX. I learned that it does not mean you can stake for resources, then unstake the next day, so that you may keep the resources and your TRX in the meantime, it does not make sense. Once unstaked, voting and benefits will be gone.
Second, you confused me with your point. If, as you said, it is bad for the price of TRX, how could it benefit those with large TRX accounts? They lose the most.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Sep 29, 2022

@otakuinny
In fact, this can solve some problems in the existing mechanism. In my expectation, staking, unstaking, delegate resource and other operations are independent. After staking, you can unstake at any time. However, for the rational use of resources, the TRX with unstaking and postponement needs to be delayed to the account, and the length of the delay can be discussed separately.
Resources can be entrusted to other accounts after being staked, but only the resources currently available in the staking account can be entrusted. After being entrusted to other accounts, I would like to propose the concept of usage. When recycling resources, the usage of resources should also be brought back to prevent the resources from being reused by the lender. The usage of resources should be recycled according to the proportion of resources

Also, you mentioned that it is not conducive to deflation. I think the final result will not tend to inflation. Leasing resources also needs to pledge TRX to support this behavior, which will not lead to reduced use of TRX.

@joker-gdb
Copy link

joker-gdb commented Sep 29, 2022

This TIP will spawn a huge energy market. About 1 year ago, I also considered putting some of my TRX into the energy market to gain income, but then I gave up. Now the energy market is too small, it is difficult for my TRX to go out at one time. Because if someone needs to rent, I need to unfreeze and then freeze and delegrate the energy to him, but I can't get income by freezing my remaining TRX. Once I freeze to get voting income, I will not be able to rent for the next 3 days.

I think TVM should add staking-related instructions, so that a liquidity mining pool can be realized through smart contracts. The income of this pool comes from voting and lease . This is a major progress, because some decentralized energy markets will be created, these energy markets are not just a place to trade energy, but a decentralized liquidity mining pool.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Sep 29, 2022

@joker-gdb
I'm not sure whether the current TRON ecosystem supports this, but I think it's a good suggestion. Maybe it's helpful to add these instructions as you said.

@tronprotocol tronprotocol deleted a comment from armin128 Sep 29, 2022
@kunlunxuejue11
Copy link

Sounds good, unstaking and getting the funds immediately, it seems to be invisible on other chains, such as EOS, DOT, COSMOS, maybe you guys can learn from these implementations.

@otakuinny
Copy link

@otakuinny It is motivation, not a solution bro, no need to show how at this step. I think the "delayed arrival of unstaking TRX", is the answer to the revoke of the 3-day limit to unstake TRX. I learned that it does not mean you can stake for resources, then unstake the next day, so that you may keep the resources and your TRX in the meantime, it does not make sense. Once unstaked, voting and benefits will be gone. Second, you confused me with your point. If, as you said, it is bad for the price of TRX, how could it benefit those with large TRX accounts? They lose the most.

@Jakevsky, this TIPs section is not for half-baked ideas with no real details. If you have half an idea, you need to fully think through on how exactly it is supposed to work and then post your proposal. Take a look at all the other proposals. They all explain exactly what they want to happen and how. This proposal basically says, there needs to be a better resources model but doesn't explain anything else.

As for your question about large TRX accounts, the commissions they can earn by renting out their TRX will more than make up for any changes in the TRX prices that are caused by the Inflation this proposal creates so they don't care cos they still make money.

@otakuinny
Copy link

@otakuinny In fact, this can solve some problems in the existing mechanism. In my expectation, staking, unstaking, delegate resource and other operations are independent. After staking, you can unstake at any time. However, for the rational use of resources, the TRX with unstaking and postponement needs to be delayed to the account, and the length of the delay can be discussed separately. Resources can be entrusted to other accounts after being staked, but only the resources currently available in the staking account can be entrusted. After being entrusted to other accounts, I would like to propose the concept of usage. When recycling resources, the usage of resources should also be brought back to prevent the resources from being reused by the lender. The usage of resources should be recycled according to the proportion of resources

Also, you mentioned that it is not conducive to deflation. I think the final result will not tend to inflation. Leasing resources also needs to pledge TRX to support this behavior, which will not lead to reduced use of TRX.

@lxcmyf, my main concern is not about the unstaking but with the disruption in the energy market this creates as this is only beneficial for large TRX holders and hurts small holders.

The accounts that are staking and not doing anything with the resources they are receiving are already locking their TRX up. In your new scheme, those trx will still be locked except now they can delegate resources without unstaking and within the mandatory 3 day period. So, the only thing that changes is that whales are gonna make more money at the expense of small trx bag holders. And, it will definitely lead to inflation as more people will just rent energy and not burn any TRX for transactions.

I just have a simple question for everybody. Who does this proposal benefit? Think about the answer and you'll realize this is not good for the TRON community in general.

@otakuinny
Copy link

This TIP will spawn a huge energy market. About 1 year ago, I also considered putting some of my TRX into the energy market to gain income, but then I gave up. Now the energy market is too small, it is difficult for my TRX to go out at one time. Because if someone needs to rent, I need to unfreeze and then freeze and delegrate the energy to him, but I can't get income by freezing my remaining TRX. Once I freeze to get voting income, I will not be able to rent for the next 3 days.

I think TVM should add staking-related instructions, so that a liquidity mining pool can be realized through smart contracts. The income of this pool comes from voting and lease . This is a major progress, because some decentralized energy markets will be created, these energy markets are not just a place to trade energy, but a decentralized liquidity mining pool.

What you said proves this proposal is no good. This only benefits those that can use their TRX to sell resources all at the expense of those that can't and it also leads to massive Inflation of TRX supply which will negatively affect the price.

The current resources model works just fine. If anything the only thing that can make it better is if the user can freeze their TRX for more than 3 days.

@dmf3030
Copy link

dmf3030 commented Sep 29, 2022

This proposal is short on clear details. But if I understand it right, it is proposing the following main things

  1. Resources can be delegated to different addresses without having to perform unstake operation
  2. It says "the new mechanism should implement the delayed arrival of unstaking TRX" but doesn't explain exactly how

First of all, it proposes too many changes. Second, it says several times that the current resource utilization is in-efficient and this proposal will improve it but I just don't see how. How would being able to delegate resources whenever you want be beneficial to anyone other than those with big TRX bags. This sounds like it is only helpful to those that want to delegate their energy for a fees without having to wait for 3 days. So, in this case, they'd be able to delegate energy for 1 day instead of 3 days. This would help big whales corner the resource renting market and hurt smaller holders

Another TIP that is disguised as something that benefits the whole TRON community when it actually only benefits those with large TRX accounts to sell their energy resources. There is already too many TRX in circulation which is one of the factors affecting the price. Like someone above said, this will burn fewer TRX everyday as people would just rent energy instead of burning TRX for their transactions. This will be very bad for the price of TRX as there will be more and more TRX everyday.

For me, this proposal is a big NO because it doesn't solve any current problems, but creates a few new problems, the most glaringly obvious one being that it stops TRX from being deflationary.

We've both been around since the beginning and I know both have a clear idea how these TIPS and chain changes get pushed through and also who typically benefits. But even if we look past the obvious point that this is for the benefit of whales and potentially TronDAO itself, you also keyed on a very important point. These are big changes, and complicated changes, this is not just raising the energy price or setting a longer timeout on the TVM. This is tinkering with the very delicate balance that is resources, something thats been relatively successful for years now. It is like you said, half baked at best and way to complicated and large a thing to just brashly change.

On top of this, we are rapidly approaching the time when USDD was supposed to have its burn mechanism cut into javatron, something that is also a big change and very delicate. I see very little reason to risk changing the resource system that has worked so well for so long and I think it points to big players once again steam rolling changes on the chain for their own benefit.

@dmf3030
Copy link

dmf3030 commented Sep 29, 2022

Again people need to think about how this would play out. TronDAO and other very large players have billions of TRX frozen for bandwidth because those TRX are voting for their SRs. The reason those large wallets don't sell energy is because they can't risk SR positions and staking rewards by leaving TRX unfrozen waiting for energy orders. They can't practically sell the energy from their billions of TRX, so they don't currently sell.

Now if they can freeze one time and then redelegate as they wish, heres what will happen: The large large wallets will freeze for energy and just like when binance accidentally froze for energy a while back, the amount of available energy for everyone else will dramatically decrease. So the first result will be a sudden loss of energy for most small and middle users. This of course creates scarcity and will force those people to now look to buy energy, where previously they may have accrued enough TRX to freeze and cover their usage. So now they go looking for energy and the massive wallets will become the main sellers because they can undercut the market due to huge supply. So basically it will both hurt small users while benefitting many huge wallets that already collect staking rewards and do little else in terms of contributing.

I fail to see the upside to this proposal and this is without considering the details of implementation, which if flawed, could cause havoc on the chain.

@otakuinny
Copy link

If it's a problem, it's reasonable to fix it, what does it matter how many years. According to your logic, if there is no impact in the past 4 years, it means that there are very few users involved. If this is the case, how much impact will it have if it is repaired? If it is fixed, only a small number of people who rent energy can no longer “steal” energy. Of course, I think this fix is not the focus of Stake 2.0, and the discussion is not very meaningful.

If there is a problem, it should be fixed the right way. This fix will cause further problems.

I didn't say only small number of users use excess energy. It could be the that almost all the users who receive energy use more energy than they paid for inadvertently. This hasn't been an issue because the total amount of energy used on any given day never came even close to the total energy limit of 90 billion. So, the total energy consumed including the excess Energy used by receivers was always under this limit so this was never an issue.

But, when you start debiting it from the owner it will have noticeable repercussions, as there'll be thousands of energy receivers complaining why they didn't receive the full energy they paid for.

Changing this will have severe adverse affects on the resource rental market. There are some good features in stake 2.0 but this is not one of them. If this is change is implemented, that will be it for me on TRON. And, trust me, you'll notice the decrease in on chain activity if my dapps are migrated to BSC.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Dec 26, 2022

If it's a problem, it's reasonable to fix it, what does it matter how many years. According to your logic, if there is no impact in the past 4 years, it means that there are very few users involved. If this is the case, how much impact will it have if it is repaired? If it is fixed, only a small number of people who rent energy can no longer “steal” energy. Of course, I think this fix is not the focus of Stake 2.0, and the discussion is not very meaningful.

If there is a problem, it should be fixed the right way. This fix will cause further problems.

I didn't say only small number of users use excess energy. It could be the that almost all the users who receive energy use more energy than they paid for inadvertently. This hasn't been an issue because the total amount of energy used on any given day never came even close to the total energy limit of 90 billion. So, the total energy consumed including the excess Energy used by receivers was always under this limit so this was never an issue.

But, when you start debiting it from the owner it will have noticeable repercussions, as there'll be thousands of energy receivers complaining why they didn't receive the full energy they paid for.

Changing this will have severe adverse affects on the resource rental market. There are some good features in stake 2.0 but this is not one of them. If this is change is implemented, that will be it for me on TRON. And, trust me, you'll notice the decrease in on chain activity if my dapps are migrated to BSC.

I try to understand your question. You mean that A delegates energy to B and then delegates it to C after recycling it from B, because only a part of it is recycled, so C cannot use all the energy that A delegates to itself? If this is the case, this will not happen. A can only delegates unused resources to C. As long as the energy that A delegates to C can be used completely.

@otakuinny
Copy link

otakuinny commented Dec 26, 2022

If it's a problem, it's reasonable to fix it, what does it matter how many years. According to your logic, if there is no impact in the past 4 years, it means that there are very few users involved. If this is the case, how much impact will it have if it is repaired? If it is fixed, only a small number of people who rent energy can no longer “steal” energy. Of course, I think this fix is not the focus of Stake 2.0, and the discussion is not very meaningful.

If there is a problem, it should be fixed the right way. This fix will cause further problems.
I didn't say only small number of users use excess energy. It could be the that almost all the users who receive energy use more energy than they paid for inadvertently. This hasn't been an issue because the total amount of energy used on any given day never came even close to the total energy limit of 90 billion. So, the total energy consumed including the excess Energy used by receivers was always under this limit so this was never an issue.
But, when you start debiting it from the owner it will have noticeable repercussions, as there'll be thousands of energy receivers complaining why they didn't receive the full energy they paid for.
Changing this will have severe adverse affects on the resource rental market. There are some good features in stake 2.0 but this is not one of them. If this is change is implemented, that will be it for me on TRON. And, trust me, you'll notice the decrease in on chain activity if my dapps are migrated to BSC.

I try to understand your question. You mean that A delegates energy to B and then delegates it to C after recycling it from B, because only a part of it is recycled, so C cannot use all the energy that A delegates to itself? If this is the case, this will not happen. A can only delegates unused resources to C. As long as the energy that A delegates to C can be used completely.

  • A delegates 100 trx (2000 energy) to B on Day 1 at 00:00

  • By the end of day 3, B used a total of 8000 energy like below
    Uses 2000 energy on Day 1 at 00:00
    Uses 2000 energy on Day 2 at 00:00
    Uses 2000 energy on Day 3 at 00:00
    Uses 2000 energy on Day 3 at 23:59

  • A undelegates 100 trx from B

  • A delegates the same 100 trx to C

  • C will have 0 energy for the first 24 hours because B used 2000 excess Energy.

In the current system, C gets 2000 energy even when B uses excess energy. This is how it should work. This system should not change.

@lxcmyf, please let us know what is the part that is confusing you?

@otakuinny
Copy link

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem

This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

@otakuinny
Copy link

This proposal has the law of unintended consequences written all over it. It changes so many things it is impossible to predict how many ways these changes affect the whole eco-system negatively.

For example, if staking and resource delegation are not separated, then everybody will just stake for energy in the hopes to sell(delegate) energy. But majority of them won't sell energy because there aren't as many buyers as there are sellers. But since they all staked for energy, it'll bring the energy per trx frozen rate significantly down, just like bandwidth. When this rate is down, even renting energy won't save a lot of trx. This will cause a situation where all transactions will cost trx to be burned since freezing doesn't give enough energy. When this happens, no one will make any transactions and that will be the end of tron. This is a very real possibility.

This can be prevented by simply decoupling staking and resource delegation. Staking should only give voting rights and resource delegation should be used to assign actual resources. Not sure why tron foundation is refusing to make this simple, yet highly needed, change 🤔.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Dec 27, 2022

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem

This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

@otakuinny
Copy link

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem
This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

You understand the problem and yet say it is not a problem.

The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A.

I don't think you understand how smart contracts work. If B uses additional energy than he paid for, a contract DOES NOT have the ability to transfer trx from account B's account for excess energy usage. So, I'm not sure what contract flexibility you are talking about,

In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

This suggestion is ridiculous. It creates so much un-necessary overhead and maintenance and can easily lead to owner and receiver disputes when owner charges more for receiver's excess usage and receiver says he did not use any. I don't think you are thinking about any of these situations very seriously. You sound like you are just saying whatever comes to your mind.

If you don't make any changes to the model and keep it as it is now, then none of the above issues will be a problem in the new model. Why are you offering half-assed solutions to a complex problem when there is a simple solution available.

@joker-gdb
Copy link

joker-gdb commented Dec 27, 2022

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem
This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

B did not use 2000 excess energy, before A undelegate the resource, B has the right to use all the energy, this is the rule of system design.

I think this change is reasonable, "stealing energy" exists in Stake 1.0, in the above example, after A undelegate the resource, A immediately gets 2000 energy, the 2000 energy bypasses the recovery mechanism, Stake 2.0 fix the issue.

Different people have different understandings of whether 2000 energy should take time to restore, the energy owner hopes that he can get 2000 energy directly, pre-charges is a solution for the energy owner.

@otakuinny
Copy link

otakuinny commented Dec 27, 2022

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem
This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

B did not use 2000 excess energy, before A undelegate the resource, B has the right to use all the energy, this is the rule of system design.

I think this change is reasonable, "stealing energy" exists in Stake 1.0, in the above example, after A undelegate the resource, A immediately gets 2000 energy, the 2000 energy bypasses the recovery mechanism, Stake 2.0 fix the issue.

Different people have different understandings of whether 2000 energy should take time to restore, the energy owner hopes that he can get 2000 energy directly, pre-charges is a solution for the energy owner.

Nope, pre-charging and sending the trx back to the receiver is a stupid idea. Like i said before, it creates unnecessary disputes, and also creates unnecessary transactions. It is one of the stupidest ideas I have ever heard.

You keep talking about B having a right to use energy. I don't give a #$@% about B's rights. All I care about is owner losing 25% of the revenue if the resource doesn't recover fully immediately.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Dec 27, 2022

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem
This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

You understand the problem and yet say it is not a problem.

The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A.

I don't think you understand how smart contracts work. If B uses additional energy than he paid for, a contract DOES NOT have the ability to transfer trx from account B's account for excess energy usage. So, I'm not sure what contract flexibility you are talking about,

In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

This suggestion is ridiculous. It creates so much un-necessary overhead and maintenance and can easily lead to owner and receiver disputes when owner charges more for receiver's excess usage and receiver says he did not use any. I don't think you are thinking about any of these situations very seriously. You sound like you are just saying whatever comes to your mind.

If you don't make any changes to the model and keep it as it is now, then none of the above issues will be a problem in the new model. Why are you offering half-assed solutions to a complex problem when there is a simple solution available.

Stack1.0 has the problem of energy reuse in a short period of time. The Stack2.0 protocol prevents this phenomenon from continuing. The design of the agreement needs to take into account the interests of the lender and renter, and there is no bias towards either party. In addition, both centralized and decentralized resource market products can adopt diversified strategies, which can not only prevent owners from bearing losses through withholding fees, but also allow owners to bear the cost of exceeding the lending time, so as to attract more users to use their own products, and also allow users to directly pay the cost of using beyond the lending time. This will be at the discretion of the project party.

@otakuinny
Copy link

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem
This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

You understand the problem and yet say it is not a problem.
The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A.
I don't think you understand how smart contracts work. If B uses additional energy than he paid for, a contract DOES NOT have the ability to transfer trx from account B's account for excess energy usage. So, I'm not sure what contract flexibility you are talking about,
In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.
This suggestion is ridiculous. It creates so much un-necessary overhead and maintenance and can easily lead to owner and receiver disputes when owner charges more for receiver's excess usage and receiver says he did not use any. I don't think you are thinking about any of these situations very seriously. You sound like you are just saying whatever comes to your mind.
If you don't make any changes to the model and keep it as it is now, then none of the above issues will be a problem in the new model. Why are you offering half-assed solutions to a complex problem when there is a simple solution available.

Stack1.0 has the problem of energy reuse in a short period of time. The Stack2.0 protocol prevents this phenomenon from continuing. The design of the agreement needs to take into account the interests of the lender and renter, and there is no bias towards either party. In addition, both centralized and decentralized resource market products can adopt diversified strategies, which can not only prevent owners from bearing losses through withholding fees, but also allow owners to bear the cost of exceeding the lending time, so as to attract more users to use their own products, and also allow users to directly pay the cost of using beyond the lending time. This will be at the discretion of the project party.

Stack1.0 has the problem of energy reuse in a short period of time.

Who said this is a problem? You haven't given one reason why this is a problem.

The design of the agreement needs to take into account the interests of the lender and renter, and there is no bias towards either party.

How is losing 25% of the revenue in interest of the owner? The bias may not be intentional but it is accidental. Never attribute to malice that which can be adequately explained by stupidity.

...allow owners to bear the cost of exceeding the lending time, so as to attract more users to use their own products.

So, one of your suggestions is for owners to just take the loss? Also, the owners know how to "attract more users"; they don't need suggestions from someone who doesn't even know how smart contracts work and yet somehow mysteriously works at the tron foundation. SMH 😆

...and also allow users to directly pay the cost of using beyond the lending time.

Right. Because this totally works! After the rental period, if the receiver uses more energy, the owner can simply somehow ask the receiver to pay more and the receiver will just pay it. Your lack of understanding of the resource rental market is mind boggling.

Charging for an additional day and refunding after the rental period doesn't work because the receiver will always insist that they haven't used any excess energy cos they don't understand the concept of energy replenishment.

I think you have already made several changes to the model while the conversation on this proposal is still ongoing, and is the reason why you won't listen to any of the community suggestions. I am done trying to convince you why these changes are bad. So long; I wish I could say it was fun but it wasn't. I think I lost a few brain cells for having engaged with idiots. Now that I know what kind of people work at the tron foundation, it's future became very clear to me. Thank you for giving me a peek into your clown world.

@joker-gdb
Copy link

From the perspective of system design, the energy used is instantly restored, bypassing the recovery mechanism, which is a system design problem, this will cause "energy stealing". the resouce owner get 25% profit for a long time, if Stake 2.0 fixes this problem, the owner thinks that he has lost 25% profit, I think the idea is terrible. Of course, if the energy owner thinks that the resource receiver should not overuse the resource, pre-charging is also fair for them. Stake 2.0 provides enough APIs to query the status of resources, and Tronscan also provides the daily energy usage data of every account, these data is open and transparent for everyone, and there is no obstacle to pre-charging, and it will not cause controversy.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Dec 28, 2022

@lxcmyf, if you are saying, in the above example, A cannot delegate 100 trx to C if those 100 trx have no energy left, then, this is still a problem
This causes A to lose a whole day's worth of revenue, while B gets to use energy he didn't pay for. How does this make resource rental market better when resource owners are shafted?? Basically, this will reduce the revenue of resource owners by 25%, which will be devastating. How would you feel if Tron foundation cuts your pay by 25% for absolutely no reason at all?

I understand your concern. You are worried that B uses the energy at the last moment of the lock period, which makes it impossible for A to use the recovered energy immediately. But this is not a problem. The implementation of the contract is very flexible. The contract provides many query interfaces, so that the contract developer can charge according to the energy usage of the delegated object when recovering the energy. The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A. In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.

You understand the problem and yet say it is not a problem.
The typical implementation is: first, charge according to the duration of B's lease, and then make an additional charge according to B's current energy usage as an offset to A.
I don't think you understand how smart contracts work. If B uses additional energy than he paid for, a contract DOES NOT have the ability to transfer trx from account B's account for excess energy usage. So, I'm not sure what contract flexibility you are talking about,
In addition, centralized energy leasing can charge users an extra day's money first, and then return it according to their usage.
This suggestion is ridiculous. It creates so much un-necessary overhead and maintenance and can easily lead to owner and receiver disputes when owner charges more for receiver's excess usage and receiver says he did not use any. I don't think you are thinking about any of these situations very seriously. You sound like you are just saying whatever comes to your mind.
If you don't make any changes to the model and keep it as it is now, then none of the above issues will be a problem in the new model. Why are you offering half-assed solutions to a complex problem when there is a simple solution available.

Stack1.0 has the problem of energy reuse in a short period of time. The Stack2.0 protocol prevents this phenomenon from continuing. The design of the agreement needs to take into account the interests of the lender and renter, and there is no bias towards either party. In addition, both centralized and decentralized resource market products can adopt diversified strategies, which can not only prevent owners from bearing losses through withholding fees, but also allow owners to bear the cost of exceeding the lending time, so as to attract more users to use their own products, and also allow users to directly pay the cost of using beyond the lending time. This will be at the discretion of the project party.

Stack1.0 has the problem of energy reuse in a short period of time.

Who said this is a problem? You haven't given one reason why this is a problem.

The design of the agreement needs to take into account the interests of the lender and renter, and there is no bias towards either party.

How is losing 25% of the revenue in interest of the owner? The bias may not be intentional but it is accidental. Never attribute to malice that which can be adequately explained by stupidity.

...allow owners to bear the cost of exceeding the lending time, so as to attract more users to use their own products.

So, one of your suggestions is for owners to just take the loss? Also, the owners know how to "attract more users"; they don't need suggestions from someone who doesn't even know how smart contracts work and yet somehow mysteriously works at the tron foundation. SMH 😆

...and also allow users to directly pay the cost of using beyond the lending time.

Right. Because this totally works! After the rental period, if the receiver uses more energy, the owner can simply somehow ask the receiver to pay more and the receiver will just pay it. Your lack of understanding of the resource rental market is mind boggling.

Charging for an additional day and refunding after the rental period doesn't work because the receiver will always insist that they haven't used any excess energy cos they don't understand the concept of energy replenishment.

I think you have already made several changes to the model while the conversation on this proposal is still ongoing, and is the reason why you won't listen to any of the community suggestions. I am done trying to convince you why these changes are bad. So long; I wish I could say it was fun but it wasn't. I think I lost a few brain cells for having engaged with idiots. Now that I know what kind of people work at the tron foundation, it's future became very clear to me. Thank you for giving me a peek into your clown world.

Assuming that only A stakes and obtains the resources of the entire network and delegates all the resources to B, B can use all the resources of the entire network. After B's using, A immediately releases the delegate and then delegates all the resources to C, and C can use them again. Then in a short period of time, both B and C use all the resources of the entire network at the same time.
The energy recovery mechanism is very necessary. This is a constant premise. The energy reuse of stake1.0 bypasses the energy recovery mechanism; the owner's loss you are worried about will be determined by the owner's distribution of benefits. The solution mentioned above is just an example. He has the right to choose independently. My original intention is to maintain the clarity and transparency of the protocol on the chain. Under the premise of clear rules, the cost of understanding for users will also be reduced.

@ustx
Copy link

ustx commented Jan 16, 2023

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

@lxcmyf why the Solidity implementation of the delegateresource function does not implement the 3 days lock period, while the API does?

@otakuinny
Copy link

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

@lxcmyf why the Solidity implementation of the delegateresource function does not implement the 3 days lock period, while the API does?

Also, the resourceType has a new supported value called tron power. Does this mean when contracts freeze trx they can only receive either tron resources (0 or 1) or voting power (2)? What about user accounts? This is very in-consistent and confusing.

Any comment on why freezing and resource delegation can't be de-coupled? If freezing automatically gives resources, it will create serious wastage of resources. Freezing should only give voting power, and resources should only be assigned when delegate resource operation is called. This is a simple common sense solution.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Jan 17, 2023

Close this issue as it is implemented by GreatVoyage-v4.7.0.1.
Check TIP detail at TIP-467
Check implementation PR at tronprotocol/java-tron#4838

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Feb 24, 2023

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

@lxcmyf why the Solidity implementation of the delegateresource function does not implement the 3 days lock period, while the API does?

The TVM instruction does not support locking. If you want to lock it, you may use smart contracts to do so.
The lock period of delegating supported by the system is to establish a contract between the resource owner and the recipient, preventing unexpected undelegating made by the resource owner, therefore, promoting a stable resource market.

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Feb 24, 2023

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

@lxcmyf why the Solidity implementation of the delegateresource function does not implement the 3 days lock period, while the API does?

Also, the resourceType has a new supported value called tron power. Does this mean when contracts freeze trx they can only receive either tron resources (0 or 1) or voting power (2)? What about user accounts? This is very in-consistent and confusing.

Any comment on why freezing and resource delegation can't be de-coupled? If freezing automatically gives resources, it will create serious wastage of resources. Freezing should only give voting power, and resources should only be assigned when delegate resource operation is called. This is a simple common sense solution.

Before #51 proposal is opened, staking TRX may obtain both TRON power and one type of resource you specified. Once #51 proposal is opened, staking TRX would only obtain either TRON power or one type of the resources you specified.

@otakuinny
Copy link

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

@lxcmyf why the Solidity implementation of the delegateresource function does not implement the 3 days lock period, while the API does?

Also, the resourceType has a new supported value called tron power. Does this mean when contracts freeze trx they can only receive either tron resources (0 or 1) or voting power (2)? What about user accounts? This is very in-consistent and confusing.
Any comment on why freezing and resource delegation can't be de-coupled? If freezing automatically gives resources, it will create serious wastage of resources. Freezing should only give voting power, and resources should only be assigned when delegate resource operation is called. This is a simple common sense solution.

Before #51 proposal is opened, staking TRX may obtain both TRON power and one type of resource you specified. Once #51 proposal is opened, staking TRX would only obtain either TRON power or one type of the resources you specified.

Since #51 is not opened yet what happens when I pass the value 2 to the resourceType parameter of the delegateResource method?

@lxcmyf
Copy link
Contributor Author

lxcmyf commented Feb 26, 2023

0xde: DELEGATERESOURCE

The DELEGATERESOURCE takes 3 operands pop up from stack:

  • amount: resource amount to delegate in SUN.
  • resourceType: 0 as bandwidth, 1 as energy, 2 as tron power.
  • receiver: account address to receive the resource.

If operation succeed, push 1 to stack, otherwise push 0 to stack.

@lxcmyf why the Solidity implementation of the delegateresource function does not implement the 3 days lock period, while the API does?

Also, the resourceType has a new supported value called tron power. Does this mean when contracts freeze trx they can only receive either tron resources (0 or 1) or voting power (2)? What about user accounts? This is very in-consistent and confusing.
Any comment on why freezing and resource delegation can't be de-coupled? If freezing automatically gives resources, it will create serious wastage of resources. Freezing should only give voting power, and resources should only be assigned when delegate resource operation is called. This is a simple common sense solution.

Before #51 proposal is opened, staking TRX may obtain both TRON power and one type of resource you specified. Once #51 proposal is opened, staking TRX would only obtain either TRON power or one type of the resources you specified.

Since #51 is not opened yet what happens when I pass the value 2 to the resourceType parameter of the delegateResource method?

Whether #51 is opened or not, delegateResource cannot be filled with 2 because TRON_POWER cannot be delegated and such transactions cannot pass validation. But after #51 is opened, the freezing transaction can be filled with 2 and thus get only tron power.

@Laimis44
Copy link

hi all, when stake 2.0 going live?

@Jamestepfoward
Copy link

hi all, when stake 2.0 going live?

Hi, we are still discussing about the parameter N. It is estimated to be open on mainnet by the end of March. Come to join the discussion in #TIP-519

@stanleywest124
Copy link

A few months back, I lost my bitcoin and it was a devastating blow to my financial health, I thought I was going to die after losing everything. I have always thought it was impossible to recover your assets or stolen crypto but I stumbled upon a post about a cryptocurrency and assets recovery agent named Chloe William's who works with Cyber Security Service, this lady is well known for her professional services and credible recovery services. I contacted Chloe, and with her help, I was able to recover my stolen crypto.
I’m truly grateful for her service and I recommend Chloe William's for all your crypto recovery service.
she can be contacted via email on chloe.consultant1@Gmail.com or 1Nstagram….. chloe_consultant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussions-to enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests