Application Building (Dapp) on Plasm Network (Candidates for Parachain on Polkado)

Tram Ho

It is one of the networks built from the Substrate Framework, and also a formidable contender to be a Parachain for Polkadot in the future. Polkadot Relaychain basically does not support Smart Contracts, and that is also an opportunity for Plasm to fill that void.

And one more point that programmers really like is that PLASM completely opensource: https://github.com/PlasmNetwork

Introduce

Instead of writing smart contracts with the Web, Plasm brings familiarity to Ethereum developers, they can freely write Solidity and deploy contracts to Plasm because Plasm supports EVM, now they can support smart contracts to run. on the Dusty testnet network (the future will be Shiden if a successful auction on Kusama).

Practice

In this section, I will guide the steps to be able to build a complete Dapp on the Dusty network

Config metamask

The first is to interact with Dapps as well as interact with Remix to sign transactions.

We will reconfigure the network with the following parameters:

Temporarily, Dusty does not support BlockExplorer, so debugging when transaction errors is quite difficult, but wait for more complete versions on Shiden – hope then the tools for developers have been invested more.

Faucet

To be able to Deploy or create transactions, we must first have a native token on Plasm, as on the config, the native token here has the symbol PLD.

To can faucet a little PLD convenient for testing, you can faucet directly here:

https://plasm-faUC-frontend.vercel.app/

However we are using metamask so the account address will be of the form of ETH address, therefore we need some steps to get the correct address to be able to receive faucet.

The first is to convert from ETH address to prefix 5 through: https://hoonsubin.github.io/evm-substrate-address-converter/index.html

After getting the address converted to prefix 5, it will switch here to get the correct address on the Plasm corresponding to the address on Metamask: https://polkadot.subscan.io/tools/ss58_transform

5 other address prefix is what we need to find, copy and retrieve from this faucet come: https://plasm-faucet-frontend.vercel.app/

And then we have PLD for testing

Note: Since PLD’s decimal is 15 different from Metamask’s default that for native tokens with a decimal is 18 so with 1 PLD displayed in the metamask we will implicitly correspond to 1000 PLD in the Dusty network.

With enough money to pay the transaction fee, next we will build some Dapps

Dapp

Smart Contract

We will use Remix to code as well as deploy the contract to Dusty: https://remix.ethereum.org/

In the article, I will demo a small Dapp demoed in ETH workshop India: Airbnb smart contract

The rest of us is compile and connect the Dusty network via metamask and deploy, the contract after successful deploying will appear:

UI

After deploying is complete, we will have a contract running on Dusty, the next thing is to build the UI to interact with that contract, I have also prepared a folder for you to test directly on it. You can clone and apply the contract address to be able to test and dabble:

In this repo we should learn a bit about Nuxt and Web3js a bit

https://github.com/tranchien2002/dustyPLM-demo

The first is to change the address of the contract in the file:

https://github.com/tranchien2002/dustyPLM-demo/blob/7e65fd050def7992dd008dce81aed215a5ceec49/dapp-ui/plugins/utils.js#L7

Temporarily after replacing it with the new contract deploy address above, we can run it test to test

Run a test and create a transaction, and here are the results after the transaction is successful

Conclude

And finally we were able to run a complete Dapp on Dusty – Plasm’s testnet. For Ethereum devs, it will be quite similar to building on ETH or other EVM-enabled blockchains in general. Hope my article can be of help to you who are starting to learn about Polkadot’s parachains.

Share the news now

Source : Viblo