With Truffle
Truffle is a world-class development environment, testing framework and asset pipeline for blockchains using the Ethereum Virtual Machine (EVM), aiming to make life as a developer easier.
Setting up the development environment
There are a few dependencies to install before we start. Please install the following:
Node.js v8+ LTS and npm (comes with Node)
Do ensure that your npm modules have been added to your path
After installing the above dependencies, we can proceed to install truffle:
for more information on the different flags for npm-install
To verify that Truffle is installed properly, run this command:
Return (your version might differ):
If you're new to Truffle then please follow the Getting Started by truffle, To setup the truffle environment.
Initializing a truffle project
Initialize a truffle project:
Initialize a node project:
truffle-config
After setting up your truffle project, be it cloning a repository or initializing a new truffle project
Open
truffle-config.js
Edit
truffle-config.js
with f(x)Core network credentials
the file below is just a sample:
The key fields to note here are:
networks to include fxtestnet
provider to be set to any of our f(x)Core nodes, you may use the company's hosted node https://testnet-fx-json-web3.functionx.io:8545
gasPrice: 4000000000000
network_id: 90001
Notice, it requires mnemonic to be passed in for fxtestnet Provider, 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 seed phrase from metamask wallet you can click into the Metamask icon-->Metamask Settings-->Security & Privacy-->Reveal Secret Recovery Phrase.
Deploying on f(x)Core Network
To request for Testnet FX click on this link
Run this command in root of the project directory:
Contract will be deployed on f(x)Core Testnet, it will look something 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 in our testnet explorer.
Last updated