All Projects → Trusted-IoT-Alliance → Iotregistry

Trusted-IoT-Alliance / Iotregistry

The IOT Registry chaincode Hyperledger Fabric 0.6. This is compatible with the Chronicled.org Open Registry

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Iotregistry

Blockchain Samples
Samples demonstrating the use of Blockchain with IBM Watson IoT
Stars: ✭ 158 (+351.43%)
Mutual labels:  blockchain, iot
Blockchain Starter Kit
The training course for better understanding the blockchain from the ground up: a project template to create as simple as possible implementation of a blockchain.
Stars: ✭ 75 (+114.29%)
Mutual labels:  blockchain, iot
Awesome Iota
A community driven list of useful IOTA blogs, articles, videos and tools.
Stars: ✭ 109 (+211.43%)
Mutual labels:  blockchain, iot
Bee
A framework for IOTA nodes, clients and applications in Rust
Stars: ✭ 176 (+402.86%)
Mutual labels:  blockchain, iot
Gun
An open source cybersecurity protocol for syncing decentralized graph data.
Stars: ✭ 15,172 (+43248.57%)
Mutual labels:  blockchain, iot
Decentralized Internet
A SDK/library for decentralized web and distributing computing projects
Stars: ✭ 406 (+1060%)
Mutual labels:  blockchain, iot
Nodejs Fullstack Book
Node.js Fullstack《從零到一的進擊》:初學者寫給初學者的全端軟體教材 by Jollen
Stars: ✭ 293 (+737.14%)
Mutual labels:  blockchain, iot
Iotex Core
Official implementation of IoTeX blockchain protocol in Go.
Stars: ✭ 505 (+1342.86%)
Mutual labels:  blockchain, iot
Tiny.scatter
Scatter compatible eos injection library
Stars: ✭ 31 (-11.43%)
Mutual labels:  blockchain
Iot
IoT, 这是一个最小Internet of Things ,一个Internet of Things相关的毕业设计产生的一个简化的物联网系统。 。
Stars: ✭ 970 (+2671.43%)
Mutual labels:  iot
React Native Aws Iot Device Shadows
React Native Component for connecting to AWS IoT Shadows from a device using SDK JavaScript bundle
Stars: ✭ 30 (-14.29%)
Mutual labels:  iot
Enigma P2p
The Enigma Worker Peer-to-Peer (P2P) package written in Node.js based on libp2p-js
Stars: ✭ 31 (-11.43%)
Mutual labels:  blockchain
Weidentity
基于区块链的符合W3C DID和Verifiable Credential规范的分布式身份解决方案
Stars: ✭ 972 (+2677.14%)
Mutual labels:  blockchain
Thingspeak
Client library for the thingspeak.com API
Stars: ✭ 30 (-14.29%)
Mutual labels:  iot
Emqx
An Open-Source, Cloud-Native, Distributed MQTT Message Broker for IoT.
Stars: ✭ 8,951 (+25474.29%)
Mutual labels:  iot
Rtos Wot
Open source FreeRTOS SDK for ESP8266 WiFi Module
Stars: ✭ 29 (-17.14%)
Mutual labels:  iot
Lethean Vpn
Lethean Virtual Private Network (VPN)
Stars: ✭ 29 (-17.14%)
Mutual labels:  blockchain
Device Os
Device OS (Firmware) for Particle Devices
Stars: ✭ 976 (+2688.57%)
Mutual labels:  iot
Arcbit Android
arcbit - Android bitcoin wallet http://arcbit.io
Stars: ✭ 34 (-2.86%)
Mutual labels:  blockchain
Blockchain Anchor
A Node.js library for anchoring data onto the Bitcoin blockchain and confirming anchored data on Bitcoin and Ethereum.
Stars: ✭ 32 (-8.57%)
Mutual labels:  blockchain

IOTRegistry

This is a chaincode or smart-contract which provides functionality for interacting with a hyperledger blockchain to store and retrieve information about internet of things devices on the blockchain. This chaincode allows for

  1. The creation of a user (called a registrant)
  2. Registration of IOT devices
  3. Registration of specifications of IOT devices.

Chaincode Overview

When this chaincode is deployed to a running Hyperledger instance, it can be used in order to interact with a blockchain. In essence, the chaincode governs the rules of how information related to Internet of Things devices can be stored on and retrieved from a hyperledger blockchain.

The chaincode is entirely contained in IOTRegistry.go. Invoke() and Query() are the central methods of the chaincode. Invoke is used to store information on the blockchain and query is used to retrieve information from the blockchain.

Storing Information on the Blockchain

Cababilities to store information on the blockchain include creating a user (called a registrant), registering an IOT device, and registering a specification of a device to the blockchain.

Invoke

