Example Ethereum (Solidity) smart contract decentralized app with Webpack, demonstrating the following features and behaviors:
import { MyToken } from './contract/MyToken.sol'
.index.js
for more details.Run a local Ethereum node with JSON-RPC listening at port 8545 (default). testrpc would be the most straight-forward method.
# Using testrpc (recommended)
testrpc
# If you are running Geth,
# make sure to run in testnet or private net and enable rpc
geth --testnet --rpc
Install dependencies
npm install
Run, during development
npm start
Once webpack build is done, open index.html
in your favorite web browser.
Webpack is now started in --watch
mode, any changes done at JavaScript or Solidity files would automatically rebuild the affected modules.
Build, for deployment
npm run build
Only the static
directory is required to be hosted and served.
Run tests
npm test
web3-loader can be further configured, for example to reuse a deployed contract instead of redeploying at every build. See web3-loader's README for more details.
Similarly for solc-loader.
Pull requests, bug reports are welcomed.
This example dapp is put together by U-Zyn Chua. Say hi to me at Twitter (@uzyn) or Freenode IRC (my handle: uzyn, usually at #ethereum).
Tips: 0xFfA57D3e88A24311565C9929F180739E43FBD0aA