I'm playing around with Hyperledger and am trying to figure to figure how to set up the server with REST api for chaincode defined here https://openblockchain.readthedocs.io/en/latest/API/CoreAPI/#rest-api
Unfortunately many of the links are dead, so I'm not sure how to set it up. I understand the query language, I just don't knopw how to begin the web server.
Does anyone have any ideas?
Hyperledger Fabric v1.0 and later does not provide a native REST API for interacting with peer and/or orderer nodes. If you have not done so, I'd advise taking a look at http://hyperledger-fabric.readthedocs.io/en/release-1.1/ to better understand the current Fabric architecture.
There is a project to provide a REST API server in front of Fabric nodes. It was not updated to support Fabric v1.1 (at least not yet) but does support Fabric v1.0 and should provide at least an example of how to add a REST API in front.
I'd also advice taking a look at the samples which are documented here as well. The fabcar sample provides a nice, simple example of how to connect a Node.js application to Fabric.
Related
Since more than one month, I am working on creating a multi Organization Hyperledger Fabric Application.
I started with Composer, used playground to test my business logic. Then deployed it to the Locally running Fabric Network and used the COMPOSER REST Server to interact with the Blockchain.
The problem started when I wanted to use my Node Application with this network. I can't get my head around participants, network cards, importing these cards, binding these cards, having a wallet for these cards, Activating these cards, enrolling them and doing all this from the NODE Application.
I want One tutorial which will help me connecting a NODE application to a Blockchain network with a Business card and explain everything in layman terms.
Bottom Line: I want to develop a node application, which will use the REST server-generated for the locally running Hyperledger Fabric using Composer. Any suggestion on End-to-End tutorials or step by step method to understand these concepts will be really appreciated.
what you need can be found here:
https://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html
it covers everything you need to create a fully fledged application using the node SDK. Make sure you follow all the resources including the Setting up your first network tutorial. The link is on that page.
The problem with composer is that it is not developed anymore by IBM:
https://lists.hyperledger.org/g/composer/message/125
as such I would not recommend you spend any more time on it.
I am working on hyper ledger composer based project. I am writing chain code using javascript.
But I do not want to use automated generated rest server APIs to submit transactions, assets etc.
Can we develop own API in the node to interact with the network?
How?
Please share any code sample or link or any description about this scenario.
This article should help to get you started, along with the Hyperledger Fabric SDK documentation.
The article referenced above was literally the third result when I Googled "hyperledger api rest server example" (and the first result on duckduckgo). Please put at least a minimal amount of effort into research before asking a question.
I'm really new to Hyperledger and blockchain. From what I understand, the whole meaning of the blockchain is to build decentralized applications, not depending on a single server.
So my question is: Is there a way to query and work with a Fabric node directly from a web browser? I believe Ethereum solves this problem with web3.js.
Thank you very much for your help.
Short Answer: No.
Web3.js communicates with Ethereum over JSON RPC and is supported by browsers.
Hyperledger Fabric, on the other hand, uses Protobuf over grpc. Currently, there is no such implementation like web3.js that can communicate directly using a browser with Hyperledger Fabric.
However Hyperledger Burrow, that provides a permissioned version of Ethereum and supports Solidity Smart Contracts does not yet support web3.js, but it is something they have in their roadmap and shall support soon.
Check this for more updates: https://wiki.hyperledger.org/projects/burrow/roadmap_2018_q1
To mimic a network for testing you can use composer-playground.mybluemix.net and to test your assets/transactions once deployed on Fabric, you can use Composer's REST API to make calls to localhost.
I'm wondering how you can get a hyperledger fabric smart contract to read from external API's ?
A service called oraclize (http://www.oraclize.it/) is used to do this operation in Ethereum blockchains - Is there anything similar for hyperledger fabric smart contracts or any workarounds?
In Hyperledger Fabric - smart contracts (the chaincode), could be implemented at the moment with either golang or Java, both of which are Turing complete and provides you with reach set of libraries and frameworks. Among which you can you any network library to get connected with external services, while you need to be extra cautious doing this to make sure your chaincode is deterministic (e.g. two independent executions of the same chaincode calling same external API will get same result back).
Riccardo from Oraclize here.
We are actually working on a Oraclize integration with Hyperledger.
I have been working on hyperledger fabric for some time. But I don’t understand where hyperledger composer comes in place . I do understand that it helps in visualizing the logic and transaction. But what I don’t get is how do you integrate it with fabric network? what does it create? Is it chaincode if not then what?
The Compose runtime is chain code that executes the business network archive artefacts created by the end-user.
Perhaps this will help?
https://blog.selman.org/2017/07/08/getting-started-with-blockchain-development/
The tech answer is that Hyperledger Composer is an abstraction layer over Hyperledger Fabric.
The practical answer is that it is awesome. Think how Angular and hundreds of other frameworks make web programming easier.
It is a framework where you can write your blockchain in Javascript and specify your data objects in an easy to understand text file. Throw in some querying, ACL stuff and pathways to use some nice opensource tools that let you do things like generate a Web API automatically and play around in a web environment without installing anything.
We are using it for the Integra Ledger Legal blockchain. (www.integraledger.com). I just spent the day working in it.