An open API service indexing awesome lists of open source software.

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

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)