tronprotocol / java-tron

Java implementation of the Tron whitepaper
GNU Lesser General Public License v3.0
3.65k stars 1.37k forks source link

Does the contract supplied energy has the same source as user energy? #5898

Closed abn2357 closed 1 week ago

abn2357 commented 2 weeks ago
截屏2024-07-03 12 00 59

User energy can get from staking trx and burning trx, I wonder whether the contract supplied energy only has the source of staking? I have the question because the statistical data of total energy consists of three part as below:

截屏2024-07-03 12 09 38
endiaoekoe commented 2 weeks ago
截屏2024-07-03 12 00 59

User energy can get from staking trx and burning trx, I wonder whether the contract supplied energy only has the source of staking? I have the question because the statistical data of total energy consists of three part as below:

截屏2024-07-03 12 09 38

hi, @abn2357 for the details about energy-consumption mechanics ,pls refer to this doc which explain it very carefully.

laurenceja commented 2 weeks ago

@abn2357 The contract can stake TRX to obtain energy, and it is the same with external account address. But for "Energy consumption radio", it means that the contract deployer can pay a portion of the energy required to invoke the contract, so it's talking about the contract deployer, not the contract itself. If the available energy of contract deployer is not enough or the energy paid by contract deployer has reached the upper limit, the remaining energy should be paid by caller.

abn2357 commented 2 weeks ago

@abn2357 The contract can stake TRX to obtain energy, and it is the same with external account address. But for "Energy consumption radio", it means that the contract deployer can pay a portion of the energy required to invoke the contract, so it's talking about the contract deployer, not the contract itself. If the available energy of contract deployer is not enough or the energy paid by contract deployer has reached the upper limit, the remaining energy should be paid by caller.

@laurenceja So the "contract _supplied" energy is provided by the contract deployer?

laurenceja commented 2 weeks ago

@laurenceja So the "contract _supplied" energy is provided by the contract deployer?

Yes.

abn2357 commented 2 weeks ago

@laurenceja So the "contract _supplied" energy is provided by the contract deployer?

Yes.

@laurenceja My doubt has not been resolved yet. Statistical data of total energy consists of three parts: "energy", "contract_supplied", "trx", So the "trx" burning energy is all from user trx burning or from user trx burning and contract deployer trx burning both?

laurenceja commented 2 weeks ago

@laurenceja My doubt has not been resolved yet. Statistical data of total energy consists of three parts: "energy", "contract_supplied", "trx", So the "trx" burning energy is all from user trx burning or from user trx burning and contract deployer trx burning both?

TRX burned is all from user. Contract deployer will only provide energy.

abn2357 commented 2 weeks ago

@laurenceja My doubt has not been resolved yet. Statistical data of total energy consists of three parts: "energy", "contract_supplied", "trx", So the "trx" burning energy is all from user trx burning or from user trx burning and contract deployer trx burning both?

TRX burned is all from user. Contract deployer will only provide energy.

@laurenceja So the energy provided by the contract deployer can be obtained only by staking? In my opinion, if the energy provided by the contract deployer can be obtained by staking and burning as users, the statistical data of "trx" energy would not all be from user. Are there any problems with my understanding?

laurenceja commented 2 weeks ago

@laurenceja My doubt has not been resolved yet. Statistical data of total energy consists of three parts: "energy", "contract_supplied", "trx", So the "trx" burning energy is all from user trx burning or from user trx burning and contract deployer trx burning both?

TRX burned is all from user. Contract deployer will only provide energy.

@laurenceja So the energy provided by the contract deployer can be obtained only by staking? In my opinion, if the energy provided by the contract deployer can be obtained by staking and burning as users, the statistical data of "trx" energy would not all be from user. Are there any problems with my understanding?

The contract deployer can only provide energy, but not TRX burning, of course, the energy can be obtained through staking TRX or other account's energy delegation.

abn2357 commented 2 weeks ago

@laurenceja My doubt has not been resolved yet. Statistical data of total energy consists of three parts: "energy", "contract_supplied", "trx", So the "trx" burning energy is all from user trx burning or from user trx burning and contract deployer trx burning both?

TRX burned is all from user. Contract deployer will only provide energy.

@laurenceja So the energy provided by the contract deployer can be obtained only by staking? In my opinion, if the energy provided by the contract deployer can be obtained by staking and burning as users, the statistical data of "trx" energy would not all be from user. Are there any problems with my understanding?

The contract deployer can only provide energy, but not TRX burning, of course, the energy can be obtained through staking TRX or other account's energy delegation.

@laurenceja Thanks a lot. I got it now.

vivian1912 commented 1 week ago

@abn2357 Glad your issue was resolved. And this issue will be closed.