logo
    Go back
    paul simroth solidity cover image

    My Projects: Multi Signature Ethereum Wallet

    January 12, 2024

    Logo Paul Simroth

    Paul Simroth

    Made as part of Moralis Academy's Ethereum Smart Contract Programming 101 course, this project is more than just code - it's a Multi-Signature Ethereum wallet, my first project using Solidity and my beginning of navigating the decentralized web..

    • Web3
    • Learning
    • Solidity

    My Projects: Multi Signature Ethereum Wallet

    In the ever-evolving landscape of decentralized technologies, my journey through the Ethereum Smart Contract Programming 101 course at Moralis Academy stands out as a transformative odyssey. At its finish line lies this project, a testament to my commitment to mastering Solidity and Web3. This project, created as part of this course, is not merely lines of code; it's a Multi-Signature Ethereum wallet—a paradigm shift in decentralized finance.

    You can see the code here: https://github.com/paulsimroth/Ethereum101-course-project

    About this Project: A Glimpse into Web3 Mastery

    At the center of this repository lies the culmination of what I had learned thus far - a Multi-Signature Ethereum wallet designed as a part of the Ethereum Smart Contract Programming 101 Course. Completed on November 8th, 2021, this project goes above traditional wallet functionalities, introducing a multi-faceted layer of security and decentralization.

    Decoding the Wallet Project:

    At its core, the wallet is a manifestation of Solidity prowess, showcasing the art of writing smart contracts—a skill sharpened under the tutelage of Moralis Academy. The emphasis on multi-signature functionality introduces an extra layer of security, revolutionizing transaction approval processes within the Ethereum ecosystem.

    Key Features:

    • Multi-Signature Functionality: The project's centerpiece, the multi-signature functionality, requires the consensus of designated administrators for any transaction to proceed. This safeguards the assets within the wallet, adding an unparalleled layer of security.
    • Admin Approval Mechanism: In this decentralized ballet, the administrators play a pivotal role. Their collective approval becomes the key to unlock the gates of the wallet, ensuring that no single entity holds absolute control—a crucial aspect in mitigating risks associated with single points of failure.
    • Technology Stack & Tools: Solidity emerges as the protagonist in this narrative, being the language of choice for crafting smart contracts. This technological backbone empowers the wallet, offering a robust foundation for secure and trustless transactions within the Ethereum blockchain.

    Decoding the Code: A Step-by-Step Guide

    1. Contract Structure:

    The contract structure includes mappings for balances and approvals, a counter for transfer IDs, and a limit for approvals. The Transfer struct encapsulates details of a transfer request, and arrays store requests and owner addresses. The constructor initializes the deployer as the first owner.

    2. Modifier for Admins:

    The modifier onlyOwner ensures that only owners can execute certain functions. It iterates through the 'owners' array to validate the caller and make sure the address calling certain functions has been given the role of owner.

    3. Add Admin Function:

    The addAdmin function allows an owner to add a new administrator to the owners' array, updating the approval limit accordingly.

    4. Regular End-user Functions:

    Explanation: The functions deposit() public payable and withdraw(uint amount) public enable end-users to deposit and withdraw ETH from their accounts.

    5. Transfer Request Function:

    • Purpose: This function allows an owner to create a transfer request.
    • Input Parameters:
      • _receiver: The address of the recipient.
      • _amount: The amount of Ether to be transferred.
    • Conditions:
      • It checks if the owner has sufficient balance for the requested transfer.
      • Ensures that the sender and receiver are not the same.
    • Action:
      • It creates a Transfer struct (transferInstance) with details such as sender, receiver, amount, approvals, and a unique ID.
      • This instance is then added to the transferRequests array.

    The transferId is incremented for uniqueness.

    6. Approve Transfer Function:

    • Purpose: This function allows an owner to approve a transfer request and execute it if the required approvals are met.
    • Input Parameters:
      • id: The unique ID of the transfer request to be approved.
    • Conditions:
      • Checks if the owner has not already authorized the transfer.
    • Action:
      • Marks the transfer as authorized by setting approvals[msg.sender][transferId] to true.
      • Increments the approval count for the specific transfer request.
      • If the approvals reach the defined limit (approvalLimit), it executes the transfer:
        • Deducts the transferred amount from the approving owner's balance.
        • Adds the transferred amount to the receiver's balance.
        • Initiates the actual transfer of Ether to the receiver's address.
      • Returns a message indicating whether the transaction was approved or not.

    7. Get Balance Function:

    This function enables users to check their account balance.

    Conclusion

    This project was my first introduction to Solidity and helped me understand the basics of Ethereum Wallets, Smart Contract Programming and other valuable lessons, offering a skill set that is not just technical proficiency but a key to unlocking the untapped potential of blockchain technology and web3.

    To everyone navigating the vast realms of Web3, this project showcases my commitment, skills, and understanding of solidity. Feel free to explore my repository, delve into the code, and envision the potential this project brings to your team or personal aspirations. If you have any questions, please feel free to contact me!

    Go back

    This site uses Cookies. By clicking "Accept All" you help me with improving this website and its performance better. It helps me understand where the website is visited from and by how many people. "Accept (required only)" only tracks the performance of the website. Visit the Data Policy for more information!