Table of Contents
I. Introduction II. Deploying Smart contracts on DEXON 1. Installing the repo 2. Changes in the initial commit 3. Adding DEXON parameters 4. Compiling your smart contract 5. Set the mnemonic 6. Final steps 7. Success!
This documentation describes the procedures to compile and deploy smart contracts on DEXON. Generally, the procedures are generally similar to that of deployment on Ethereum. For the differences, our engineers have prepared a generalized repo to assist you in deploying the smart contracts effortlessly.
Before we begin, we highly recommend that you learn about the mechanisms of Truffle, the platform-of-choice that we will be using to deploy smart contracts on DEXON. Please refer to https://truffleframework.com/docs for more information.
You can also refer to the following resources for additional information regarding smart contract deployment.
- https://cryptozombies.io/ (fun way to learn about the smart contracts in general)
II. Deploying smart contracts on DEXON
Before we start, we strongly recommend to first deploy the hello sample smart contract provided in the repo onto DEXON first to have a better understanding at the inner workings. Refer to this repo for more information https://github.com/dexon-foundation/hello-dexon.
With the sample contract, go through steps 1, 4, 5 and 6 first to learn about deployment. Steps 2 and 3 are simply steps to make changes to save your own smart contract. The rest of the procedures remain the same.
1. We will first install the repo onto your machine. Note that Truffle will be bundled with this installation to save you time from having to install it again.
a. git clone https://github.com/dexon-foundation/hello-dexon.git b. cd hello-dexon c. npm install
2. Next, we will make changes to the initial commit in the Contracts folder, i.e.,
Hello.sol. Replace it with your smart contract. Save it.
3. Once done, we add in DEXON testnet parameters for migration. In Migrations folder, open
deply_hello.js. Make the changes to that of your smart contract.
4. Compile your smart contract.
npm run compile
5. Now we will set the mnemonic. Copy
secret.js.sample in the repo to a new file and name it
secret.js. Change the mnemonic to that of your own account (seed words are available in the DekuSan extension).
5a. To locate the seed words for your account on DekuSan, refer to the following steps. Ensure your account has sufficient DEX tokens. From the main screen of your account on DekuSan, select the pixelated icon on the top right corner > Settings
5b. Scroll down to Reveal Seed Words. Input the password and copy the seed words. These will be the seed words to your account.
5c. Copy these seed words into const mnemonic.
6. Finally, input the following into your console to deploy the contract.
truffle migrate --network=testnet
7. That’s it. Your smart contract is deployed.
Let’s talk about DEXON
You can register for the newsletter for the latest updates, or join us in our various community discussions in different platforms.
👉 Twitter: https://twitter.com/dexonfoundation
👉 Faceboook: https://www.facebook.com/DEXON.Foundation/
👉 YouTube: https://www.youtube.com/channel/UCbg6l4M8QmSrJphxQvKof5g
👉 Medium: https://medium.com/dexon