本文介绍了信任系统的抽象,该系统使您可以将托管服务集成到经济关系的任何领域。
存入资金是任何交易的基本组成部分。 如果交易对方不了解彼此的可靠信息,那么欺诈的风险就会增加。 通过这种方式,您可以对分散网络中的争端解决模型,自动交易,安全交易等模型进行编程,而且这种信任系统模型是开放的。 在多订阅钱包层次结构的参与下进行的所有交易都使我们能够验证交易对手的评级,并保护自己免受经济关系新参与者的欺诈性计划的侵害。
目录内容
1
引言2
多签名钱包的说明建立钱包层次结构的 3
种方法4个
多日钱包层次结构界面5个
互动流5.1
标准交互流程5.2
安全交互流程5.3
有争议的互动流程6
协议ESCB97
集成信任系统和实现ESCB9协议的智能合约8
实施ESCB9的合同示例8.1
以AirBnb为例,针对私人租赁市场的智能合约8.2一种
智能合约,用于将任何加密货币兑换为法定货币并以去中心化方式返还9个
仲裁节点10
字典1.简介
托管服务的主要问题是在所有参与者之间建立信任关系。 此外,参与者本身不一定必须对每个关系主题都了解。 总结所有情况,我们将考虑它们都是匿名的。 对于这种信任的关系系统,重要的是调节新参与者与老参与者的关系。 老参与者在关系系统中已经有了一定的评价,因此可以增强信心。 由于在信任系统中没有人认识任何人,因此这会导致对先前评级的验证出现问题。 本文档介绍了基于多订阅加密钱包的信任系统。 可以将这样的系统编程为智能合约。 鉴于以太坊平台的广泛分布,我们将选择该平台作为描述本文档中所有智能合约的平台。
2.多签名钱包的说明
仅当授权参与者之间达成共识才能做出决定时,才允许您确认或取消交易的抽象称为多签名钱包。 在这种情况下,交易是一种原子操作,被编程为执行另一个或相同智能合约中的方法。
这样的抽象的智能合约的接口可以表示为:
- 构造函数接受创始成员的地址和交易所需的最低限度确认数
constructor(address[]:members, uint256:requiredConfirmationCount)
- 授权参与者界面
- 获取参与者列表
static getMembers() -> address[]:address
- 查看会员地址
static getMember(uint256:indexNumber) -> address:address
- 会员地址验证
static isMember(address:address) -> bool:value
- 获取钱包的最大参与者数量
static getMaxMemberCount() -> uint256:value
- 最低共识确认
static getRequiredConfirmationCount() -> uint256:value
- 添加新成员的事件
event MemberAddition() -> address:member
- 成员删除事件
event MemberRemoval() -> address:member
- 更改事件所需的确认执行数量
event RequiredConfirmationCountChange() -> uint256:count
- 添加成员
execute addMember(address:member) -> void:value
- 成员删除
execute removeMember(address:member) -> void:value
- 会员更换
execute replaceMember(address:currentMember, address:newMember) -> void:value
- 更改强制执行确认的数量
execute changeRequiredConfirmationCount(uint256:count) -> void:value
- 交易界面
- 在参与者的地址上验证交易确认
static getConfirmationByAddress(uint256:indexNumber, address:addressMember) -> bool:value
- 从交易中获取信息
static getTransactionInfo(uint256:indexNumber) -> [address:destination, uint256:value, bytes:data, bool:executed]
- 获取此钱包中的交易总数
static getTransactionCount() -> uint256:value
- 接收交易确认状态
static isConfirmed(uint256:transactionId) -> bool:value
- 收到确认数
static getConfirmationCount(uint256:transactionId) -> uint256:count
- 按类型获取交易数量
static getTransactionCount(bool:pending, bool:executed) -> uint256:count
- 获取确认交易的参与者列表
static getConfirmations(uint256:transactionId) -> address[]:confirmations
- 在一段时间内按类型获取交易ID的列表
static getTransactionIds(uint256:from, uint256:to, bool:pending, bool:executed) -> uint256[]:transactionIds
- 派对交易确认活动
event Confirmation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- 交易前参与者确认提款事件
event Revocation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- 队列事务添加事件
event Submission() -> [uint256:transactionId]
- 交易执行事件
event Execution() -> [uint256:transactionId]
- 交易错误事件
event ExecutionFailure -> [uint256:transactionId]
- 钱包补货活动
event Deposit -> [address:sender, uint256:amount]
- 会员添加交易
execute submitTransaction(address:destination, uint256:value, bytes:data) -> uint256:transactionId
- 参与者确认交易
execute confirmTransaction(uint256:transactionId) -> void:value
- 参加者撤回确认书
execute revokeConfirmation(uint256:transactionId) -> void:value
- 手动交易
execute executeTransaction(uint256:transactionId) -> void:value
建立钱包层次结构的3种方法
建立信任系统有两种主要方法。 垂直和水平。 水平构建方式意味着由一位主要父母创建一系列孩子钱包。 垂直的构建方式隐含了一个由子钱包组成的链,该子钱包涉及父链。 在这种情况下,父钱包可以是另一个父钱包的孩子。
如我们所见,水平施工路径可能是垂直施工路径的一个亚种。 因此,我们进一步将这种方法放在无人看管的位置。
4个多日钱包层次结构界面
为了建立信任系统,有必要扩展上述多订阅钱包的简单界面,添加用于调节层次结构和自动执行确认的机制,以及推迟执行的可能性。
- 构造函数接受父钱包的地址,创始成员的地址,交易所需的最低限度确认数,自动确认的标准时间(以秒为单位)
constructor(address:parent, address[]:members, uint256:requiredConfirmationCount, uint256:standardTimeAutoConfirmation)
- 会员界面
- 获取参与者列表
static getMembers() -> address[]:address
- 查看参与者地址的功能
static getMember(uint256:indexNumber) -> address:address
- 会员地址验证
static isMember(address:address) -> bool:value
- 获得钱包参与者的最大数量
static getMaxMemberCount() -> uint256:value
- 最低共识确认
static getRequiredConfirmationCount() -> uint256:value
- 添加新成员的事件
event memberAddition() -> address:member
- 成员删除事件
event memberRemoval() -> address:member
- 更改事件所需的确认执行数量
event requiredConfirmationCountChange() -> uint256:count
- 添加成员
execute addMember(address:member) -> void:value
- 成员删除
execute removeMember(address:member) -> void:value
- 会员更换
execute replaceMember(address:currentMember, address:newMember) -> void:value
- 更改强制执行确认的数量
execute changeRequiredConfirmationCount(uint256:count) -> void:value
- 层次结构界面
- 获取儿童钱包列表
static getChildren() -> address[]:wallets
- 检查钱包地址是否是当前地址的子地址
static isChild() -> bool:value
- 通过isChild通过对比来检查钱包地址是否是当前地址的父母。
- 会员钱包附件活动
event childAttachment() -> [address:address,uint256:timeStamp]
- 儿童钱包清除活动
event childRemoval() -> [address:address,uint256:timeStamp]
- 贴上儿童钱包
execute attachChild(addres:child) -> void:value
- 删除子钱包
execute removeChild(address:address) -> void:value
- 将一个孩子的钱包换成另一个
execute replaceChild(address:newAddress) -> void:value
- 交易界面
- 检查交易状态
static getTransactionStatus(uint256:transactionId) -> enum:{submitted,completed,frozen,disputed,reverted}
- 检查交易状态是否合规
static isTransactionStatus(uint256:transactionId, uint256:enumStatusNumber) -> bool:value
- 在参与者的地址上验证交易确认
static getConfirmationByAddress(uint256:transactionId, address:addressMember) -> bool:value
- 从交易中获取信息
static getTransactionInfo(uint256:transactionId) -> [address:destination, uint256:value, bytes:data, bool:executed]
- 获取钱包中的交易总数
static getTransactionCount() -> uint256:value
- 接收交易确认状态
static isConfirmed(uint256:transactionId) -> bool:value
- 收到确认数
static getConfirmationCount(uint256:transactionId) -> uint256:count
- 按类型获取交易数量
static getTransactionCount(bool:pending, bool:executed) -> uint256:count
- 获取确认交易的参与者列表
static getConfirmations(uint256:transactionId) -> address[]:confirmations
- 抽出时间进行自动确认
static getTimeAutoConfirmation(uint256:transactionId) -> uint256:timestamp
- 在一段时间内按类型获取交易ID的列表
static getTransactionIds(uint256:from, uint256:to, bool:pending, bool:executed) -> uint256[]:transactionIds
- 派对交易确认活动
event Confirmation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- 自动交易确认事件
event AutoConfirmation() -> [uint256:transactionId, uint256:timeStamp]
- 交易前参与者确认提款事件
event Revocation() -> [address:sender, uint256:transactionId, uint256:timeStamp]
- 队列事务添加事件
event Submission() -> [uint256:transactionId]
- 交易执行事件
event Execution() -> [uint256:transactionId]
- 交易错误事件
event ExecutionFailure -> [uint256:transactionId]
- 交易状态更改为冻结事件
event TransactionFrozen -> [uint256:transactionId]
- 交易状态更改为争议事件
event TransactionDisputed -> [uint256:transactionId]
- 交易状态更改为返回的事件
event TransactionReverted -> [uint256:transactionId]
- 钱包补货活动
event Deposit -> [address:sender, uint256:amount]
- 添加交易以执行
execute submitTransaction(address:destination, uint256:value, uint256:TimeAutoConfirmation, bytes:data) -> uint256:transactionId
- 交易确认
execute confirmTransaction(uint256:transactionId) -> void:value
- 撤销确认
execute revokeConfirmation(uint256:transactionId) -> void:value
- 将交易状态更改为冻结
execute setTransactionStatus(uint256:transactionId, uint256:enumStatusNumber) -> void:value
- 手动交易
execute executeTransaction(uint256:transactionId) -> void:value
- 评分管理
- 获得评级
static getRatingByAddress(address:agent) -> [uint256:negativeRating, uint256:positiveRating, uint256:countRatingRecords]
- 通过地址和序列号获取评分历史
static getRatingRecordForAddress(address:agent, uint256:indexNumber) -> void:value
- 将记录添加到评分的事件
event RatingRecordAdded -> [address:author, address:agent, bytes32:smartContractAddress, bool:positiveOrNegative, uin256:ratingNumber, bytes:comment, uint256:indexNumber]
- 将记录添加到地址的评价中
execute addRatingRecord(address:agent, bytes32:smartContractAddress, bool:positiveOrNegative, uin256:ratingNumber, bytes:comment) -> void:value
- 与ESCB9协议集成
- 在地址处检查此钱包附带的智能合约是否为具有ESCB9实现的智能合约
static isAttachedESCB9SmartContract(address:smartContract) -> bool:result
- 检查此钱包附有ESCB9的智能合约的存款状态
static getDepositStatusForESCB9SmartContract(address:smartContract) -> enum:{awaiting,founded,returned}
- 与ESCB9钱包实现附加智能合约的事件
event AttachingESCB9SmartContract -> [address:smartContract]
- 附带ESCB9钱包的智能合约的存款事件
event ConfirmationForDepositESCB9SmartContract -> [address:smartContract, uint256:sum, bytes:notice]
- 将具有ESCB9实现的智能合约附加到钱包
execute attachESCB9SmartContract(address:smartContract) -> void:value
- 通过ESCB9实现的智能合约的存款确认。 如果存放在外部系统中,则该通知将带有标签。 如果存款以ETH为单位,则在执行该方法时发送存款金额。
execute fundDepositForESCB9SmartContract(address:smartContract, uint256:sum, bytes:notice) -> void:value
5个互动流
任何智能合约都可以集成到多签名钱包的层次结构中。 这样的整合将产生互动流。 一般而言,我们区分几种类型的流:
- 标准 。 以这种形式,交易自动进行。 没有钱包层次结构的授权成员的参与。
- 受保护的 。 通过这种形式,交易时间可以从自动确认时间的标准增加到必要的时间。 在这种情况下,钱包层次结构的授权成员必须参与。
- 有争议的 。 以这种形式,交易参与者可以冻结交易。 在这种情况下,必须建立钱包层次结构的授权成员才能达成共识。
信任系统中的每个钱包都有许多全权参与者,这些参与者都会下达判决。 出于简单的推理,我们将把钱包中的所有授权参与者合并为一个概念-
仲裁器 。
5.1标准交互流程
为了简化表示,我们将商品和服务的概念引入转移对象(object)的概念,并将法定货币,加密货币的概念引入转移手段(means)的概念。
交易对象(对象的所有者)与交易对象(资金的所有者)进行交易以进行交换。 在这种情况下,对象的所有者通过将标准化交易发送到多签名钱包层次结构中的授权钱包之一来创建智能托管合同。 在这种情况下,该交易由第三方注册为信任系统。 对于每个事务,确定执行的标准时间。 交易对手,即资金的拥有者,通过将资金转移到信托系统来在交易中进行存款。 之后,对象的所有者将对象转移给资金的所有者。 资金的所有者检查对象的质量。 如果在交易时间结束之前他没有确认质量,则将资金作为交易的一部分转移给对象的所有者。 双方都给对方舒适度等级。 因此,资金的所有者可以在交易结束之前更改交互的流程。 在将资金转移给对象的所有者之后,资金的所有者可以在层次结构级别中向更高级别的钱包提出申请,以在法规规定的时间内解决纠纷。 在此时间之后,交易的评级将应用于双方,交易将不可撤消。
5.2安全交互流程
如果由于某些原因超出了交易对手的控制范围,必须延长交易的截止日期,那么,在当事方的同意下,多签名层次结构钱包(仲裁者)可以更改为交易分配的时间。 更改时间后,分配给事务的交互流将返回到标准流的逻辑级别。
5.3有争议的互动流程
如果交易过程中对象的质量不适合交易对手,即他为多签名钱包层次结构的信托系统提供资金的所有者,则交易可能会被冻结。 在这种情况下,直到发布交易判决之前,保证金都不会转移到交易对象的所有者对方。 资金持有人必须向交易的仲裁人提供大量证据。 此后,仲裁员作出有利于交易对方之一的裁决。 如果交易的任何一方对判决不满意,它将按照多重签名钱包层次结构中的顺序转到更高的钱包。 通过所有层次结构实例后,任何一方都可以请求公开投票。 这种例外措施只能由绝对的钱包分配。
6协议ESCB9
Solidity中的ESCB9协议示例作为抽象智能合约(该协议正在开发中,可能会发生更改)
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集成信任系统和实现ESCB9协议的智能合约
要在您自己的项目中使用多重签名钱包的层次结构的信任系统,您需要创建一个实现ESCB9标准的智能合约,并将这种智能合约附加到没有附属钱包的仲裁者之一。 多订阅层次结构中的此类钱包称为“输入节点”。 所有上游多重签名钱包均称为“仲裁节点”。
8实施ESCB9的合同示例
8.1以AirBnb为例,针对私人租赁市场的智能合约
8.2一种智能合约,用于将任何加密货币兑换为法定货币并以去中心化方式返还
下文描述的智能合约示例使您无需交换者和第三方服务即可直接用BTC兑换法定货币。 BTC卖方将智能合约中的金额转移到BTC区块链中的存款中。 买方在确认仲裁员的押金后,自动将合同中规定的金额转入合同中包含的帐户或塑料卡号。 一名参与者提出上诉后,仲裁员可以介入交易过程。 最初,定金将被冻结,如果各方不同意达成共识,则该合同将成为有争议的,并进一步解决有争议的互动流程。
9个仲裁节点
为了维护信任系统的工作,引入了多个签名钱包的层次结构。 仲裁节点,即层次结构中具有子钱包的此类钱包,充当争端解决的保证人。 此类节点的全权代表只能由上级任命。 每个授权参与者通过分配有争议的互动流程而获得的红利和奖金,将获得奖励。 奖金数额由共识决定。
为了获得仲裁节点中授权参与者的状态,必须在授权参与者的地址上具有共识定义的令牌数量。
因此,保证了仲裁节点的所有参与者稳定地接收股息。多签名钱包的层次结构越高,授权参与者的地址上应出现的令牌越多。10字典
以太坊是一种开源技术,可让您创建去中心化,不变的交易链。可以在智能合约中记录的某些条件下执行每个交易。智能合约 -用Solidity编写,在以太坊虚拟机中执行的逻辑,使您能够扩展交易逻辑。多签名钱包(仲裁者)是一种特殊的智能合约,由一组可以确认或取消交易的授权参与者控制。使用多订阅钱包机制,您可以创建用于交易的网关链,并及时监控执行或退款。对象的所有者-是房东,供应商,软件产品的开发人员等。即,出售对象并最终获得保证金的人。资金所有者 -是软件产品的承租人,购买者,客户等。也就是说,将资金存入对象以购买产品或服务的人。