Asset Chain Academy
  • Join the Asset Chain Academy
  • MODULE 1: GETTING STARTED
    • Introduction to Asset Chain
    • Environment Setup & Installation
    • Contributing
    • Asset Chain Starter Kits
  • MODULE 2: DEVELOPER RESOURCES
    • Resources Explained
    • Cyfrin Updraft
    • Learnweb3
    • Chainlink Bootcamps
    • Alchemy University
    • Smart Contract Programmer
  • MODULE 3: BEGINNER TUTORIALS
    • Create a Token
    • Write & Deploy an NFT
    • Mint an NFT
    • Asset Chain Explorers
    • Payments
    • Building with Thirdweb
    • Mobile Apps on Asset Chain
    • ⁠ Connecting to wallet
      • Wallet Connect
  • MODULE 4: INTERMEDIATE TUTORIALS
    • Smart Contract Verification
    • MultiSig Wallet
    • Setup a node
    • Staking
    • Setting up an Indexer
    • Asset Chain Telegram Mini App Demo
  • MODULE 5: ADVANCED TUTORIALS
    • EVM-Gas-Optimizations
    • Smart Contract Audit
    • Decentralized Exchanges
    • Arbitrage Bots
    • References
Powered by GitBook
On this page
  • Introduction
  • Tutorial
  • Project Structure
  1. MODULE 4: INTERMEDIATE TUTORIALS

MultiSig Wallet

PreviousSmart Contract VerificationNextSetup a node

Last updated 7 months ago

Introduction

In this section we'll build a MultiSig wallet on AssetChain.

This is a type of wallet in which Funds stored in it can only be moved, if the multiple signatures belonging to the different owners of the wallet, are provided.

Features include:

  • The MultiSig wallet is a 2-of-3 signature address application.

  • Each address that is a part of the quorum can create a transfer by specifying an amount and a recipient.

  • Each approved address can also authorize a transfer.

  • Each transfer needs two approvals to release and send a payment.

  • Any unauthorized address that attempts to perform the actions of a member will be denied.

  • Allows interaction with external contracts using their deployed address and ABI, extending the wallet's functionality.

We will learn some basic Solidity such as mapping or struct and how to deploy it on the Asset Chain (test network). For the frontend, we will use Reactjs.

Tutorial

Before getting started:

  1. Finally, clone the app files stored in the repo above.

We are ready to get started!

Project Structure

  • contracts: Contains the Hardhat-based Smart Contracts.

  • client: Contains the React Application that interacts with the Smart Contracts.

Contracts

The Contracts projects includes;

Client

If you re done cloning the repo above, then proceed to setup the React app on your machine. Navigate to the client sub-folder

$ cd client

then install dependancies and start the application

# Install dependencies
$ yarn install

# Run app
$ yarn dev

Client Contract Interaction

The React application contains two Js classes for interacting with the core contracts. which are

Client features

  1. Viewing and Creating MultiSig Wallets: After successfully connecting a web3 wallet (e.g., MetaMask), the index page ("/") displays a list of multisig wallets where the connected address is one of the approvers (signers). The output of the page is shown below.

    To add a new multisig wallet, click on the "Create Wallet" button, fill in the necessary details in the form that appears, and submit the form.

  2. Transfers: On the index page, clicking the View Wallet button for a specific multisig wallet will navigate to a page that displays a list of transfers (both approved and pending) for the selected wallet. The connected approver can approve any transfer on the list by clicking the Approve button for that particular transfer.

    To create a new transfer, click on the Add Transfer button, fill in the necessary details in the form that appears, and submit the form.

  3. Transactions: After selecting a multisig wallet on the index page, click on the Transactions tab button to navigate to a page that displays a list of transactions (both executed and pending) for the selected wallet. The connected approver can approve any transaction on the list by clicking the "Approve" button for that particular transfer.

    To create a new transaction, click on the "Create Transfer" button. In the form that appears, you can either use the sample external contract address and ABI or another contract deployed on the AssetChain Testnet network. Select the function you want to execute, fill in the selected function's parameters, and submit the form.

Congratulations Champ! If you made it this far, you've built a MultiSig wallet on Asset Chain.

Follow for the step-by-step on how to add AssetChain testnet to .

This guide assumes you have got Testnet RWA and connected to the AssetChain Testnet Network. Learn how to do that in .

MultiSig Wallet Contract: The MultiSigWallet contract's core functions revolve around creating, approving, and executing token transfers and transactions, managed by a set list of approvers. The constructor initializes the contract with approvers, a quorum, and a name. Approvers can create new transfer requests using createTransfer and approve them with approveTransfer, which executes the transfer if the quorum is met. Similarly, they can create transactions with arbitrary data using createTransaction and approve them with approveTransaction, executing the transaction upon reaching the quorum. The contract can receive funds through the receive function, and the onlyApprover modifier ensures only authorized approvers can initiate or approve actions. Functions like getApprovers, getTransfers, and getTransaction provide visibility into the approvers, transfers, and transactions, respectively..

MultiSig Wallet Factory Contract: The MultiSigWalletFactory contract facilitates the creation and tracking of multi-signature wallets (MultiSigWallet instances) on the Ethereum blockchain. It includes functionality to create new wallets with specified sets of approvers and a quorum requirement. Upon creation, each wallet's address is associated with the participating approvers through a mapping, allowing easy retrieval of wallets associated with any given approver. The factory contract maintains a list of all created wallet addresses, enabling visibility into all active wallets spawned from it. Key functions include createWallet, which initializes a new MultiSigWallet instance, updates mappings, emits an event upon creation, and returns the wallet's address. This design supports decentralized applications needing secure multi-party approval mechanisms by providing a scalable and transparent method to manage multiple multi-signature wallets and their signers/approvers.

Sample Smart Contract (ExternalContract): A contract used to test the MultiSig wallet's transaction builder feature.

If you have questions, join our and say hello 👋. We're Active!

Metamask
Testnet Faucets
View Contract
View Contract
View Contract
MultiSigWallet
MultiSigWalletFactory
Telegram
https://github.com/xendfinance/basic-multisiggithub.com
multsig wallet
multisig wallets List
Create Wallet
Transfer List
Create Transfer
Transactions List
Create Transaction