Pixels on Ethereum and Color’s New ERC-20 Contract
So you’ve heard about Pixels, and now that our ERC-20 has been released and the bounty payments are going out, a few of you may have had a chance to view the code of our ERC-20 contract, and you’ll find that this contract has a few more things going on than the basic minimums of coin transfer requirements outlined in ERC-20, so today we’re going to step through the biggest differences, and what we hope will be solved in the introduction of the MainNet.
pragma solidity ^0.5.0; /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error…etherscan.io
The above contract is our official Color Coin contract and it will also be used to calculate and send Pixels, once the counterpart application is ready for prime time. At nearly 800 lines there are a couple of things we need to unpack. One main thing being, how are pixels accrued, sent, and what are the costs, who pays for it, and when, etc.
Conversions — How are pixels accrued and converted?
We covered this in some of our previous blog posts, but we’ll cover the basics again here. New Pixels (Pixels that have not been sent) are issued at a rate of 5 per day per person but are only sent to those who don’t have a balance of New Pixels and must be sent in order to potentially become COLOR. The idea is centered around the ‘Gift Economy’ and having a community that is incentivized to be engaged and give to other members of the community. Only pixels sent by other people will turn into COLOR, at a rate defined by the following formula:
PIXEL WEEKLY ISSUANCE ÷ PIXELS SENT = COLOR PER PIXEL
So if we take the following scenario, in a given week 9,500 Pixel users send out 5 pixels, meaning that 47,500 pixels will get sent out, that would equate to each of those Pixels being converted to about ~4.20 Color. So if you sent 5 Pixel to one recipient that week, they would get about 21 Color. Not bad, eh? However, there is a 50 Pixel conversion minimum to reduce spam and our gas costs while on the Ethereum Network.
Pixels will be sent through an application that requires each user to have a verified KYC ethereum address. This will be a user-friendly hub where you can search for your family members, friends, charities, and various organizations to send Pixel too. The Color Team will work to get charities, and important organizations on board, while we leave it up to the community to get their family and friends involved! We have lots of plans for what we want to do to make the act of sending pixels more interesting, engaging, and rewarding, so stay tuned for that in future blogs where we dive into our plans for how that will work! At the end of the week however, it is the Pixel application that feeds the pixel amount, pixel address and conversion rate to the Ethereum Smart Contract shown below.
In The Color Token, we introduced the ability to perform Batch Sends. What this allows us to do is instead of processing each transaction individually on the blockchain, we can update the balances of Color wallets in a batch. There exist two functions within our contract to do this, one being slightly cheaper than the other. We will explain both here:
So if the above just looks like a jumble of random words and symbols to you, that’s OK, let’s break it down. Essentially what is happening here is that this function takes two arguments (values), pixel amounts and pixel addresses. It then takes those amounts from the Founder wallet, and sends the Pixel accordingly, and converts them to Color based on the (bolded) above conversion rate function that is calculated and provided from the Pixel application.
That is slightly different than another method that exists within our contract (shown below). Notice that the argument below has fewer lines of code. For that reason, it is more cost effective for the Color Project, as every line of code means we need to compensate the Ethereum Miners that much more for the more work they provide. Since we assume there will be a large amount of people simply sending 5 Pixels to friends, family, and other community members, we assume that we can use the function below for balances that are the same, to cut costs. The function below simply splits a given amount of Color evenly amongst all the addresses provided. This function will most likely be used for amounts like 50 (the minimum) or 70 (the max you would get if one person sent you pixels everyday.
So, who pays for these Batch Transfers, anyway?
Ah, perhaps the most important question of them all. If we are sending out these batch transactions, who is going to pay, and what happens on MainNet? For the time being, we estimate that handling the current flow of pixel transactions to be fairly cheap, so it isn’t that much of a worry. By our estimation, using the current safefast calculations and ethereum prices, it would cost us about $1.50 per 300 addresses sent on ethereum. (Calculation table below).
These fees will be paid by the Color Project while the project is on Ethereum, and once it is moved to MainNet, Pixel transfers will be embedded as a core part code and will be likely paid as a small percentage of the treasury (still TDB). If we became a project with 10,000+ active users in Beta, and the Ethereum price quadrupled, or the gas price was unusually high, we might instill higher thresholds (minimums), or perhaps wait a little longer between Pixel settlements. Once we hit Mainnet, pixel payments will settle automatically on a weekly basis, without exception.
Also, another thing to keep in mind is that if we have a large number of active KYC required users in our Pixel program, we could maintain a high number of users even for a fairly cheap price at current Ethereum prices. For example, if we had 10,000 recipients of Pixels, it would cost the Color network ~$54 USD to send to those recipients each week. To top it off, all these calculations are based on new addresses. Updating address balances are actually much cheaper (around 30%)!
To sum up, Pixels will be sent through novel means via a KYC required application. Once sent, those Pixels will then be converted at a fixed rate viewable on the blockchain and distributed weekly to everyone. This is made possible by Batch transfers and will be paid for by the Color Project while in beta. In time, all of this will be automated and be part of Mainnet, and the cost side will simply cost Color and not require continuous injections of Ethereum to keep running.
Any questions? Feel free to leave a message on our Telegram channel!