In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article editor for you a detailed introduction of the "Ethernet Square DAO time lock Multisig how to use", the content is detailed, the steps are clear, the details are handled properly, I hope this "etheric Square DAO time lock Multisig how to use" article can help you solve your doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge.
Decentralized Autonomous Organization, abbreviated as DAO, is an important concept in Etay Square. Generally translated as decentralized autonomous organizations.
Sometimes, time can be used as a good security mechanism. The following code is based on the DAO blockchain assembly, but with different changes. Instead of requiring X member approval for each operation, any transaction can be initiated by a single member, but they require minimal delay before execution, depending on the support of the transaction. The more proposals are approved, the sooner they will be implemented. Members can vote on the deal, which means it will cancel another approved signature.
Time lock Multisig
This means that if you are not urgent, only one or two signatures may be required to execute any transaction. However, if a single key is compromised, other keys can delay the transaction for months or years, or even prevent it from executing.
How does this work?
Transactions with all approved keys can be executed after ten minutes (this amount is configurable), and every 5% of unvoted members need twice the time each time (or four times as much if they vote voluntarily). If it is a simple ether transaction, the transaction will be executed as long as you support the vote to put it within the required time, but more complex transactions will require manual execution of the transaction with the correct bytecode. These are default values, but you can set different values when you create a contract:
Number of members approving the deal: approximate time delay
100% approval: 10 minutes (minimum default)
90% approval: 40 minutes
80% for 2 hours and 40 minutes
50%: about a week
40% for 1 month
30% for 4 months
20%: more than one year
10% or less: five years or never once the shortest possible time has passed, anyone can execute a transaction (see Congress for a more complete walk). This is intentional because it allows someone to arrange a transaction or hire someone else to execute the transaction.
Code:
Pragma solidity > = 0.4.22 uint) public memberId; Member [] public members; uint minimumTime = 10; event ProposalAdded (uint proposalID, address recipient, uint amount, string description); event Voted (uint proposalID, bool position, address voter, string justification); event ProposalExecuted (uint proposalID, int result, uint deadline); event MembershipChanged (address member, bool isMember); struct Proposal {address recipient; uint amount; string description; bool executed; int currentResult Bytes32 proposalHash; uint creationDate; Vote [] votes; mapping (address = > bool) voted;} struct Member {address member; string name; uint memberSince;} struct Vote {bool inSupport; address voter; string justification } / / Modifier that allows only shareholders to vote and create new proposals modifier onlyMembers {require (memberID [msg.sender]! = 0); _;} / * * Constructor * * First time setup * / constructor (address founder, address [] memory initialMembers, uint minimumAmountOfMinutes) payable public {if (founder! = address (0)) owner = founder If (minimumAmountOfMinutes! = 0) minimumTime = minimumAmountOfMinutes; / / It's necessary to add an empty first member addMember (address (0),''); / / and let's add the founder, to save a step later addMember (owner, 'founder'); changeMembers (initialMembers, true) } / * Add member * * @ param targetMember address to add as a member * @ param memberName label to give this member address * / function addMember (address targetMember, string memory memberName) onlyOwner public {uint id; if (memberId [targetMember] = = 0) {memberId [targetMember] = members.length; id = members.length++ } else {id = memberId [targetMember];} members [id] = Member ({member: targetMember, memberSince: now, name: memberName}); emit MembershipChanged (targetMember, true);} / * * Remove member * * @ param targetMember the member to remove * / function removeMember (address targetMember) onlyOwner public {require (memberIdtargetMember)! = 0) For (uint I = memberId [targetMember]; I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.