All Projects → newham → fabric-iot

newham / fabric-iot

Licence: other
fabric-iot is a Blockchain Based Decentralized Access Control System in IoT

Programming Languages

shell
77523 projects
go
31211 projects - #10 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to fabric-iot

hlf-operator
Hyperledger Fabric Kubernetes operator - Hyperledger Fabric operator for Kubernetes (v2.2+)
Stars: ✭ 112 (+124%)
Mutual labels:  hyperledger-fabric, chaincode
fabric-network-boilerplate
Boilerplate for starting your hyperledger fabric network
Stars: ✭ 63 (+26%)
Mutual labels:  hyperledger-fabric, chaincode
hlfabric-k8scc
Chaincode builder and launcher for Hyperledger Fabric on Kubernetes
Stars: ✭ 21 (-58%)
Mutual labels:  hyperledger-fabric, chaincode
writing-chaincode
A repository to help experience developers with no Go or chaincode development experience to write and debug chaincodes.
Stars: ✭ 19 (-62%)
Mutual labels:  hyperledger-fabric, chaincode
Fabric Chaincode Java
Hyperledger Fabric Contract and Chaincode implementation for Java https://wiki.hyperledger.org/display/fabric
Stars: ✭ 188 (+276%)
Mutual labels:  hyperledger-fabric
Decentralized Energy Composer
WARNING: This repository is no longer maintained ⚠️ We are no longer showing the Hyperledger Composer Service.
Stars: ✭ 129 (+158%)
Mutual labels:  hyperledger-fabric
Android Kubernetes Blockchain
WARNING: This repository is no longer maintained ⚠️ This repository will not be updated. The repository will be kept available in read-only mode. Refer to https://developer.ibm.com/patterns/category/blockchain/ for other blockchain code patterns.
Stars: ✭ 105 (+110%)
Mutual labels:  hyperledger-fabric
Structure And Interpretation Of Blockchain
区块链的构造和解释(structure-and-interpretation-of-blockchain)
Stars: ✭ 101 (+102%)
Mutual labels:  hyperledger-fabric
opensource.com
Repo to hold open source articles that I write to opensource.com(Redhat)
Stars: ✭ 20 (-60%)
Mutual labels:  hyperledger-fabric
Blockchain Application Using Fabric Java Sdk
Create and Deploy a Blockchain Network using Hyperledger Fabric SDK Java
Stars: ✭ 237 (+374%)
Mutual labels:  hyperledger-fabric
Cckit
Programming toolkit for building Hyperledger Fabric Golang on-chain (chaincode) and off-chain applications
Stars: ✭ 167 (+234%)
Mutual labels:  hyperledger-fabric
Tape
A Simple Traffic Generator for Hyperledger Fabric
Stars: ✭ 131 (+162%)
Mutual labels:  hyperledger-fabric
Fabric Starter
Starter Application and Deployment Scripts for Hyperledger Fabric
Stars: ✭ 202 (+304%)
Mutual labels:  hyperledger-fabric
Hyperledger Typescript Boilerplate
This is a boilerplate that interacts between Hyperledger Fabric Peers and a front end.
Stars: ✭ 109 (+118%)
Mutual labels:  hyperledger-fabric
Heroes Service
Short tutorial to build a blockchain application in Go with Hyperledger Fabric
Stars: ✭ 248 (+396%)
Mutual labels:  hyperledger-fabric
Todo List Fabricv1
A todo list application using Hyperledger Fabric V1 as a data source
Stars: ✭ 103 (+106%)
Mutual labels:  hyperledger-fabric
Pivt
Helm charts for running and operating Hyperledger Fabric in Kubernetes. Previously hosted at https://github.com/APGGroeiFabriek/PIVT.
Stars: ✭ 159 (+218%)
Mutual labels:  hyperledger-fabric
Blockchainnetwork Compositejourney
Part 1 in a series of patterns showing the building blocks of a Blockchain application
Stars: ✭ 217 (+334%)
Mutual labels:  hyperledger-fabric
Convector
Smart Contract Systems the easy way. Open source development framework.
Stars: ✭ 147 (+194%)
Mutual labels:  hyperledger-fabric
Blockchainbooks.github.io
Blockchain Books
Stars: ✭ 139 (+178%)
Mutual labels:  hyperledger-fabric

