This project was generated with Angular CLI version 1.6.3.
The Project aims to show the way to develop Ethereum DApp(Decentralized App) as a Standard Web Application utilizing Angular 5 as the Frontend Framework.
A Counter contract being deployed to ethereum blockchain network, simply increment and decrement operations provided to interact with the blockchain.
Ethereum blockchain web3js library 0.20.1
Ethereum local development server, ethereumjs-testrpc library 6.0.3
For Solidity contract compilation, solc library 0.4.19
Install required libraries with "npm install ethereumjs-testrpc solc web3@0.20.1"
Open node console
Web3 = require('web3')
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
code = fs.readFileSync('src/contracts/Counter.sol').toString()
solc = require('solc')
compiledCode = solc.compile(code)
abiDefinition = JSON.parse(compiledCode.contracts[':Counter'].interface)
CounterContract = web3.eth.contract(abiDefinition)
byteCode = compiledCode.contracts[':Counter'].bytecode
deployedContract = CounterContract.new({data: byteCode, from: web3.eth.accounts[0], gas: 4700000})
contractInstance = CounterContract.at(deployedContract.address)
contractInstance.getCounts.call()
contractInstance.increment({from: web3.eth.accounts[0]})
Run ./node_modules/.bin/testrpc for a dev server.
Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.
Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build.
Run ng test to execute the unit tests via Karma.
Run ng e2e to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help or go check out the Angular CLI README.