Build a Hello-world decentralized application, or Dapp, on the Ethereum Network.
Install these prerequisites to follow along with the tutorial.
$ git clone https://github.com/pocteo/dapp-k8s.git
Start a local blockchain instance:
$ ganache-cli
If you have already a wallet you can start ganache using your mnemonic like this :
$ ganache-cli -m 'your-mnemonic'
It makes the next step which is metamask configuration
much more easy.
- Unlock Metamask :
- Connect metamask to your local Etherum blockchain provided by Ganache by switching to https://localhost:8545 :
- Import an account provided by ganache :
If you started ganache with ganache-cli
command, each time you start ganache you need to import the private key in metamask to connect to one of 10 accounts that ganache instance gives you. This is why it's recommended to start ganache with your mnemonic .
Contracts Deployment in ethereum network is done through an ethereum transaction. Ethereum transaction
must have sender and reciever. The sender of the transaction is known as the owner of the contract . This is why we should configure Truffle framework
to use our private key in creating an Ethereum transaction
to deploy the smart contract.
To do that, you only have to create a file named secret
in the root of the project and put your mnemonic inside it.
Fees will be automatically taken from the wallet that truffle
is configured to use.
$ cd dapp-k8s
$ truffle compile
$ truffle migrate development
After contract migration we need the contract abi and address so that we can interact with it .
This why you need to change abi and address values in utils.js
file. Every time you restart ganache you need to repeat the whole process.
Just open index.html
file with your browser .