GravityCoin - Our own Cryptocurrency
In recent times, after the Bitcoin boom, one the trendiest topics we could find out there were cryptocurrencies. As many other people, I was quite interested in the subject and wanted to know at first hand what was blockchain about and if my investment in some coins made sense beyond the trend and the nice theory.
Taking advantage of the R&D time we enjoy in Gravitywell I decided to answer some of my questions like: What is the sense of owning and issuing a cryptotoken like ICOs do? What would its value be? So I would create my own cryptocurrency token and give it some application.
Creating the token: GravityCoin
Ethereum provides the perfect environment to create your own token. In contrast to Bitcoin, Ethereum is much more than a currency it represents a whole platform where it is possible to run applications (called smart contracts) in a decentralised way. This means applications/data don’t lie in a single place but can be run/accessed from any node connected to the network. This is basically the paradigma behind blockchain and there are tonnes of articles and information you can find about it outside.
Two of the characteristics of smart contracts are immutability and inviolability, that makes them perfect to create a token. You wouldn’t like to find that, suddenly, your money can’t be used or that an external entity takes your money away from you without consent (what actually happens in the real world with real money when banks bankrupt or currencies collapse).
A token or currency can be easily represented and handled by an application (in this case a smart contract) as long as it covers:
- Total amount issued
- Token owning
- Token transfering
Ethereum has standardised the process to build a token and you’ll need to:
- Create a smart contract, using the Ethereum platform language: Solidity.
- Follow the ERC20 Token Standard to create your token.
- The main parameters you’ll need to set are: amount issued, token name and symbol and account that will own the initial supply. It is really important this is an account you have control of, otherwise you won’t be able to use or distribute your token.
- Deploy it to the Ethereum network.
There are already a few articles explaining how to create tokens in the Web. I followed this one as I found it quite clear and concise.
It is relevant to notice that you’ll be deploying this contract to a test network (Ropsten) so you won’t need to spend real Ether (the Ethereum cryptocurrency) needed to deploy apps.
Once you’ve deployed it, you’ll be able to find it in Etherscan: e.g. Gravitycoin. That means it's public and you can use your token!
Adding value: GravityCoin app
As a proof of concept I created GravityCoin app. A meteor application where users would be able to receive and transfer Gravitycoins. The simple user journey would include:
Signup. With two options: creating a new Ethereum account for you or using an existing account that can be loaded through private key or keystore and password:
Access to the list of existing users:
Transfer Gravitycoins to other users:
Check your balance and access to the list of historical transfers:
In order to achieve it, I made use of the library web3.js, that allows interacting with the Ethereum platform from Javascript apps.
So now, in Gravitywell, we own our own currency that could be used (at the moment) internally. Some ideas could be:
- Change Gravitycoins for (small) office items, for example, your favourite cookies or… bananas!
- A reward system. As a sign of appreciation, you could send tokens to your colleagues and at the end of the month receive some compensation for it like a bottle of Prosecco or… more bananas! The value of the token depends on the market now.
If you want to try and create your own transfercoin app, you just need to:
- Fork the Gravitycoin app.
- Create and deploy your token, you can use the contract found in the project root: token_contract.sol and modify the main parameters to customise it.
- Change the app configuration according to this and your taste: app and token name, symbol, Ethereum network to connect, etc. from /imports/startup/common/config.js.
- Signup using the Ethereum account holding the initial token supply. It will represent the “master” user that can start delivering the currency.
- Encourage other people to use it and create value from it!
What I learnt
Some of the things I've learnt on the way of working on this project:
- What the concept of currency/token is and its value.
- How to issue your own token in a blockchain platform.
- Solidity.
- How to interact and control smart contracts from external apps.
What I like about the blockchain technology. Overall openness and decentralisation:
- You don’t have to rely on a single entity (company or bank) to handle something that is “yours”.
- No servers that can go down for hours
- No DBs that can get hacked, the network decides what is what it is and who belongs to.
- The contract is there, in the network for public access, no traps. Though, I think this is a really important point, that doesn’t mean everyone would understand it.
- Integrity and security of transactions.
What I don’t like. Inflexibility: once a contract is deployed it NEVER can be changed, it doesn’t matter if there is a bug you need to fix, changes in the functionality or an extension of them. What I think it makes Dapps to be useful in not many real areas.