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

Doc where extra gas is coming from for privacy marker transaction #254

Closed
MadelineMurray opened this issue Mar 17, 2020 · 2 comments
Closed

Comments

@MadelineMurray
Copy link
Contributor

The public transaction gas usage is calculated in the following way:

Gas usage = TX_BASE_COST + (TX_DATA_ZERO * NO_OF_ZEROS) + (TX_DATA_NON_ZERO * NO_OF_NON_ZEROS)

where,

TX_BASE_COST = 21000
TX_DATA_ZERO = 4
NO_OF_ZEROS = number of "00" in the hex payload of the transaction
TX_DATA_NON_ZERO = 68 pre-istanbul / 16 post-istanbul (as in istanbul hard fork)
NO_OF_NON_ZEROS = number of non-"00" in the hex payload of the transaction i.e. number of pairs in the hex that are not "00"

The PMT has 32 bytes of non-zero hex. It therefore consumes:

Gas usage of PMT = 21000 + (4 * 0) + (68 * 32) = 21000 + 2176 = 23176

Post-Instanbul the PMT will consume:

Gas usage of PMT post-istanbul = 21000 + (4 * 0) + (16 * 32) = 21000 + 512 = 21512

Invoking the Privacy Precompiled Contract consumes 0 gas.

More info: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2028.md

Comments from the original JI https://jira.hyperledger.org/browse/BESU-75:

Madeline Murray - Need to confirm where the extra 2992 is coming from 
 
Madeline Murray - Document where extra gas is coming from.

Also update in Besu and web3js, and web3j
  
Ivaylo Kirilov September 16, 20the changes required in Besu are documentation related only
 
Ivaylo Kirilov September 17, 2019, 12:14 AM
 
fixed in web3j - hyperledger/web3j#1029

@MadelineMurray MadelineMurray self-assigned this Mar 17, 2020
@bgravenorst
Copy link
Contributor

This issue must also address, "Doc that gas price on private transaction passed through privacy marker transaction"

See: #289

@MadelineMurray
Copy link
Contributor Author

Putting this back on the pile until we finish privacy interop.

@bgravenorst bgravenorst removed the good first issue Good for newcomers label Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants