https://github.com/farolfo/ethereum-canvas
The Ethereum Canvas
https://github.com/farolfo/ethereum-canvas
Last synced: about 1 year ago
JSON representation
The Ethereum Canvas
- Host: GitHub
- URL: https://github.com/farolfo/ethereum-canvas
- Owner: farolfo
- Created: 2017-06-19T06:23:48.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-19T19:01:30.000Z (over 8 years ago)
- Last Synced: 2025-03-29T18:36:29.566Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 37.1 KB
- Stars: 10
- Watchers: 2
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Ethereum Canvas [](https://travis-ci.org/farolfo/ethereum-canvas)
=====================
The goal of this project is to develop a canvas of pixels such that any user can buy and paint them using ETH, similar to the [MillionDollarHomePage.com](http://milliondollarhomepage.com/) project but in this case the pixels can be bought by other users if they pay more for it.
It makes usage of a Smart Contract as core backend service, developed with [Solidity](https://solidity.readthedocs.io/en/develop/#). This backend will be consumed by a web UI via an RPC API with the Chrome extension [MetaMask](https://metamask.io/).
### Smart Contract API
* `checkPixel(uint x, uint y) returns (address owner, uint price, string color)` Returns the actual state of the pixel at the (x,y) coordinates. These go from 0 to 999 each, showing a 1000*1000 pixels window.
* `buyPixel(uint x, uint y, string color) payable` Performs the operation of buying the pixel if the price sent in the value of the message is greater than the currently paied one. If the operation fails or the funds are not enough, the contract makes a `revert()` call cancelling the transaction. If the the operations succeeds the respective `Purchase(address owner, uint price, string color, uint x, uint y)` event will be triggered.
### Install
You must have a node version `^6.11.0`. We highly recommend [`nvm`](https://github.com/creationix/nvm) to manage node versions on your machine.
Make sure you have solidity and testrpc installed in your machine
```
npm install -g solc
npm install -g ethereumjs-testrpc
```
And then install this project dependencies
```bash
$ npm install
```
### Compile
```bash
$ npm run compile
```
### Test
```bash
$ npm run test
```
### Deploy
Run the smart contract in a `testrpc` instance just by running
```bash
$ npm run deploy
```