Using Truffle
Setting up the development environment
There are a few technical requirements before we start. Please install the following:
- Node.js v8+ LTS and npm (comes with Node)
- Git
Once we have those installed, we only need one command to install Truffle:
To verify that Truffle is installed properly, type truffle version
on a terminal. If you see an error, make sure that your npm modules are added to your path.
If you're new to Truffle then please follow the Getting Started by truffle, To setup the truffle environment.
truffle-config
- Go to truffle-config.js
- Update the truffle-config with matic-network-crendentials.
Notice, it requires mnemonic to be passed in for maticProvider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words.
Deploying on Matic Network
Run this command in root of the project directory:
Contract will be deployed on Matic's Mumbai Testnet, it look like this:
Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.
Congratulations! You have successfully deployed HelloWorld Smart Contract. Now you can interact with the Smart Contract.
You can check the deployment status here: https://mumbai-explorer.matic.today/