Git Product home page Git Product logo

leixw0102 / blockchain-real-estate Goto Github PK

View Code? Open in Web Editor NEW

This project forked from togettoyou/fabric-realty

0.0 1.0 0.0 19.93 MB

🚀基于区块链的房地产交易系统小模型。提供销售和捐赠功能。本项目使用Hyperledger Fabric构建区块链网络, go编写智能合约,应用层使用gin+fabric-sdk-go调用合约。前端展示使用vue+element。体验地址:http://blockchain.togettoyou.com/web

License: MIT License

Go 50.20% Shell 1.78% JavaScript 17.28% Vue 27.52% CSS 2.97% HTML 0.25%

blockchain-real-estate's Introduction

blockchain-real-estate

2020.6.24 更新详细运行步骤

  1. 确保你的项目目录为$GOPATH/src/github.com/togettoyou/blockchain-real-estate

  2. 项目由于未使用mod管理,请先将go mod环境设置为auto: go env -w GO111MODULE=auto

  3. 首先测试chaincode是否正常调用,运行chaincode/blockchain-real-estate/chaincode_test.go测试用例 image

  4. 在deploy目录下运行./start.sh,观察有无报错提示。运行成功后在终端执行docker exec cli peer chaincode invoke -C assetschannel -n blockchain-real-estate -c '{"Args":["queryAccountList"]}' 等cli命令,Args可以替换为Invoke中的funcName,先验证链码是否正确安装及区块链网络能否正常工作。建议./start.sh之前可以先运行./stop.sh清理一下环境。 image

  5. 如果以上都成功,说明区块链网络是没有问题的。接下来同样先执行application/sdk_test.go单元测试,看是否可以成功使用sdk调用链码(此步骤前提你区块链网络即以上步骤已成功启动) image

  6. 运行application,go run main.go

我的本机测试环境: image


分割线


🚀基于区块链的房地产交易系统小模型。提供销售和捐赠功能。本项目使用Hyperledger Fabric构建区块链网络, go编写智能合约,应用层使用gin+fabric-sdk-go调用合约。前端展示使用vue+element。前后端分离。

注:本项目需放在 $GOPATH/src/github.com/togettoyou/blockchain-real-estate 下运行

技术栈

  • Hyperledger Fabric
  • Docker
  • Go Gin
  • Vue
  • ElementUI

运行

默认已经安装Hyperledger Fabric环境,如果未安装,参考:https://www.yuque.com/togettoyou/blog/his57f

我的本机环境参考:

Snipaste_2020-03-19_14-52-13

1、克隆本项目放在 $GOPATH/src/github.com/togettoyou/blockchain-real-estate

2、进入deploy目录,执行start.sh脚本

# 赋予权限
sudo chmod +x *.sh
# 启动区块链网络
./start.sh
# 停止区块链网络
./stop.sh
# 如果启动失败,可能是环境清理不干净,可以尝试先./stop.sh清理环境再./start.sh启动

3、进入application目录,启动应用程序

# 编译
go build
# 赋予权限
sudo chmod +x application
# 启动
./application

4、浏览器访问 http://localhost:8000/web

目录结构

application : go gin + fabric-sdk-go 调用链码,提供外部访问接口,前端静态资源放在dist目录下

chaincode : go 编写的智能合约

deploy : 区块链网络的配置以及启动停止脚本

vendor : 项目所需依赖包,防止网络原因下载失败

vue : vue + element的前端展示页面

# 如果需要修改前端页面,在vue目录下执行
yarn install
# 启动
yarn dev
# 重新打包生成dist资源,将dist放到application目录下覆盖
yarn build:prod

screenshots : 截图

功能流程

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

业主查看名下房产信息。

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

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

演示效果图

Mar-19-2020_15-28-20

感谢

blockchain-real-estate's People

Contributors

togettoyou avatar

Watchers

James Cloos avatar

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.