fabric-iot 是一个基于Hyperledger Fabric框架实现的物联网访问控制管理的区块链模拟实验平台

English

WHAT WE HAVE:
1.采用ABAC作为权限控制方法,用golang实现了chaincode.
2.编写了完整的脚本,轻松启动fabric-iot网络.
3.详细的步骤说明,浅显易懂.

0.准备工作

0.0.官网

github : hyperledger-fabric
doc 1.4 node-sdk 1.4

0.1.操作系统

OS 版本
mac os >=10.13
ubuntu 16.04

0.2.软件:

软件 版本
git >=2.0.0
docker >=19
docker-compose >=1.24
node >=12
golang >=1.10
Hyperledger Fabric =1.4.*

*请将golang、node的\bin加入PATH

*本次实验基于Fabric 1.4.3,默认下载的Fabric版本是1.4.3

*如果需要修改版本,请更改 bootstrap.sh

VERSION=1.4.3

CA_VERSION=1.4.3

0.3.下载本软件

go get github.com/newham/fabric-iot

0.4.下载并配置Hyperledger Fabric

下载源码和bin

./bootstrap.sh

export PATH

export PATH=$PATH:$(pwd)/fabric-samples/bin

*之后的诸如【启动网络、安装链码等操作需要先export PATH,这是让系统知道Hyperledger Fabric的bin目录】

*也可将其加入path中

1.目录结构

|-chaincode....................................链码目录
|--go....................................................golang编写的chaincode代码
|-client............................................交互客户端
|--nodejs..............................................nodejs编写的客户端代码
|-network........................................fabric-iot网络配置和启动脚本
|--channel-artifacts..............................channel配置文件,创世区块目录
|--compose-files...................................docker-compose文件目录
|--conn-conf.........................................链接docker网络配置目录
|--crypto-config....................................存放证书、秘钥文件目录
|--scripts...............................................cli运行脚本目录
|--ccp-generate.sh...............................生成节点证书目录配置文件脚本
|--ccp-template.json.............................配置文件json模板
|--ccp-template.yaml.............................配置文件yaml模板
|--clear-docker.sh................................清理停用docker镜像脚本
|--configtx.yaml....................................configtxgen的配置文件
|--crypto-config.yaml...........................生成证书、秘钥的配置文件
|--down.sh............................................关闭网络shell脚本
|--env.sh...............................................其他shell脚本import的公共配置
|--generate.sh......................................初始化系统配置shell脚本
|--install-cc.sh......................................安装链码shell脚本
|--rm-cc.sh...........................................删除链码shell脚本
|--up.sh................................................启动网络shell脚本

2.搭建网络 分布式版本

2.1.生成证书、配置文件等

进入目录

cd network

运行脚本

./generate.sh

证书保存在crypto-config

2.2.启动网络

./up.sh

2.3.安装链码

./cc-install.sh

*2.4.更新链码(本步骤在修改了chain code代码后再执行,[new version]要大于上一个版本)

./cc-upgrade.sh [new version]

*chaincode被保存在/chaincode/go目录中,目前只用golang实现

*2.5.关闭网络

./down.sh

*每次关闭网络会删除所有docker容器和镜像,请谨慎操作

3.与区块链交互

3.1.使用shell脚本调用链码

进入shell脚本目录

cd network

调用链码(示例代码在cc-test.sh)

# invoke
# shell|action|cc_name|cc_version|cc_src|fname|args
# add policy
./cc.sh invoke pc 1.0 go/pc AddPolicy '"{\"AS\":{\"userId\":\"13800010001\",\"role\":\"u1\",\"group\":\"g1\"},\"AO\":{\"deviceId\":\"D100010001\",\"MAC\":\"00:11:22:33:44:55\"}}"'
# query policy
./cc.sh invoke pc 1.0 go/pc QueryPolicy '"40db810e4ccb4cc1f3d5bc5803fb61e863cf05ea7fc2f63165599ef53adf5623"'

3.2.使用 Node JS 客户端调用链码

3.2.1初始化代码

进入客户端代码目录
*目前只实现了nodejs的客户端

cd client/nodejs

安装依赖

npm install

3.2.2.创建用户

创建管理员账户

node ./enrollAdmin.js

用管理员账户创建子用户

node ./registerUser.js

3.2.3.调用chaincode

node ./invoke.js [chaincode_name] [function_name] [args]


©2019 [email protected] all rights reserved.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].