Skip to content
poplexity edited this page Jun 23, 2018 · 3 revisions
  • COOLDOWN=5min ?
  • TOKEN=PXL ?
  • PAINTCOUNT_PER_TOKEN=10 ?
  • TOKENS_PER_EOS=100 ?
  • PIXLEL_HOURS_PER_TOKEN 24hrs ?
  • MAX_PAINT_TIME ???? could someone paint for a whole month with enough tokens?? why not, great problem to have

There is a configurable cooldown period. After painting a free pixel users will have to wait $COOLDOWN before painting again. That pixel can be changed right away by anyone who is done with their cooldown.

There are two ways to get a token:

  1. Every $PAINTCOUNT_PER_TOKEN pixels painted you can claim 1 $TOKEN token
  2. Send us 1 EOS and get $TOKENS_PER_EOS tokens

Pixel rental using tokens

For every 1 token spent it allows the cooldown to be bypassed, and the pixel to be kept the same color for $PIXEL_HOURS_PER_TOKEN, this can be split up into smaller amounts, 1 token could paint 1 pixel for the full $PIXEL_HOURS_PER_TOKEN or the hours could be split up and many pixels could be painted for 1 hour with that token.

This means that at 100 tokens per EOS, and 24hrs per token you could paint a 10x10 area for a day for 1 EOS.

TBD Technical details....

How to best store the information in the above situation? When someone paints a 10x10 grid we need to track 3 things:

uint32_t pixel_position uint64_t account_name uint32_t placement_time

placement_time and account_name are the same for every pixel position, so that would be an opportunity to deduplicate the data and save on RAM. This would mean we'd have 2 ints and then a vector for the pixel_postion. However a frequent operation will be to check if a pixel is rented, which should probably be against an index/primary_key, and to save on duplication of the account_name ad placement_time we would put the locations in a vector. This suggests we still need a row per rented pixel, along with the time it was placed and who placed it. This feels like 32 + 32 + 64 = 128bytes per pixel, with the potential of 1mil being rented. 128mil byte = 128mb, which is a lot of EOS RAM to buy.

Clone this wiki locally