Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support WASM dApps #22

Open
hieudd opened this issue Apr 13, 2023 · 1 comment
Open

Support WASM dApps #22

hieudd opened this issue Apr 13, 2023 · 1 comment

Comments

@hieudd
Copy link
Contributor

hieudd commented Apr 13, 2023

Overview

The goal is to add support for WebAssembly (WASM) dApps to SubConnect. An example of a WASM dApp is available at https://github.com/AstarNetwork/wasm-showcase-dapps.

Tasks

  1. Research the differences between a WASM dApp and a traditional dApp when connected to a Substrate or EVM wallet. Consider the following questions:
    • How do they interact with the account list?
    • How do they use signer objects published by the wallet?
  2. Implement a connector to enable WASM dApps to connect to Substrate or EVM wallets in the same way as traditional dApps.
  3. Fork the Astar dApps repository and move it into the examples folder of SubConnect.
  4. Ensure that the Astar dApp can interact with the wallet via packages/wallet-connect.
  5. Test and verify that the following features work correctly:
    • Connecting to the wallet
    • Signing data
    • Sending transactions in the EVM interface
@minhtri9111199
Copy link

minhtri9111199 commented May 4, 2023

Researching:

  1. WASM dApps:
  • WASM (WebAssembly) is a binary instruction format that can be executed by web browsers and other environments. In the context of blockchain development, WASM is often used as a way to write smart contracts or decentralized applications (dApps) that can run on a variety of blockchain platforms.
  • When a WASM dApp is connected to a Substrate wallet, it can use the Substrate API to interact with the blockchain and query the account list. The Substrate API provides a standardized way to interact with a Substrate node and access blockchain data such as the account list, block information, and transaction data.
  • To use the signer object published by the wallet, the WASM dApp can call the appropriate API methods to sign transactions and send them to the blockchain. The signer object contains the user's private key, which is used to sign transactions and prove ownership of the account.
  1. Traditional dApps:
  • Traditional dApps typically use the Ethereum Virtual Machine (EVM) as their runtime environment, and often use the web3.js library to interact with the blockchain and wallet. The web3.js library provides a standardized way to interact with a Ethereum node and access blockchain data such as the account list, block information, and transaction data.
  • When a traditional dApp is connected to an EVM wallet, it can use the web3.js library to interact with the blockchain and query the account list. The dApp can also use the library to sign transactions and send them to the blockchain.
  • The signer object published by the wallet is used to sign transactions and prove ownership of the account. This object contains the user's private key and is typically accessed through the web3.js library.

In summary, both types of dApps use different runtime environments and libraries to interact with the blockchain and wallet. WASM dApps typically use the Substrate API and signer objects published by the wallet, while traditional dApps typically use the Ethereum Virtual Machine and the web3.js library. However, the end result is similar: both types of dApps can interact with the account list and use signer objects to sign transactions and send them to the blockchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants