https://github.com/sssshefer/timelock-voting
Timelock voting solidity smart contract
https://github.com/sssshefer/timelock-voting
blockchain ethersjs hardhat solidity
Last synced: about 2 months ago
JSON representation
Timelock voting solidity smart contract
- Host: GitHub
- URL: https://github.com/sssshefer/timelock-voting
- Owner: sssshefer
- Created: 2024-07-15T17:53:01.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-20T22:10:37.000Z (9 months ago)
- Last Synced: 2025-01-12T10:48:26.961Z (4 months ago)
- Topics: blockchain, ethersjs, hardhat, solidity
- Language: TypeScript
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# Timelock Voting with Multi-Signature Authentication
This repository contains a Solidity smart contract for a Timelock Voting system with multi-signature authentication. The project demonstrates the use of time-based transaction execution with multi-signature verification to ensure security and consensus among multiple owners.
## Table of Contents
- [Introduction](#introduction)
- [Notes](#notes)
- [Timelock Mechanism](#timelock-mechanism)
- [Multi-Signature Authentication](#multi-signature-authentication)
- [Features and Functionality](#features-and-functionality)
- [Implementation](#implementation)
- [Contract Overview](#contract-overview)
- [Tests](#tests)
- [Running the Project Locally](#running-the-project-locally)## Introduction
This project showcases a Timelock Voting contract that allows multiple owners to queue, confirm, and execute transactions after a specified delay. The contract ensures that all transactions are approved by a majority of owners before execution, enhancing security and preventing unauthorized actions. The implementation includes a testing suite written in TypeScript using Hardhat and Ethers.js.
## Notes
### Timelock Mechanism
A timelock mechanism ensures that transactions are executed only after a predetermined delay. This delay period provides a buffer time for owners to review the transaction details
### Multi-Signature Authentication
Multi-signature authentication requires multiple owners to approve a transaction before it can be executed. This increases security by distributing control among several owners, ensuring that no single owner can unilaterally execute transactions. The contract uses a threshold of more than 50% of owners' confirmations for transaction approval.
## Features and Functionality
- **Multi-Signature Authentication**: Ensures transactions are approved by a majority of owners before execution.
- **Timelock Mechanism**: Transactions can only be executed after a specified delay, preventing immediate execution and allowing for review.
- **Transaction Queueing**: Owners can queue transactions with specified execution timestamps.
- **Confirmation and Execution**: Owners can confirm queued transactions, which can then be executed once the required confirmations are met.## Implementation
### Contract Overview
The `TimelockVoting` contract includes the following key components:
- **Transaction Struct**: Stores transaction details, including queued status, confirmations, and confirmation count.
- **Owner Management**: Manages a list of owners and their confirmation status for transactions.
- **Transaction Queueing**: Allows owners to queue transactions with specific execution timestamps.
- **Confirmation and Execution**: Enables owners to confirm queued transactions and execute them once the required confirmations are met.### Tests
The project includes a comprehensive test suite written in TypeScript using Hardhat and Ethers.js. The tests cover various scenarios, including adding transactions to the queue, confirming transactions, executing transactions, and handling edge cases
## Running the Project Locally
To run the project locally, follow these steps:
1. Clone the repository:
```bash
git clone https://github.com/sssshefer/timelock-voting.git
```2. Navigate to the project directory and install dependencies:
```bash
cd timelock-voting
npm install
```3. Compile the smart contracts:
```bash
npx hardhat compile
```4. Deploy the contracts to a local Hardhat network:
```bash
npx hardhat node
npx hardhat run scripts/deploy.ts --network localhost
```5. Run the test suite:
```bash
npx hardhat test
```*Happy coding!*