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

No fields for transaction Fee #590

Closed
vlasfama opened this issue Jul 14, 2023 · 4 comments · Fixed by #600 or #601
Closed

No fields for transaction Fee #590

vlasfama opened this issue Jul 14, 2023 · 4 comments · Fixed by #600 or #601
Assignees
Labels
enhancement New feature or request www

Comments

@vlasfama
Copy link
Contributor

vlasfama commented Jul 14, 2023

Describe the problem you'd like to have solved

Cannot find transaction fee details in API or gRPC Call

Describe the ideal solution

We need to create/add API/fee to calculate the total transaction fee.

@b00f b00f added enhancement New feature or request www labels Jul 14, 2023
@ZigBalthazar
Copy link
Contributor

ZigBalthazar commented Jul 23, 2023

Hi @nagarajmanjunath , @b00f

Please provide more information and explanations (if possible, provide a scenario as well)
I can do this task

@b00f
Copy link
Collaborator

b00f commented Jul 24, 2023

@ZigBalthazar

Thank you for your interest in this issue.

Transaction fees in the Pactus blockchain are calculated using a percentage-based fee model. You can learn more about this model here: https://pactus.org/learn/transaction/fee/. (It is a new idea to manage the transaction pool better).

Currently, when users create transactions with their wallets, the fee is calculated and set automatically). Users are not required to input it manually, even we have an option for manual fee input in the CLI.

For some offline queries, it would be beneficial to have an API that calculates transaction fees based on two parameters:

We might have an API similar to: CalculateTransactionFee(payloadType payload.Type, amount int64) int64

@ZigBalthazar
Copy link
Contributor

@b00f
thanks for providing a description, I will do this task and create a PR✌️

@b00f
Copy link
Collaborator

b00f commented Jul 24, 2023

An Idea:
To calculate transaction fees, you need to know the consensus parameters such as the Minimum Fee and Maximum Fee.
Who has this knowledge? The State is fully aware of the consensus parameters.
Therefore, the best place for CalculateFee function inside the State.
The State can expose this function to outside world.

So this PR, hits two birds with one stone: make wallet less knowledgeable and add a new API for fee calculation.
Wallet can call the new gRPC API to get the fee.

@ZigBalthazar What is your thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request www
Projects
None yet
3 participants