https://github.com/bumi/eth-example
quick and dirty code minimal, home made code example for Ethereum development
https://github.com/bumi/eth-example
Last synced: 4 months ago
JSON representation
quick and dirty code minimal, home made code example for Ethereum development
- Host: GitHub
- URL: https://github.com/bumi/eth-example
- Owner: bumi
- Created: 2017-09-26T20:33:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-27T11:02:26.000Z (over 8 years ago)
- Last Synced: 2025-01-01T18:31:42.679Z (over 1 year ago)
- Language: HTML
- Homepage:
- Size: 69.3 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.mdown
Awesome Lists containing this project
README
# eth examples \o/
## Contents:
* token.sol: minimal contract with example on how to change a contract attribute (exchangeRate)
* deploy.js: minimal example for a home-made deploy script
* index.js: example on how to initialize a JS object for the contract and interact with it
* wallet.json: wallet data incl. private key - added this here just to make it easier to use
* index.html: dapp example on how to build a UI for the contract and interact through a provided web3 (metamask for example)
## 0. setup
$ npm install (from this directory)
$ parity --chain=dev ui
## 1. run the deploy script
$ node deploy.js
This will try to connect to your parity node on localhost:8545 and compile and deploy the contract.
It will print the address of the deployed contract and it will write it to `contract-metadata.js`
It will also try to send some ETH to our wallet (wallet.json) to allow it to interact with the contract.
## 2. interact with the contract
$ node index.js
This will load the wallet and interact with the deployed contract. It will read the currect exchange rate and set the exchange rate. (examples on how to interact)
## 3. run the dapp in index.html
$ python -m SimpleHTTPServer 8000
index.html contains some HTML and JS as an example on how to interact with the contract through metamask (or any other externally provided web3)