Coder Social home page Coder Social logo

togettoyou / fabric-realty Goto Github PK

View Code? Open in Web Editor NEW
698.0 15.0 181.0 263.61 MB

🤹 基于区块链(Hyperledger Fabric)的房地产交易系统(可作为区块链毕设项目参考)

License: MIT License

Go 43.25% Shell 3.36% JavaScript 14.96% Vue 34.09% HTML 0.31% SCSS 3.68% Dockerfile 0.34%
blockchain hyperledger-fabric smart-contracts fabric

fabric-realty's Introduction

🚀 本项目使用 Hyperledger Fabric 构建底层区块链网络, go 编写智能合约,应用层使用 gin+fabric-sdk-go ,前端使用 vue+element-ui

如果想要联系我,可以关注我的公众号【gopher云原生】

gopher云原生

教程

万字长文,教你用go开发区块链应用

🤔 有任何疑问,请先看完本篇文章。本项目涉及的知识点都有在文章中进行说明

手动部署

环境要求: 安装了 Docker 和 Docker Compose 的 Linux 或 Mac OS 环境

附 Linux Docker 安装教程:点此跳转

🤔 Docker 和 Docker Compose 需要先自行学习。本项目的区块链网络搭建、链码部署、前后端编译/部署都是使用 Docker 和 Docker Compose 完成的。

  1. 下载本项目放在任意目录下,例:/root/fabric-realty

  2. 给予项目权限,执行 sudo chmod -R +x /root/fabric-realty/

  3. 进入 network 目录,执行 ./start.sh 部署区块链网络和智能合约

  4. 进入 application 目录,执行 ./start.sh 启动前后端应用,然后就可使用浏览器访问前端页面 http://localhost:8000 ,其中后端接口地址为 http://localhost:8888

  5. (可选)进入 network/explorer 目录,执行 ./start.sh 启动区块链浏览器后,访问 http://localhost:8080,用户名 admin,密码 123456

完全清理环境

注意,该操作会将所有数据清空。按照该先后顺序:

  1. (如果启动了区块链浏览器)进入 network/explorer 目录,执行 ./stop.sh 关闭区块链浏览器

  2. 进入 application 目录,执行 ./stop.sh 关闭区块链应用

  3. 最后进入 network 目录,执行 ./stop.sh 关闭区块链网络并清理链码容器

目录结构

  • application/server : fabric-sdk-go 调用链码(即智能合约),gin 提供外部访问接口(RESTful API)

  • application/web : vue + element-ui 提供前端展示页面

  • chaincode : go 编写的链码(即智能合约)

  • network : Hyperledger Fabric 区块链网络配置

功能流程

管理员为用户业主创建房地产。

业主查看名下房产信息。

业主发起销售,所有人都可查看销售列表,购买者购买后进行扣款操作,并等待业主确认收款,交易完成后,更新房产持有人。在有效期期间可以随时取消交易,有效期到期后自动关闭交易。

业主发起捐赠,指定受赠人,受赠人确认接收受赠前,双方可取消捐赠/受赠。

演示效果

login

addreal

info

explorer

fabric-realty's People

Contributors

fmy1993 avatar perfectli7 avatar togettoyou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fabric-realty's Issues

user not found

failed to create channel context: failed to get client context to create channel client: user not found

启动区块链最后一步失败

报错如下
Error: error getting endorser client for invoke: endorser client failed to connect to peer0.org1.blockchainrealestate.com:7051: failed to create new connection: context deadline exceeded

大佬,第一步启动就出问题Creating cli ... error

区块链 : 启动
Creating network "deploy_default" with the default driver
Creating orderer.blockchainrealestate.com ...
Creating cli ... error

ERROR: for cli Cannot create container for service cli: Conflict. The container name "/cli" is already in use by container "f1b5833e0765d5666d08d25756d4a82cd05da90edef0cd6c2dfa3aec1cc5e8b4". You have to remove (or rename) that
Creating orderer.blockchainrealestate.com ... error

请求失败 network error

请问一下,将此项目部署在阿里云服务器上,为什么会出现请求失败 Network Error呢

pull access denied for fabric-realty.web

在application中运行./start.sh时候,发生错误
pull access denied for fabric-realty.web, repository does not exist or may require 'docker login': denied: requested acce...

区块链浏览器配置问题

您好,十分感谢您分享这个项目,它对我帮助很大!我按照您的说明部署了这个项目,但是访问区块链浏览器时发现上面不能正确显示网络的结点数量,在readme展示图片中也是如此。我想问问是不是区块链浏览器的配置问题,如何修正?谢谢!

多机搭建方面的求助

你好,如果我想进行多机交互,除了在本机hosts文件配置对应ip和在docker-compose.yaml文件里面修改IP配置信息还需要修改什么吗

第七步和第八步出现error,求解答,感恩!!!

