检测到您已登录华为云国际站账号,为了您更好的体验,建议您访问国际站服务网站 https://www.huaweicloud.com/intl/zh-cn
不再显示此消息
Fabric使用可信数据链接服务时,用户需要结合Hyperledger Fabric链代码开发规范、可信跨链服务的要求与自身业务需求开发自己的跨链链代码。 开发环境准备 下载源码包 父主题: 跨链链代码开发(Hyperledger Fabric)
开发跨链智能合约 开发跨链智能合约前,需要先了解跨链操作的原理。在跨链资产交换场景中,在减少某个链上资产后,需要相应的在对应链上增加资产,这种转移使各条链的资产发生了变化。因此,跨链操作需要保证整个跨链交易结束后不同链之间的全局事务保持一致性,即同时记账,或同时不记账。 可信跨链
开发环境准备 请根据自身业务选择Go(推荐)或其他语言的开发环境。 Go开发环境准备: 安装Go开发环境。安装包下载地址为:https://golang.org/dl/ 。(请选择1.9.2之后的版本) 各个系统对应的包名(以1.14版本为例) 操作系统 包名 Windows go1
* Invoke is the entrance of the chaincode invoking */ func (t *TCSExampleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
/* * unlockAccount will delete the account's lock from the blockchain * @Param account: The name of the account whose lock will be unlocked
blockchain B * @Param args[1]: The name of the account on blockchain B that will receive the amount of units from the account on blockchainA *
blockchain B * @Param args[1]: The name of the account on blockchain B that will receive the amount of units from the account on blockchainA *
blockchain A that will transfer the amount of units to the account on blockchain B * @Param args[1]: The name of the account on blockchain B that
one account to another account */ func putStateWithLock(stub shim.ChaincodeStubInterface, txID string, account string, balance []byte) error
blockchain B * @Param args[1]: The name of the account on blockchain B that will receive the amount of units from the account on blockchainA *
blockchain A that will transfer the amount of units to the account on blockchain B * @Param args[1]: The name of the account on blockchain B that
units of one account to another account */ func rollback(stub shim.ChaincodeStubInterface, txID string, account string) error { // get server
修改跨链资产数值(putStateWithLock) 解锁跨链资产(unlockAccount) 回滚跨链资产(rollback) 父主题: 开发跨链智能合约
blockchain B * @Param args[1]: The name of the account on blockchain B that will receive the amount of units from the account on blockchainA *
下载源码包 下载Fabric源码包作为三方库。可选择使用1.x或2.x风格开发跨链智能合约: 版本 链接 1.x https://github.com/hyperledger/fabric/tree/release-1.4 2.x https://github.com/hyper
合约中定义该后缀常量,便于后续在其他智能合约中使用: const ( lockSuffix = "_Lock" ) 父主题: 开发跨链智能合约
跨链链代码开发(Hyperledger Fabric) 开发前准备 开发跨链智能合约
简介 在使用可信跨链服务时,您需要开发自己的链代码和应用。本文档主要介绍跨链业务链代码的开发,专供具备Go/Java开发经验的开发人员使用。 当前仅“华北-北京四”区域支持可信跨链服务。 购买区块链服务 您可通过华为云区块链服务Hyperledger Fabric增强版实例,具体请参考基于CCE集群部署。
"error_message" : "Failed to send cross tx : Failed to sendPreCrossTransaction: Failed to preCrossRequest: Failed to Generate PreCrossRequest: Failed to get
"error_message" : "Failed to send cross tx : Failed to sendPreCrossTransaction: Failed to preCrossRequest: Failed to Generate PreCrossRequest: Failed to get