0

I am sorry to bother you, I am a little confused about the cost while using a token contract:

  1. the contract provider will pay all the utilities if a user using the contract including the CPU, NET and the RAM (and contract provider can let the user pay the RAM cost) is this right?

  2. During using a token contract, the RAM resource will only be used one time(during the first time that the account get the tokens) Is this correct?

Can anyone give an introduction about how do the resources(RAM, NET, CPU) being used to interact with a smart contract?

Thanks in advance!

1 Answer 1

0

Contract provider pays RAM once when he deploys the contract. (10X size of contract binary, for example, xxx.wasm is 1KB, deploying xxx contract will consume 10KB of RAM)

If user interacts with contract, it will consume CPU and NET of user (not contract provider). There is a way that enables contract provider to pay CPU on behalf of user, but it demands additional process of signing transaction by contract provider on user transaction (of course, user transaction must be signed by user key too).

As you mentioned, contract provider can make his RAM or user's RAM consumed when storing token balance. However, once balance information is generated for user, changing its amount (by sending or receiving) will not consume additional RAM.

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.