七、实例化链码
2021-11-10 15:46:12.036 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-11-10 15:46:12.042 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-11-10 15:46:12.049 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2021-11-10 15:46:12.050 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "no required module provides package github.com/togettoyou/blockchain-real-estate/chaincode/blockchain-real-estate: go.mod file not found in current directory or any parent directory; see 'go help modules'
"
正在等待链码实例化完成,等待5秒
八、验证查询账户信息
2021-11-10 15:46:20.402 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-11-10 15:46:20.409 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-11-10 15:46:20.482 UTC [chaincodeCmd] InitCmdFactory -> INFO 003 Retrieved channel (assetschannel) orderer endpoint: orderer.blockchainrealestate.com:7050
Error: endorsement failure during invoke. response: status:500 message:"make sure the chaincode blockchain-real-estate has been successfully instantiated and try again: chaincode blockchain-real-estate not found"

接口调用智能合约失败event service creation failed:

{"code":500,"msg":"失败","data":"event service creation failed: could not get chConfig cache reference: QueryBlockConfig failed: QueryBlockConfig failed: queryChaincode failed: Multiple errors occurred: - Transaction processing for endorser [127.0.0.1:37051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [127.0.0.1:37051]: connection is in TRANSIENT_FAILURE - Transaction processing for endorser [127.0.0.1:27051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [127.0.0.1:27051]: connection is in TRANSIENT_FAILURE"}

这是什么问题可以告诉我排查思路吗,链码容器内部可以调用成功的

自定义改动代码无法生效

尝试自定义改动代码后,按照要求执行./build.sh并更改docker-compose.yml路径后,依旧无法生效
请问前端打包后的dist文件存放在哪里?是不是除了这两处之外还需要修改其他地方的路径?麻烦作者大大了
image

启动浏览器报错

您好,请问在启动区块链浏览器的时候报这个错该怎么解决啊,我改了好多地方都没用。
QQ截图20210920123349

Changes in Front End is not reflecting...

I tried to change some text from Chinese to English or Arabic in application/web/views pages but it is not reflecting on the browser

Could you please help me how can I update on the front end side?

http://localhost:8000/api/v1/queryAccountList出错 偶尔请求成功

data: Transaction processing for endorser [peer0.jd.com:7051]: Chaincode status Code: (500) UNKNOWN. Description: failed to execute transaction 08405a66e161e0b2b76a825d7ebcfd30d4f540a7860162fd3f243c9b5526ec18: error sending: txid: 08405a66e161e0b2b76a825d7ebcfd30d4f540a7860162fd3f243c9b5526ec18(appchannel) exists

导入其他包报错

您好,我在学习fabric,尝试在这个项目基础上增加一个获取当前channel blockinfo的功能,导入
"github.com/hyperledger/fabric-sdk-go/pkg/client/ledger" 其中有一个queryinfo的函数
我尝试在hello.go导入这个包,但是编译会报错

cannot use responses (type []"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common".Block) as type []"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-protos-go/common".Block in argument to matchBlockData
../vendor/github.com/hyperledger/fabric-sdk-go/pkg/client/ledger/ledger.go:208:23: cannot use responses (type []"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common".Block) as type []"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-protos-go/common".Block in argument to matchBlockData
../vendor/github.com/hyperledger/fabric-sdk-go/pkg/client/ledger/ledger.go:232:23: cannot use responses (type []"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common".Block) as type []"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-protos-go/common".Block in argument to matchBlockData
../vendor/github.com/hyperledger/fabric-sdk-go/pkg/client/ledger/ledger.go:307:2: cannot use response (type *"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/peer".ProcessedTransaction) as type *"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-protos-go/peer".ProcessedTransaction in return argument
../vendor/github.com/hyperledger/fabric-sdk-go/pkg/client/ledger/ledger.go:343:2: cannot use *"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common".Block value as type *"github.com/togettoyou/blockchain-real-estate/vendor/github.com/hyperledger/fabric-protos-go/common".Block in return argument

就是在third-party里有这个ledger的依赖包,但是我也尝试导入
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-protos-go/peer"
这三个包,但是依然报错

也在stackoverflow提问了,请问这个要怎么解决,能直接删了third-party 包吗?

https://stackoverflow.com/questions/66728204/fabric-govendor-project-third-party-issue

刚接触go和fabric,学校里老师让做一个基本的农产品信息上链功能的小demo,遇到这个问题实在解决不了了,谢谢

compatibility mode

您好,该系统运行后好像只和所配置的peer0.org1.blockchainrealestate.com:7051节点进行交互,orderer节点并没有将其排序并广播给其他相邻节点,其他节点也没有日志输出,看起来现在只是在与cli配置的单节点交互,orderer并给出警告:This orderer is running in compatibility mode,看起来好像是配置有问题,我将solo模式换成了kafka模式,并搭建kafka集群,是因为模式转换的问题吗?
此外,配置中并没有配置主节点、背书节点等(包括背书策略),这对后续的交易验证及广播有有影响吗?

如果您有时间,期待您的回复,感谢!

err: signature set did not satisfy policy

链码初始化成功了,但是报这个错,大佬知道吗

validateTx -> ERRO 069 VSCCValidateTx for transaction txId = 50d4ad58d86fed554d1d6ca4bade3b6856a4af5964fe4eede514e6671501fd41 returned error: VSCC error: endorsement policy failure, err: signature set did not satisfy policy
image

user not found

您好,按流程运行后,web界面正常,首页访问会报:failed to create channel context: failed to get client context to create channel client: user not found,查询用户列表失败,但是Admin用户在- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peer/users/[email protected]/msp 中已加入,请问是少了什么配置吗?期待您的回复,谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.