Skip to content

Multi-sig Bitcoin Smart Contract is a powerful solution that addresses the limitation of the Bitcoin network by providing increased speed and security for Bitcoin transaction. It creates a "lightning network" on top of the Bitcoin network, allowing multiple transections without having to broadcast them to the entire network.

License

Notifications You must be signed in to change notification settings

CTG-TOKEN/MsB.sol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

MsB

Introduction

In recent years, the use of blockchain technology has grown rapidly, with many companies and organizations looking to utilize its potential to revolutionize the way we conduct business and manage assets. Among the most popular blockchain platforms is Bitcoin, which is widely considered to be the first and most successful application of blockchain technology. However, despite its popularity and success, Bitcoin has several limitations that have prevented it from achieving widespread adoption. These limitations include slow transaction speeds and a lack of security. MsB is a decentralized payment channel that enables fast, secure and low-cost transactions between two parties.

Our proposed solution is a smart contract that can be built on top of the Bitcoin network to provide increased speed and security for Bitcoin transactions. SecureSpeed uses a smart contract deployed on the Ethereum blockchain that stores the payment channel data and implements the logic for managing the channel. The smart contract allows users to deposit funds, withdraw funds, update their deposit, initiate transactions, and resolve disputes.

MsB also integrates an external oracle contract to resolve disputes between the parties involved in a payment channel. The oracle contract can be any contract that implements the resolveDispute(address user1, address user2) function, which returns a tuple of a boolean and a uint.

Background

Bitcoin transactions are processed by a decentralized network of nodes that follow a set of consensus rules. These rules dictate the way the network processes transactions and confirms them in the blockchain. However, the current process for confirming transactions is slow and can take several minutes to complete. Additionally, the decentralized nature of the network also introduces security risks, as transactions can be subject to double-spending and other forms of fraud.

Our smart contract solution addresses these limitations by creating a "lightning network" on top of the Bitcoin network. This lightning network allows participants to open payment channels with one another and make multiple transactions without having to broadcast each one to the entire network. By keeping transactions off-chain, the speed of transactions is greatly increased. Additionally, smart contract can be used to create multisignature wallets, this allows for more secure storage of bitcoin, by requiring more than one signature to authorize a transaction.

Problem Statement

Current blockchain-based payment systems have several limitations such as high transaction costs, slow transaction times, and lack of privacy. SecureSpeed aims to overcome these limitations by creating a decentralized payment channel that allows users to transact directly with each other, without the need for a central intermediary.

Technical details

The MsB contract is written in Solidity, and it's compiled with version 0.11.0. The contract uses a mapping to store the payment channel data, which is organized as a two-dimensional mapping, where the first key is the address of the first user, and the second key is the address of the second user. Each channel is represented by a struct that contains the following fields:

address user1: the address of the first user address user2: the address of the second user uint deposit: the deposit in the channel bool closed: a flag that indicates whether the channel is closed or not

The contract has several functions that allow users to interact with the payment channel:

deposit(address user, uint value): allows a user to deposit funds into the channel. withdraw(address user, uint value): allows a user to withdraw funds from the channel. updateDeposit(address user, uint value): allows a user to update the deposit in the channel. initiateTransaction(address user1, address user2, address recipient, uint value, bytes memory signature1, bytes memory signature2): allows users to initiate a transaction between them, where signature1 is the signature of the first user, and signature2 is the signature of the second user. resolveDispute(address user1, address user2): allows the parties involved in the channel to resolve a dispute by calling the external oracle contract. closeChannel(address user1, address user2): allows the parties involved in the channel to close the channel when the deposit is zero. updateChannel(address user1, address user2, uint newDeposit): allows the parties involved in the channel to update the deposit in the channel. executeTransaction(address user1, address user2, address recipient, uint value, bytes memory signature1, bytes memory signature2): allows the parties involved in the channel to execute a transaction.

The contract also includes a function for opening payment channels between participants. Once a payment channel is open, participants can make multiple transactions without having to broadcast each one to the entire network. This greatly increases the speed of transactions and reduces the number of transactions that need to be confirmed on the blockchain.

Benefits

Fast transaction times: since the transactions are off-chain, they are much faster than on-chain transactions.

Increased privacy: since the transactions are off-chain, they are not visible on the blockchain, which increases the privacy of the parties involved.

Flexibility: the external oracle contract allows for greater flexibility in resolving disputes, as it can be customized to suit the needs of the parties involved.

Security: the use of signatures and the integration of an external oracle contract provide an added layer of security, as they ensure that only the parties involved in the channel can initiate transactions and resolve disputes. Conclusion

Our smart contract provides a solution to the limitations of the Bitcoin network by increasing the speed and security of transactions. By creating a lightning network and multisignature wallets on top of the Bitcoin network, we believe that our smart contract can play a significant role in the widespread adoption of Bitcoin and other blockchain-based platforms. We look forward to continuing to develop and refine our smart contract in the future, and we welcome feedback from the community on how to improve it.

About

Multi-sig Bitcoin Smart Contract is a powerful solution that addresses the limitation of the Bitcoin network by providing increased speed and security for Bitcoin transaction. It creates a "lightning network" on top of the Bitcoin network, allowing multiple transections without having to broadcast them to the entire network.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages