3

Before pushing an action on blockchain, how do I find out the minimum amount of cpu and net bandwidth required for my transaction to be completed? If there is no way to know such thing, then how do I decide how much EOS do I delegate to my account (I want to minimise the amount of EOS delegated)

1 Answer 1

2

CPU bandwidth depends on execution time and net bandwidth depends on the transaction size (bytes). The only way to know is to measure, either on the mainnet or on a similarly-loaded testnet. CPU bandwidth will vary between producers.

Option A:

  • Run cleos get account and look at the used fields under net bandwidth and cpu bandwidth
  • Issue the transaction
  • Run cleos get account and subtract the fields

Option B:

  • Issue the transaction
  • Get these fields from the transaction from the block: cpu_usage_us and net_usage_words

cleos get account example:

$ cleos get account useraaaaaaaa

net bandwidth: (averaged over 3 days)
     staked:   50335451.0469 SYS           (total stake delegated from account to self)
     delegated:       0.0000 SYS           (total staked delegated to account from others)
     used:               384 bytes
     available:        38.46 Gb   
     limit:            38.46 Gb   

cpu bandwidth: (averaged over 3 days)
     staked:   50335451.0469 SYS           (total stake delegated from account to self)
     delegated:       0.0000 SYS           (total staked delegated to account from others)
     used:             17.05 ms   
     available:        0.676 hr   
     limit:            0.676 hr   
3
  • The example is for Option A. Could you also provide an example for Option B?
    – friedger
    Jun 15, 2018 at 16:38
  • 1
    any documents? like formulas or codes? If my transaction has a big memo, does that mean it take more net? or more ram?
    – spartucus
    Jun 19, 2018 at 10:15
  • @spartucus big memo should take more net and more cpu but not more ram
    – confused00
    Aug 11, 2018 at 15:47

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.