13

We want to be able to measure (with limited precision) how much EOS we will need to run our smartcontract. Let's say we know how much RAM we need, but do we calculate how much will it cost? We can buy RAM using buyrambytes, for example. Can we get current price of RAM? Price used for last buyrambytes? Can we use data from

cleos -u : nodes.get-scatter.com:80 get table eosio eosio rammarket

to do that?

1

2 Answers 2

14

Yes you're on the right track.

Running

cleos -u https://nodes.get-scatter.com:443 get table eosio eosio rammarket


gives you:

{ 
  "rows": [{
    "supply": "10000000000.0000 RAMCORE",
    "base": {
      "balance": "67254241906 RAM",
      "weight": "0.50000000000000000"
    },
    "quote": {
      "balance": "1021789.6640 EOS",
      "weight": "0.50000000000000000"
    }
  }],
  "more": false
}

Credit: to Andrew Coutts for piecing the info below together from various telegram channels and youtube videos.

To calculate the price from this you would use the bancor algorithm (from their WP, section 3.1):

Connector Balance/(Smart Token’s Outstanding supply × Connector Weight)

Connector Balance in this case is: quote.balance

Smart Token Outstanding Supply is: base.balance

Connector Weight is: quote.weight

This would give you the price in EOS/BYTE

EOS is the connector. RAM (or RAMCORE) is the smart token.

Here is an online implementation from eosnewyork of the above which converts quotes in KB/$:

https://www.eosrp.io/

PS: The value for the weight connector used in the eosrp.io site is 0.1, which is different from the one reported by the rammarket table. It's unclear yet which one is correct. 0.1 has been mentioned by Dan several times which is why it's used on accouts.com. I'll correct this answer when better information becomes available.

4
  • 2
    Hmm.. When I get the json data from cleos, I get the 0.5 weight and when I try 0.1 I get the numbers to not match up with the eosrp.io. But weight of 1 seems to work in this equation.
    – Kabir
    Commented Jul 2, 2018 at 22:17
  • 1
    same here, I get the 0.5 weight and the numbers are double. with weight 1 price is matching
    – ovi
    Commented Jul 3, 2018 at 14:17
  • thanks guys, I'll revisit this and update in the next couple of days.
    – Vlad
    Commented Jul 3, 2018 at 16:07
  • Looks like you just need to do the following: (quote.balance / base.balance) this will give you EOS per BYTE, than you just need to multiply it by 1024 for KB
    – Danail
    Commented Jul 3, 2018 at 20:26
2

Update today: this utility has been moved to a new domain, http://www.eosrp.io

1
  • DNS address could not be found is it still alive?
    – Klesun
    Commented Jul 17, 2022 at 20:19

Your Answer

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

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