This text describes the abstraction of a trust system that allows you to integrate escrow services into any sphere of economic relations.
Depositing funds is a fundamental part of any transaction. If counterparties do not know reliable information about each other, the risk of fraud increases. This asbraction allows you to program a dispute resolution model, a model for conducting automatic transactions, secure transactions, etc. in a decentralized network. This model of trust system is open. All transactions conducted with the participation of the hierarchy of multi-subscription wallets allow you to update the counterparty rating, as well as protect yourself from fraudulent schemes of new participants in economic relations.
Content
1
Introduction2
Multi-signature Wallet Description3
Ways to build a hierarchy of wallets4
Hierarchy Interface of Multi-Purpose Wallets5
Interaction flows5.1
Standard interaction flow5.2
Protected Interaction5.3 The
controversial interaction flow6
ESCB9 protocol7
Integration of the trust system and smart contracts implementing the ESCB9 protocol8
Examples of contracts that implement ESCB98.1
Smart contract for the private property rental market following the example of AirBnb8.2
Smart contract for the exchange of any cryptocurrency for fiat money and back in a decentralized mode9
arbitration nodes10
Dictionary1. Introduction
The main problem for escrow services is the creation of a trust relationship between all participants. At the same time, the participants themselves should not necessarily be known to each subject of the relationship. To summarize all cases, we will take into account that they are all anonymous. For such a trusting system of relations, it is important to regulate the relations of new participants with old ones. Older participants already have a certain rating in the system of relationships and thus cause more confidence. Since nobody knows anyone in the trust system, this causes verification problems of the previous rating. This document provides a description of the trust system based on multi-subscription cryptographs. Such a system can be programmed into a smart contract. In view of the wide distribution of the Ethereum platform, we will choose this platform as the platform for describing all the smart contracts in this document.
2. Description of multi-signature wallet
The abstraction that allows you to confirm or cancel transactions only under the condition that a consensus is reached between the authorized participants to make such a decision is called a multi-subscription purse. A transaction in this context is an atomic operation programmed to execute a method in another or the same smart contract.
The interface for the Smart Contract of such an abstraction can be represented as:
- the designer accepts the addresses of the founding members and the number of required minimum confirmations for the execution of transactions
constructor(address[]:members, uint256:requiredConfirmationCount)
- Interface to work with authorized members
- getting the list of participants
static getMembers() -> address[]:address
- view member address
static getMember(uint256:indexNumber) -> address:address
- checking the address of membership
static isMember(address:address) -> bool:value
- getting the maximum number of participants for the wallet
static getMaxMemberCount() -> uint256:value
- getting a minimum amount of evidence for consensus
static getRequiredConfirmationCount() -> uint256:value
- event of adding a new member
event MemberAddition() -> address:member
- event delete member
event MemberRemoval() -> address:member
- event change required number of confirmations to execute
event RequiredConfirmationCountChange() -> uint256:count
- adding member
execute addMember(address:member) -> void:value
- remove member
execute removeMember(address:member) -> void:value
- member replacement
execute replaceMember(address:currentMember, address:newMember) -> void:value
- change the number of required confirmations to perform
execute changeRequiredConfirmationCount(uint256:count) -> void:value
- Transaction Interface
- verification of transaction confirmation at the participant’s address
static getConfirmationByAddress(uint256:indexNumber, address:addressMember) -> bool:value
- getting information from a transaction
static getTransactionInfo(uint256:indexNumber) -> [address:destination, uint256:value, bytes:data, bool:executed]
- getting total transactions in this wallet
static getTransactionCount() -> uint256:value
- getting transaction confirmation status
static isConfirmed(uint256:transactionId) -> bool:value
- getting confirmation amount
static getConfirmationCount(uint256:transactionId) -> uint256:count
- getting the number of transactions by type
static getTransactionCount(bool:pending, bool:executed) -> uint256:count
- getting the list of participants who confirmed the transaction
static getConfirmations(uint256:transactionId) -> address[]:confirmations
- getting a list of transaction id by type in a certain period of time
static getTransactionIds(uint256:from, uint256:to, bool:pending, bool:executed) -> uint256[]:transactionIds
- event confirming transaction by member
event Confirmation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- event of a member confirmation revocation before a transaction
event Revocation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- event of adding a transaction to the queue
event Submission() -> [uint256:transactionId]
- transaction execution event
event Execution() -> [uint256:transactionId]
- error event during transaction
event ExecutionFailure -> [uint256:transactionId]
- wallet replenishment event
event Deposit -> [address:sender, uint256:amount]
- add transaction by member
execute submitTransaction(address:destination, uint256:value, bytes:data) -> uint256:transactionId
- confirmation of transaction by member
execute confirmTransaction(uint256:transactionId) -> void:value
- member confirmation feedback
execute revokeConfirmation(uint256:transactionId) -> void:value
- manual execution of a transaction
execute executeTransaction(uint256:transactionId) -> void:value
3 Ways to build a hierarchy of wallets
There are two main ways to build a trust system. Vertical and horizontal. The horizontal path of construction involves the creation by one main parent of the list of subsidiary wallets. The vertical path of construction implies a chain consisting of child wallets with reference to the parent. In this case, the parent wallet can be a child of another parent wallet.
As we see the horizontal path of construction can be a subtype of the vertical path of construction. Therefore, we will further disregard this approach.
4 Hierarchy Interface of Multi-Purpose Wallets
To build a trusting system, it is necessary to expand the simple interface of the multi-subscription purse described above, by adding mechanisms for regulating hierarchy and automatic execution of confirmations, as well as the possibility of deferred execution.
- The designer accepts the address of the parent wallet, the addresses of the founding members, the number of required minimum confirmations for the execution of transactions, the standard time for automatic confirmations in seconds
constructor(address:parent, address[]:members, uint256:requiredConfirmationCount, uint256:standardTimeAutoConfirmation)
- Interface to work with participants
- getting the list of participants
static getMembers() -> address[]:address
- function to view member address
static getMember(uint256:indexNumber) -> address:address
- checking the address of membership
static isMember(address:address) -> bool:value
- getting the maximum number of wallet participants
static getMaxMemberCount() -> uint256:value
- getting a minimum amount of evidence for consensus
static getRequiredConfirmationCount() -> uint256:value
- event of adding a new member
event memberAddition() -> address:member
- event delete member
event memberRemoval() -> address:member
- event change required number of confirmations to execute
event requiredConfirmationCountChange() -> uint256:count
- adding member
execute addMember(address:member) -> void:value
- remove member
execute removeMember(address:member) -> void:value
- member replacement
execute replaceMember(address:currentMember, address:newMember) -> void:value
- change the number of required confirmations to perform
execute changeRequiredConfirmationCount(uint256:count) -> void:value
- Hierarchy Interface
- getting a list of child wallets
static getChildren() -> address[]:wallets
- checking whether the wallet address is a child of the current one
static isChild() -> bool:value
- checking whether the address of the wallet is parental to the current one is done through isChild by contrast.
- child wallet attach event
event childAttachment() -> [address:address,uint256:timeStamp]
- child wallet deletion event
event childRemoval() -> [address:address,uint256:timeStamp]
- child wallet attachment
execute attachChild(addres:child) -> void:value
- removal of child wallet
execute removeChild(address:address) -> void:value
- change one child wallet to another
execute replaceChild(address:newAddress) -> void:value
- Transaction Interface
- transaction status check
static getTransactionStatus(uint256:transactionId) -> enum:{submitted,completed,frozen,disputed,reverted}
- checking the status of a transaction for compliance
static isTransactionStatus(uint256:transactionId, uint256:enumStatusNumber) -> bool:value
- verification of transaction confirmation at the participant’s address
static getConfirmationByAddress(uint256:transactionId, address:addressMember) -> bool:value
- getting information from a transaction
static getTransactionInfo(uint256:transactionId) -> [address:destination, uint256:value, bytes:data, bool:executed]
- getting the total number of transactions in the wallet
static getTransactionCount() -> uint256:value
- getting transaction confirmation status
static isConfirmed(uint256:transactionId) -> bool:value
- getting confirmation amount
static getConfirmationCount(uint256:transactionId) -> uint256:count
- getting the number of transactions by type
static getTransactionCount(bool:pending, bool:executed) -> uint256:count
- getting the list of participants who confirmed the transaction
static getConfirmations(uint256:transactionId) -> address[]:confirmations
- getting time to auto-confirm
static getTimeAutoConfirmation(uint256:transactionId) -> uint256:timestamp
- getting a list of transaction id by type in a certain period of time
static getTransactionIds(uint256:from, uint256:to, bool:pending, bool:executed) -> uint256[]:transactionIds
- event confirming transaction by member
event Confirmation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- automatic transaction confirmation event
event AutoConfirmation() -> [uint256:transactionId, uint256:timeStamp]
- event of a member confirmation revocation before a transaction
event Revocation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- event of adding a transaction to the queue
event Submission() -> [uint256:transactionId]
- transaction execution event
event Execution() -> [uint256:transactionId]
- error event during transaction
event ExecutionFailure -> [uint256:transactionId]
- transaction status change event frozen
event TransactionFrozen -> [uint256:transactionId]
- Transaction Status Change Event
event TransactionDisputed -> [uint256:transactionId]
- transaction status change event returned
event TransactionReverted -> [uint256:transactionId]
- wallet replenishment event
event Deposit -> [address:sender, uint256:amount]
- add transaction to execute
execute submitTransaction(address:destination, uint256:value, uint256:TimeAutoConfirmation, bytes:data) -> uint256:transactionId
- transaction confirmation
execute confirmTransaction(uint256:transactionId) -> void:value
- revocation confirmation
execute revokeConfirmation(uint256:transactionId) -> void:value
- change transaction status to frozen
execute setTransactionStatus(uint256:transactionId, uint256:enumStatusNumber) -> void:value
- manual execution of a transaction
execute executeTransaction(uint256:transactionId) -> void:value
- Rating Management
- getting a rating at
static getRatingByAddress(address:agent) -> [uint256:negativeRating, uint256:positiveRating, uint256:countRatingRecords]
- getting rating history by address and order number
static getRatingRecordForAddress(address:agent, uint256:indexNumber) -> void:value
- event of adding an entry to the rating at
event RatingRecordAdded -> [address:author, address:agent, bytes32:smartContractAddress, bool:positiveOrNegative, uin256:ratingNumber, bytes:comment, uint256:indexNumber]
- adding an entry to the rating for the address
execute addRatingRecord(address:agent, bytes32:smartContractAddress, bool:positiveOrNegative, uin256:ratingNumber, bytes:comment) -> void:value
- Integration with ESCB9 protocol
- Checking whether the smart contract is attached to this wallet is a smart contract with ESCB9 implementation
static isAttachedESCB9SmartContract(address:smartContract) -> bool:result
- check the status of the deposit for a smart contract with ESCB9 attached to this wallet
static getDepositStatusForESCB9SmartContract(address:smartContract) -> enum:{awaiting,founded,returned}
- smart contract attach event with ESCB9 implementation to wallet
event AttachingESCB9SmartContract -> [address:smartContract]
- deposit event for smart contract with ESCB9 implementation attached to wallet
event ConfirmationForDepositESCB9SmartContract -> [address:smartContract, uint256:sum, bytes:notice]
- attaching a smart contract with the implementation of ESCB9 to the wallet
execute attachESCB9SmartContract(address:smartContract) -> void:value
- deposit confirmation for smart contract with implementation of ESCB9. If the deposit is in the external system, then notice will be marked. If the deposit is in ETH, then the deposit amount is sent when the method is executed.
execute fundDepositForESCB9SmartContract(address:smartContract, uint256:sum, bytes:notice) -> void:value
5 Interaction flows
Any smart contract can be integrated into the hierarchy of multi-subscription wallets. Such integration will have interaction flows. In general, select several types of streams:
- Standard . In this type of transaction takes place in automatic mode. Without the participation of plenipotentiaries in the purse hierarchy.
- Protected . In this view, the time of the transaction can be increased from the standard to automatically confirm the time to the required. In this case, the participation of authorized members of the purse hierarchy is necessary.
- Controversial . In this form, the party to the transaction may freeze the transaction. In this case, the participation of plenipotentiaries of the purse hierarchy is necessary in order to develop a consensus.
Each wallet in the trust system has a number of authorized participants, who make a verdict. For simple reasoning, we will unite all the authorized participants of the wallet into one concept - the
arbitrator .
5.1 Standard interaction flow
For simplicity, we will bring the concepts of goods and services to the concept of the object of transfer (object), and the concept of fiat money, cryptocurrency to the concept of means of transfer (means).
The counterparty, the owner of the object makes a deal with the counterparty, the owner of the funds, for the purpose of exchange. In this case, the object owner creates a smart escrow contract by sending a standardized transaction to one of the authorized wallets in the hierarchy of multi-subscription wallets. In this case, the transaction is registered by a third party as a trust system. For each transaction is determined by the standard time for its implementation. The counterparty, the owner of the funds, makes a deposit on the transaction by transferring the funds to the trust system. After that, the object owner transfers the object to the owner of the funds. The owner of the funds checks the quality of the object. If, before the end of the transaction time, he did not confirm the quality, the funds are transferred to the owner of the object as part of the transaction. Both counterparties assign comfort ratings to each other. Thus, the owner of the funds can change the interaction flow until the end of the transaction. After the transfer of funds to the owner of the object, the owner of the funds may apply to the purse higher in the hierarchy level for resolving disputes within a certain time limit. After the expiration of this time, the ratings for the transaction are applied to both parties and the transaction becomes non-refundable.
5.2 Protected Interaction
If for some reasons independent of counterparties it is necessary to extend the deadline for making a transaction, then, by agreement of the parties, the multi-signature hierarchy's purse (arbitrator) can change the time allotted for the transaction. After changing the time, the interaction flow that is diverted to the transaction returns to the logic level of the standard flow.
5.3 The controversial interaction flow
If the quality of the object during the transaction does not suit the counterparty, the owner of the funds he brings to the trust system of the multi-subscription purses hierarchy, the transaction can be frozen. In this case, the deposit is not transferred to the counterparty, the owner of the object before the verdict on the transaction. The party holding the funds must provide solid evidence to the arbitrator of the transaction. After that, the arbitrator renders a verdict in favor of one of the counterparties. If any party to the transaction is not satisfied with the verdict, it turns into a higher purse in the order in the hierarchy of multi-subscription purses. Having passed all instances in the hierarchy, either of the parties may request a public vote. This exceptional measure can only be assigned to a purse of absolute authority.
6 ESCB9 protocol
An example of the ESCB9 protocol in the Solidity language as an abstract smart contract (the protocol is under development and can be changed)
contract ESCB9 { modifier onlyArbitrage() { require(msg.sender == arbitrage()); _; } modifier isDeposited { uint i; bytes memory _funcName = bytes4(keccak256("getDepositStatusForESCB9SmartContract(address)")); bytes memory _concat = new bytes(_funcName.length + 32); for(i=0; i < address(this).length; i++) { _concat[i] = address(this)[i]; } require(arbitrage().call.value(0)(_concat) == 1);
7 Integration of the trust system and smart contracts implementing the ESCB9 protocol
To use the trust system of the multi-signature wallets hierarchy in your own project, you need to create a smart contract that implements the ESCB9 standard and attach such a smart contract to one of the arbitrators who does not have any subsidiary wallets. Such wallets in the multi-subscription hierarchy are called “input nodes”. All upstream multi-subscription wallets are called “arbitration nodes”.
8 Examples of contracts that implement ESCB9
8.1 Smart contract for the private property rental market following the example of AirBnb
8.2 Smart contract for the exchange of any fiat money cryptocurrency and back in a decentralized mode
The following example of a smart contract allows you to exchange BTC for fiat money directly, without the participation of exchangers and third-party services. The BTC seller transfers the sum in the smart contract to the BTC blockchain. The buyer, after the deposit is confirmed by the arbitrator, automatically transfers the amount pledged in the contract to the invoice or plastic card number entered in the contract. The arbitrator may intervene in the transaction process after the appeal of one of the participants. Initially, the deposit will be frozen and if the parties do not agree by consensus, then such a contract will become controversial with further resolution along the flow of the disputed interaction.
9 arbitration nodes
To maintain the operation of the trust system, a hierarchy of multi-subscription wallets is introduced. Arbitrage nodes, that is, such purses in the hierarchy, which has a child purse under it act as guarantors of dispute resolution. Plenipotentiary participants for such nodes can only be appointed by the arbitrator superior in the hierarchy. Each plenipotentiary participant receives a reward by distributing dividends and bonuses for working with controversial interaction flows. The size of bonuses is determined by consensus.
To obtain the status of an authorized participant in an arbitration node, you must have a consensus sum of tokens at the address of an authorized participant. Thus, stable receipt of dividends is guaranteed by all participants of arbitration nodes. , .
10
Ethereum – , . , .
– Solidity, , Ethereum, .
() – , , . , .
– , , . . , .
– , , . . , .