问题
does same functionality can be achieved by writing chaincode with javascript in hyperledger composer as writing chaincode with go in Hyperledger fabric?
and What are the limitations and benefits of writing chaincode in JS as compared to writing in go ?
回答1:
On question 2: this article can explain as a side-by-side comparison (Golang (Go) and Composer model-driven approach) -> https://blog.selman.org/2017/07/08/getting-started-with-blockchain-development/. The main difference is Hyperledger Composer is a set of abstractions, tools and APIs to model, build, integrate and deploy a blockchain solution (eg a business network for parties to transact on) to the blockchain network. Composer business network archives may be deployed to Hyperledger Fabric for execution as smart contracts (that's including the modeled network, transaction logic written in Javascript, ACLs, queries etc).
回答2:
The short answer to your first question is that, since the recent Composer update that exposes getNativeAPI
, it should be possible to achieve the same results whether you use JavaScript Composer transaction processor functions, or Hyperledger go chaincode. This currently requires installing the @next stream of Composer, and you can find more in the Transaction Processor Functions reference or the Invoking a Hyperledger Composer business network from another business network tutorial.
I'll avoid getting in to the relative merits of JavaScript vs Go but Composer provides much more to improve the developer experience, from a more business focussed domain specific modelling language, to tools to generate REST services and Angular UIs.
来源:https://stackoverflow.com/questions/48977403/chaincode-in-hyperledger-composer-vs-chaincode-in-hyperleger-fabric