Code Monkey home page Code Monkey logo

secret-dero-multisig's Introduction

Secret-DERO-MultiSignature Wallet

This smart contract was originally written for the Dero Stargate Smart Contract competition in 2019. Re-released in 2021 for the dARCH โ€” Decentralized Architecture Competition Series - Event 0: https://forum.dero.io/t/darch-decentralized-architecture-competition-series/1318

screenshot

Disclaimer

At present I have not been able to make this work per source, but I am working on it.

This smart contract was written for the Dero Stargate testnet. It has not been extensively tested for security vulnerabilities, or peer reviewed. It may require modifications to function correctly on the main network, once the main network is released. Use at your own risk.

Description

The multisig wallet allows a group of individuals to collectively control a single account. For example, a multisig wallet could be used to administer funds in an online community, with multiple stake holders who must all agree on how funds are spent.

The multisig wallet stores a balance of Dero, and is owned by multiple owners with equal rights. Any owner can create a new send transaction, with a recipient (Dero address) and an amount to send (Dero). Before the transaction is sent by the wallet, multiple owners must approve the transaction by signing it. The number of signatures required is defined when the wallet is set up, and can be any number between 1 and the number of owners.

When the required number of signatures has been received, the wallet executes the transaction automatically, sending the Dero to the recipient. It is up to the owners to make sure sufficient funds are available in the wallet before signing a transaction. If sending the transaction fails due to insufficient funds, the transaction must be signed again after sufficient funds are available in the wallet.

Owner 1 deploys the wallet, but does not have any special priviledges once the wallet is deployed. Owner 1 must deploy the wallet initially. After the wallet is deployed, the rules of the wallet cannot be changed: number of owners, owner addresses, and number of signatures required to authorize a transaction.

Wallet Setup

Before deployment, the following parameters must be configured by the person deploying the wallet. This person automatically becomes Owner 1.

  • Number of owners
  • Owner addresses
  • Authorization consensus (how many owners must sign a transaction before it is sent)

All user defined parameters are grouped under the userSetup function.

Wallet Deployment

Once setup has been complete, the contract is deployed:

curl --request POST --data-binary @multisig.bas http://127.0.0.1:10103/install_sc

The Dero HE (testnet) daemon and wallet must both be running first. For a more complete guide, check out the official Dero documentation:

https://github.com/deroproject/derohe/

User Interface

The UI is written in Go and must be compiled before use.

  1. go mod init secret-dero-multisig/v1
  2. go get github.com/secretnamebasis/secret-dero-multisig
  3. go get github.com/dixonwille/wmenu
  4. go mod tidy
  5. go run .

Note: All development of source was done on Windows 10. However, I have been working on getting this to work in a linux environment

Once compiled, the smart contract address must be copied into a text file in the same directory as the binary, named scid.txt. The Dero wallet RPC address can also be put into the second line of the text file, to allow running multiple wallets with different port numbers, for testing. For example:

c2c555b3bc90b305aee1653dc7cef75082a6d889465a73a68ba427366166797f
http://127.0.0.1:10103/json_rpc

The user interface has the following functions:

  • Deposit dero into the wallet
  • Create a new transaction to send somebody Dero from the multisig wallet
  • Sign a transaction created by another owner
  • View a list of all transactions, including status

Note: all Dero values are entered and displayed using the as-yet unnamed Dero sub-denomination: 100000 of these units = 1 Dero.

Contact

I can be reached in the Dero project Discord channel (secretnamebasis).

If you found this code useful, any Dero donations are most welcome :) Dero donations address: secretnamebasis

secret-dero-multisig's People

Contributors

lebowski1234 avatar secretnamebasis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.