One of the fastest ways to start building your own dApp is using WanMask. WanMask (https://wanmask.io) is a browser extension that allows users to interact with the Wanchain Blockchain from their browser. Its also a Wanchain wallet that allows you to store your Wancoin and cross-chain tokens safely. It also supports hardware wallets.
The most important aspect of WanMask is that it allows you to interact with smart contracts which gives you as a Wanchain Developer the opportunity to have them interact with your dApp in their browser without having the burden of loading a complete wallet.
WanMask includes a safe signing process where users are asked to confirm transactions first. It was ported from MetaMask and has the same options that MetaMask has. In the future also cross-chain functionality will be added to it to further enhance the possibilities you have with your dApp.
Getting WanMask is as easy as going to https://wanmask.io and click the install extension button. That takes you to the right link in the Chrome store to install the extension. Follow the instructions given to you by the extension to setup your first wallet.
You can fund your WanMask on Testnet using the Wanchain Faucets
You could also run a local dev node and point your WanMask there, thats outside of the scope of this document though.
WanMask works by injecting a JavaScript object on every page your user loads. This object is called a wan3 object, just like MetaMask injects a web3 object. Wan3 is a Javascript API that allows you to interact with the Wanchain Blockchain.
In your dApp there is a number of steps you need to take:
Below you will find example code for all these steps. If you install WanMask and fund your account you can try it from within this documentation. Click the result tab in each of the examples to see the output.
See the Pen WanMask Demo by Peter van Mourik (@tyrion70) on CodePen.
See the Pen WanMask Demo by Peter van Mourik (@tyrion70) on CodePen.
See the Pen WanMask Demo 3 by Peter van Mourik (@tyrion70) on CodePen.
You’ve seen the basics to interact with your dApp, now your imagination is the limit!