https://github.com/kdembler/light-flipper
Smart contract and Node app for controlling light over Ethereum blockchain
https://github.com/kdembler/light-flipper
ethereum node raspberry-pi solidity
Last synced: 3 months ago
JSON representation
Smart contract and Node app for controlling light over Ethereum blockchain
- Host: GitHub
- URL: https://github.com/kdembler/light-flipper
- Owner: kdembler
- License: mit
- Created: 2018-03-19T19:08:44.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-21T20:42:41.000Z (over 8 years ago)
- Last Synced: 2025-01-31T19:30:41.088Z (over 1 year ago)
- Topics: ethereum, node, raspberry-pi, solidity
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Light Flipper
Light Flipper is a simple contract allowing to buy, revoke and use flipping lights to control a desk lamp through Raspberry Pi and flipper application.
### Live contract
You can mess with my light on Rinkeby at
```
0x3167168DA658dfB094F37eC79aD699bA96fEEcE8
```
with abi
```
[ { "constant": true, "inputs": [], "name": "flipped", "outputs": [ { "name": "", "type": "bool", "value": true } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" } ], "name": "flippingRights", "outputs": [ { "name": "", "type": "bool", "value": false } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "controller", "outputs": [ { "name": "", "type": "address", "value": "0x40e5f1822864cbe233fb3286834d2b8f846fa5e9" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "who", "type": "address" } ], "name": "BoughtFlippingRights", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "who", "type": "address" } ], "name": "RevokedFlippingRights", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "who", "type": "address" }, { "indexed": false, "name": "newState", "type": "bool" } ], "name": "FlippedLight", "type": "event" }, { "constant": false, "inputs": [], "name": "buyFlippingRights", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [], "name": "revokeFlippingRights", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "withdraw", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "flip", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_state", "type": "uint8" } ], "name": "changeState", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_controller", "type": "address" } ], "name": "changeController", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "stealTheMoney", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ]
```

## Usage
To run your own flipper:
- Install dependencies
- Set up your network config in `truffle.js`
- Run migrations with `truffle migrate` - this will create file `contract.json` making it possible for flipper application to interact with deployed contract
- Start flipper with `yarn run flipper` - note that accessing GPIO may require administrative privileges. If needed any configuration can be overriden by creating `config.json` file