PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, September 25, 2022

[FIXED] Why does the addition of a new key-value pair to a big_map not incur a storage fee at all times?

 September 25, 2022     blockchain, smartcontracts, storage     No comments   

Issue

For example- I am sending an Tezos FA1.2/FA2 token to an address that has previously not held any amount of that token. So, the address is not present in the ledger big_map of the contract. This would clearly lead to an increase in storage being used, since the address and the corresponding balance needs to be added to the big_map. Mostly this incurs a storage fee ~0.01675 tez (on mainnet).

However, at times, I have noticed that no storage fee is incurred in such a scenario (just gas). Why does this seem to happen?


Solution

That may happen when someone removes data from the storage before your operation, releasing some space, so that the contract has a kind of "prepaid" space, for which storage fee won't be taken.

It works like this:

  • op1 writes 10 bytes (storage fee is taken for 10 bytes);
  • op2 removes 5 bytes (no storage fees, nor refunds);
  • op3 writes 3 bytes (no storage fees);
  • op4 writes 3 bytes (storage fee is taken for 1 byte);


Answered By - Figario
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing