3

In EOS, when create a table record, someone will pay the ram, and when modify the record, maybe someone else will pay the ram, and when delete the record, who will get the ram back? the creator or the modifier? or somebody else?

1 Answer 1

6

When a record is created, the user specified in the emplace call will be charged for the RAM usage. A subsequent modify call on that record will specify a user (possibly different) that will be charged. That user will incur the storage cost of the entire row, and the original user (if different) will have their RAM returned to them for use elsewhere. When the record is finally removed with an erase call, whoever is currently on the hook for the RAM for that row will have their RAM returned to them.

To summarize, only one user is ever charge for the ram to store a row in a table. That user can change over time as the row is modified. When the user changes, the original user's RAM is returned to them, and the new user is charged for the storage. And when the row is deleted, the user who was paying for the row at the time will have their RAM returned to them.

7
  • thanks, the emplace can specify the user who pay the ram, but who has the privilege to pay for the table row? can I specify anybody else to pay for it?
    – Jimmy Guo
    Jun 29, 2018 at 2:00
  • paying for the RAM, and paying for the table row are the same thing. When you specify the user in the emplace command, they will be charged for the RAM cost to store the row that is being emplaced. Jun 29, 2018 at 15:31
  • I mean if you can make the other pay the row without his permission?
    – Jimmy Guo
    Jun 30, 2018 at 3:27
  • I believe you have to have authorization for the account to whom you are charging the emplace command. Jul 1, 2018 at 1:45
  • In addition to the ram for rows, there is also ram for the table and index overhead. If the last row was erased then that extra ram is returned as well.
    – friedger
    Jul 1, 2018 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.