Invoke is the chaincode method used to store information on the blockchain. Invoke stores information to the blockchain by completing a certain kind of transaction which culminates in a call to PutState which puts a particular state to the blockchain. Invoke receives the following parameters:

  1. A chaincode stub interface type called stub. More information on this struct can be found here: https://github.com/hyperledger/fabric/blob/master/core/chaincode/shim/chaincode.go
  2. function (string)
    This argument is used in a switch to determine which kind of transaction to perform. Valid inputs include "registerOwner", register
  3. args []string
    This is a collection of arguments marshalled into a protobuffer, which are formatted according to the kind of transaction to be performed. The input struct for each transaction is defined in IOTRegistryTX/IOTRegistry.pb.go.

Transactions

The three kinds of transactions are "createRegistrant", "registerThing", and "registerSpec".

For each kind of transaction, Invoke() does the following:

  1. Unmarshals the protobuffer into the appropriate structure
  2. Performs various checks to ensure that the input and attempted transaction are valid.
  3. Creates a store struct with the data to be put on the ledger, and
  4. Marshals that data into a protobuffer and puts the state to the ledger.

createRegistrant

In order to register IOT devices and specifications to the blockchain, a valid user (called a registrant) must first exist. createRegistrant accomplishes this.

main

createRegistrant does the following:

  1. Unmarshall arguments protobuf into createRegistrant struct type createRegistrant struct looks like this:

main 2. Check that inputs exist for name, public key, and signature. 3. Verify that the registrant to be created does not already exist 4. Create what should be the message represented by the signature input as an argument 5. Use public key and message to verify the signature 6. marshall arguments into type createRegistrantStore, which looks like this:
main

The createRegistrantStore struct holds the information that is committed to the blockchain through a call to

stub.PutState("RegistrantPubkey:"+<registrantPublicKey>, storeBytes)

In this way, the registrant information is stored on the blockchain as a byte slice, with the public key of the registrant serving as the lookup index.

registerThing

Once a registrant has been created, IOT devices can be registered to the blockchain. For this purpose, registerThing is the relevant invoke function.

For register thing, two kinds of states are put to the ledger. One kind is an "alias" state, which is put for each member of the alias string slice input to an invocation of a register thing transaction. The other kind is a "thing" state, one of which kind is put to the ledger for each valid call to invoke a register thing transaction. This allows for an owner of a thing to have multiple aliases.

registerThing stores information on the blockchain about a particular IOT device. The struct which represents the stored information on the blockchain looks like this:
main
This struct has the following elements:

  1. A list of aliases of the registrant. This list of aliases allows for multiple registrants to be associated with a single IOT device.
  2. The public key of the registrant. This can be used to look up registrant information such as name.
  3. Arbitrary data which can be used to describe the device.
  4. The name of the specification which governs the device. This is a schema which defines the formatting of the data argument.

a registerThing transaction involves the following steps:

  1. unmarshal the collection of arguments into a struct of type RegisterThingTX, which looks like this:
    main
  2. check that the arguments contain a public key, a nonce (which can be thought of as a random string of characters that serves as an identifier for the device), and a signature.
  3. Check that:
    a. the nonce does not already exist on then ledger as an identifier for an IOT device
    b. that the registrant exists on the ledger (has been created through a createRegistrant transaction), and
    c. whether any of the aliases supplied already exist as registrants on the ledger.
  4. Recreate the signed message and verify input signature with registrant public key
  5. Next, store relevant information on the ledger:
    main
    5a. Put to the blockchain an alias for each member of registerThingArgs.Aliases (alternate public keys connected to the device)
    5b. Put to the blockchain a thing with the information contained in the registerThingStoreType.

registerSpec

An IOT device can have a specification that provides information about the device. In particular, the specification defines the schema which governs the data field of the struct representing the device.

main

Registering a spec involves the following steps:

  1. unmarshall arguments into s registerSpecTX struct, which looks like this: main
  2. Verify that necessary arguments were input, that the spec does not already exist, and that the signature is valid.
  3. Marshal arguments into protobuf of type Spec, which looks like this: main

Query

Query retrieves a state from the ledger and returns data in JSON.

Signature Generation

The three signature generation functions are in IOTRegistery_test.go:
generateRegisterNameSig, generateRegisterThingSig, and generateRegisterSpecSig.

Testing

IOTRegistry_test.go is a good place to look in order to understand how interaction with this chaincode can occur.

First, bst takes the value of a new IOTRegistry type. Stub is declared, which is the primary means of interfacing with the ledger. Then, for each struct of type registryTest, a full test is run which includes registering an owner, a thing, and a spec, and performing a query for each transaction to validate the output.

Authors

Zaki Manian and Robert Nowell

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].