Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 2.58 KB

Dapp-Development.md

File metadata and controls

48 lines (33 loc) · 2.58 KB

DApp Development

Currently, DEXON uses Ethereum's virtual machine (EVM) as the default VM. So Dapp development on DEXON is exactly the same as on Ethereum. An exception is that if you want to use DEXON's on-chain random oracle.

DEXON's fork of solidity (called dsolidity) supports a special built-in variable called rand. Here is an example of how to use it:

contract Rand {
    uint256 value;

    function update() public {
        value = rand;
    }

    function get() view public returns (uint256) {
        return value;
    }
}

This very simple contract demonstrates how to use the rand variable. When update() is called, the state value is assigned to a random value generated by DEXON's on-chain random oracle.

The most simple way to develop Dapps on DEXON is to use the DEXON version of the Remix IDE: https://remix.dexon.org. You should use this with the DekuSan Web Wallet(Chrome/Firefox). To get free testnet token, please check the faucet.

If you are developing apps with truffle, you will need to use dsolidity. The nodejs version can also be found here.

Truffle

Truffle is a set of tools for developing solidity apps, originally developed by ConsenSys.
The DEXON-port of Truffle uses dsolidity, which supports on-chain unbiased randomness.

Get the DEXON-port of truffle suite from npm install -g @dexon-foundation/truffle
You can check out our demo DApp hello-dexon and learn how to compile, test and deploy your smart contracts.

  1. mkdir hello-dexon && cd hello-dexon
  2. dexon-truffle unbox dexon-foundation/hello-dexon
  3. Use dexon-truffle compile to compile the final byte-code
  4. Deploy onto the DEXON network by dexon-truffle migrate --network=testnet

Ganache

Ganache is a JavaScript mock of Ethereum blockchain, for developing and testing smart contracts and other blockchain operations.
The DEXON version of Ganache adds additional op-codes that DEXON blocklattice introduced.

> npm i -g @dexon-foundation/ganache-cli
> dexon-ganache