All Projects → hyperledger → Iroha Javascript

hyperledger / Iroha Javascript

Licence: apache-2.0
JavaScript library for Iroha, a Distributed Ledger Technology (blockchain) platform.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Iroha Javascript

Cello
Operating System for Enterprise Blockchain
Stars: ✭ 715 (+828.57%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Hyperledger
Hyperledger is a Collaborative Project at The Linux Foundation.
Stars: ✭ 3,653 (+4644.16%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric
Hyperledger Fabric is an enterprise-grade permissioned distributed ledger framework for developing solutions and applications. Its modular and versatile design satisfies a broad range of industry use cases. It offers a unique approach to consensus that enables performance at scale while preserving privacy.
Stars: ✭ 12,911 (+16667.53%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Sdk Go
Stars: ✭ 712 (+824.68%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Composer Tools
⚠️ ⚠️ ⚠️ Hyperledger Composer has been deprecated ⚠️ ⚠️ ⚠️
Stars: ✭ 75 (-2.6%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Gateway Java
Hyperledger Fabric Gateway SDK for Java https://wiki.hyperledger.org/display/fabric
Stars: ✭ 122 (+58.44%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Composer Sample Networks
⚠️ ⚠️ ⚠️ Hyperledger Composer has been deprecated ⚠️ ⚠️ ⚠️
Stars: ✭ 226 (+193.51%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Chaintool
Stars: ✭ 89 (+15.58%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Iroha
Iroha - A simple, decentralized ledger
Stars: ✭ 1,015 (+1218.18%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Blockchain Explorer
Stars: ✭ 984 (+1177.92%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Sdk Node
Hyperledger Fabric SDK for Node https://wiki.hyperledger.org/display/fabric
Stars: ✭ 676 (+777.92%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Baseimage
Stars: ✭ 53 (-31.17%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Composer Sample Applications
⚠️ ⚠️ ⚠️ Hyperledger Composer has been deprecated ⚠️ ⚠️ ⚠️
Stars: ✭ 110 (+42.86%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Composer
⚠️ ⚠️ ⚠️ Hyperledger Composer has been deprecated ⚠️ ⚠️ ⚠️
Stars: ✭ 1,676 (+2076.62%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Iroha Android
Android library for Iroha, a Distributed Ledger Technology (blockchain) platform.
Stars: ✭ 108 (+40.26%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Iroha
Iroha - A simple, enterprise-grade decentralized ledger
Stars: ✭ 210 (+172.73%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Iroha Ios
iOS Swift library for Iroha, a simple distributed ledger
Stars: ✭ 81 (+5.19%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Sdk Py
Hyperledger Fabric Python SDK
Stars: ✭ 303 (+293.51%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Ca
Stars: ✭ 331 (+329.87%)
Mutual labels:  blockchain, hyperledger, distributed-ledger
Fabric Sdk Java
Stars: ✭ 982 (+1175.32%)
Mutual labels:  blockchain, hyperledger, distributed-ledger

npm version minified size Iroha 1.2.0-rc.1

iroha-helpers

Some functions which will help you to interact with Hyperledger Iroha from your JS program.

Trying an example

  1. Clone this repository
  2. Run Iroha http://iroha.readthedocs.io/en/latest/getting_started/
  3. Run grpc-web-proxy for iroha https://gitlab.com/snippets/1713665
  4. yarn build && npx ts-node example/index.ts

Installation

Using npm:

$ npm i iroha-helpers

Using yarn:

$ yarn add iroha-helpers

Example

In a example directory you can find index.ts and chain.ts files. These files demonstrain main features of iroha-helpers. In the chain.ts you can find how to build transaction with several commands and how to deal with batch.

Node.js

With node.js you should to create connection to iroha by using QueryService and CommandService from endpoint_grpc_pb. Also you should provide grpc credentials as a second argument.

IROHA_ADDRESS - Address of iroha grpc (usually ends on 50051) Ex. http://localhost:50051

import grpc from 'grpc'
import {
  QueryService_v1Client as QueryService,
  CommandService_v1Client as CommandService
} from 'iroha-helpers/lib/proto/endpoint_grpc_pb'

const commandService = new CommandService(
  IROHA_ADDRESS,
  grpc.credentials.createInsecure()
)

Browser

With browser you should to create connection to iroha by usinb QueryService and CommandService from endpoint_pb_service.

IROHA_ADDRESS - Address of grpc-web-proxy (usually ends on 8081) Ex. http://localhost:8081

import {
  CommandService_v1Client as CommandService,
  QueryService_v1Client as QueryService
} from 'iroha-helpers/lib/proto/endpoint_pb_service'

const commandService = new CommandService(IROHA_ADDRESS)
const queryService = new QueryService(IROHA_ADDRESS)

Create transaction

To create transaction you can call command from list of commands or create your own from scratch or use transaction builder.

import { TxBuilder } from 'iroha-helpers/lib/chain'

new TxBuilder()
  .createAccount({
    accountName: 'user1',
    domainId: 'test',
    publicKey: '0000000000000000000000000000000000000000000000000000000000000000'
  })
  .addMeta('[email protected]', 1)
  .send(commandService)
  .then(res => console.log(res))
  .catch(err => console.error(res))

Create batch

import { TxBuilder, BatchBuilder } from 'iroha-helpers/lib/chain'

const firstTx = new TxBuilder()
  .createAccount({
    accountName: 'user1',
    domainId: 'test',
    publicKey: '0000000000000000000000000000000000000000000000000000000000000000'
  })
  .addMeta('[email protected]', 1)
  .tx

const secondTx = new TxBuilder()
  .createAccount({
    accountName: 'user2',
    domainId: 'test',
    publicKey: '0000000000000000000000000000000000000000000000000000000000000000'
  })
  .addMeta('[email protected]', 1)
  .tx

new BatchBuilder([
  firstTx,
  secondTx
])
  .setBatchMeta(0)
  .sign([adminPriv], 0)
  .sign([adminPriv], 1)
  .send(commandService)
  .then(res => console.log(res))
  .catch(err => console.error(err))

Commands

For usage of any command you need to provide commandOptions as a first argument.

const commandOptions = {
  privateKeys: [''], // Array of private keys in hex format
  creatorAccountId: '', // Account id, ex. [email protected]
  quorum: 1,
  commandService: null,
  timeoutLimit: 5000 // Set timeout limit
}

Queries

For usage of any query you need to provide queryOptions as a first argument.

const queryOptions = {
  privateKey: '', // Private key in hex format
  creatorAccountId: '', // Account id, ex. [email protected]
  queryService: null,
  timeoutLimit: 5000 // Set timeout limit
}

Known issues

  • Please be careful: API might and WILL change.

TODO

  • [ ] Add tests
  • [ ] Integration tests with Iroha
  • [ ] Add more documentation
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].