fabric-samples | Samples for Hyperledger Fabric | Blockchain library

 by   hyperledger TypeScript Version: v2.0.0-beta License: Apache-2.0

kandi X-RAY | fabric-samples Summary

kandi X-RAY | fabric-samples Summary

fabric-samples is a TypeScript library typically used in Institutions, Learning, Education, Blockchain applications. fabric-samples has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

You can use Fabric samples to get started working with Hyperledger Fabric, explore important Fabric features, and learn how to build applications that can interact with blockchain networks using the Fabric SDKs. To learn more about Hyperledger Fabric, visit the Fabric documentation.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              fabric-samples has a medium active ecosystem.
              It has 2502 star(s) with 3163 fork(s). There are 112 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 74 open issues and 70 have been closed. On average issues are closed in 36 days. There are 6 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of fabric-samples is v2.0.0-beta

            kandi-Quality Quality

              fabric-samples has 0 bugs and 0 code smells.

            kandi-Security Security

              fabric-samples has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              fabric-samples code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              fabric-samples is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              fabric-samples releases are available to install and integrate.
              Installation instructions are available. Examples and code snippets are not available.
              fabric-samples saves you 1945 person hours of effort in developing the same functionality from scratch.
              It has 4282 lines of code, 317 functions and 97 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed fabric-samples and discovered the below as its top functions. This is intended to give you an instant insight into fabric-samples implemented functionality, and help decide if they suit your requirements.
            • Main program .
            • write values to database
            • Adds a bid to the network
            • BEGIN bidder
            • recursive function to process blocks
            • Close the auction
            • End the auction for a particular auction
            • submit a ticket
            • Initialize OAuth2 client .
            • Initialize a contract client .
            Get all kandi verified functions for this library.

            fabric-samples Key Features

            No Key Features are available at this moment for fabric-samples.

            fabric-samples Examples and Code Snippets

            No Code Snippets are available at this moment for fabric-samples.

            Community Discussions

            QUESTION

            Return type of transaction?
            Asked 2022-Feb-17 at 17:49

            I'm running chaincode-java from fabric-samples.

            ...

            ANSWER

            Answered 2022-Feb-17 at 17:49

            Bit of background first; the ContractAPI that is available in Java, Go and Typescript is used to generate a 'model' of the overall contract including the data type that be passed and returned from transaction functions. (JavaScript supports a limited subset to the extent possible based on it's typing).

            In order to support this there has to be a 'serializer' of some sort to process the data. The underlying chaincode API of just 'invoke(byte[]): byte[]' gives the developer the power to serialize how they wish though not all of us need to use that power.

            There is a default 'serializer' in the ContractAPI; this can be swapped out if needed.

            To specifically answer the question;

            The return types can be:

            • strings,
            • numbers (for Java this is any of the primitive 'number' types)
            • booleans,
            • other types that have been annotated.
            • arrays of the above

            For the 'other types', there are annotations that can be used to define types that can also be passed to and from the transaction functions.

            You might see something like this:

            Source https://stackoverflow.com/questions/71157206

            QUESTION

            `peer lifecycle chaincode package`command for Node.js chainode not bundling node_modules
            Asked 2022-Jan-24 at 23:58

            Hyperledger Fabric version: 2.2.4

            Fabric Client: Fabric-Tools 2.2 Docker Image - https://hub.docker.com/layers/hyperledger/fabric-tools/2.2/images/sha256-a5f691808466e90942af3f5f72d697cdaa4e545acfc1f645a553986423ef7ea5?context=explore

            Chaincode: Fabric-samples Javascript

            Context on the issue: I am currently creating a CI/CD pipeline for the deployment of chaincode using the 2.x chaincode lifecycle. I am facing unexpected behavior with Node.js chaincode deployment whereby the node_modules I install using npm install prior to running peer lifecycle chaincode package(per the documentation) are not included in the resulting tar.gz package within code.tar.gz. Because my peer nodes are not able to access the internet to install dependencies, the missing modules result in errors when running the chaincode after installation. More specifically, I get errors related to missing modules like Fabric Shim which are defined in require() statements in the chaincode sample.

            When manually deconstructing unpacking the tar.gz structure, the code.tar.gz archive does not include node_modules that are present in the target chaincode directory that I defined the path to in the peer lifecycle chaincode package command.

            Expected Behavior: My understanding was that the new chaincode lifecycle packaging process included the dependencies in the tar.gz package before deploying and therefore there is no need to run npm install or otherwise download dependencies from externally at runtime. More specifically, based on the documentation and examples online, it seems the peer lifecycle chaincode package command would include installed dependencies from node_modules in the package for deployment.

            Is this not the default behavior of the chaincode packaging mechanism, and if not, is there a best practice for bundling dependencies on Node.js chaincode where npm install at the peer is not possible?

            TIA for any help here

            ...

            ANSWER

            Answered 2022-Jan-24 at 23:58

            The peer lifecycle chaincode package explicitly excludes the node_modules directory. Also as I assume you are currently using the inbuilt docker builder and launcher of the peer, even if you did send a package that contained the node_modules directory, it will still call npm install on it even with the presence of the node_modules directory and may end up trying to interact with an external npm registry.

            I would suggest that you look at either using a chaincode external builder and launcher, see https://hyperledger-fabric.readthedocs.io/en/release-2.2/cc_launcher.html and you could process a chaincode package that already has the node_modules included. A chaincode package is just a tar.gz file so is easy to package yourself as described in the link

            or use chaincode as a service https://hyperledger-fabric.readthedocs.io/en/release-2.2/cc_service.html which doesn't require any code to be packaged and processed by the peer.

            Source https://stackoverflow.com/questions/70805863

            QUESTION

            Can the endorsing peer see the transient data passed to its chaincode in Hyperledger Fabric?
            Asked 2022-Jan-19 at 10:33

            I am trying to pass sensitive data of clients to the chaincode function as given in the private data example of Hyperledger Fabric. The documentation recommends to pass sensitive data as --transient data field and parse the transient map in the chaincode function execution:

            ...

            ANSWER

            Answered 2022-Jan-19 at 10:33

            Yes, the endorsing peer can see transient data within a transaction proposal that it receives. Best practice is to only send proposals containing private data to peers belonging to organisations that should be able to see that private data.

            If you are using Hyperledger Fabric v2.4+ and the Fabric Gateway client APIs, this is taken care of for you. If you are using an older version of Fabric or continuing to use the legacy SDKs, you may need to explicitly specify the endorsing organisations or peers.

            Just one other clarification is that the transient data itself is not stored anywhere. If the transaction function writes that transient data to a private data collection then the written data is recorded in that private collection, stored only on peers of organisations that are members of the collection. Similarly, if the transaction function writes any of that transient data to the ledger or returns it in the transaction response, those values will be recorded on the ledger when the transaction is committed.

            Source https://stackoverflow.com/questions/70767659

            QUESTION

            specific fabric binary is not available to download (on raspberry pi)
            Asked 2021-Dec-29 at 14:58

            I am trying to set up a hyperledger fabric on raspberry pi 4. I tried many ways but I always get unable to download latest or any hyperledger fabric binaries or " platform specific fabric binary is not available to download". for example the result is like this:

            Clone hyperledger/fabric-samples repo

            ===> Cloning hyperledger/fabric-samples repo Cloning into 'fabric-samples'... remote: Enumerating objects: 9101, done. remote: Counting objects: 100% (29/29), done. remote: Compressing objects: 100% (14/14), done. remote: Total 9101 (delta 13), reused 19 (delta 11), pack-reused 9072 Receiving objects: 100% (9101/9101), 5.14 MiB | 676.00 KiB/s, done. Resolving deltas: 100% (4855/4855), done. fabric-samples v2.4.0 does not exist, defaulting to main. fabric-samples main branch is intended to work with recent versions of fabric.

            Pull Hyperledger Fabric binaries

            ===> Downloading version 2.4.0 platform specific fabric binaries ===> Downloading: https://github.com/hyperledger/fabric/releases/download/v2.4.0/hyperledger-fabric-linux-aarch64-2.4.0.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 9 100 9 0 0 22 0 --:--:-- --:--:-- --:--:-- 22

            gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now ==> There was an error downloading the binary file.

            ------> 2.4.0 platform specific fabric binary is not available to download <----

            I tried so many ways but I always ended up with a fabric-sample folder that has no bin or fabric binary. Does anyone did have the same trouble and fixed it? Please help. Thank You

            ...

            ANSWER

            Answered 2021-Dec-16 at 10:30

            The platforms for Hyperledger Fabric and available images are listed in the releases page

            We don't build for any ARM based device. Though we do know members of the community have done this; I don't know what the 'state-of-the-art' is.

            Source https://stackoverflow.com/questions/70370873

            QUESTION

            Error at HYPERLEDGER FABRIC while trying to use the chaincode for the test network but running my application
            Asked 2021-Dec-13 at 14:03

            My problem is that i get an Error while trying to use the chaincode for the test-network but running my application instead of the application-javascript provided at fabric-samples/asset-transfer-basic.

            The steps that I follow are:

            ...

            ANSWER

            Answered 2021-Nov-17 at 09:38

            You have peer discovery disabled in your code, usually, you do it when you specify peers you want to connect to but since you don't do it - the SDK client just didn't know to what peers it should connect so it connected to none of them, got 0 responses and threw an error. So I changed this line from your example:

            Source https://stackoverflow.com/questions/69902076

            QUESTION

            Chaincode deploying fails on Hyperledger Fabric
            Asked 2021-Nov-09 at 15:46

            I'm trying to run the sample test-network from the fabric-samples folder, but for some reason the chaincode installation fails, giving me an error. Here's all I get when trying to run the deployCC command:

            ...

            ANSWER

            Answered 2021-Oct-23 at 10:23

            The problem is that the test-network uses the inbuilt chaincode builder and launcher which requires access to your docker on windows setup. The error being reported is that it cannot connect to it.

            If you are using the main branch of fabric-samples then can try to set the DOCKER_SOCK environment variable before bringing up the test-network in your window shell. Take a look at https://docs.docker.com/desktop/faqs/ to see what you can set it to. Also look at the option to expose the docker daemon on an unsecure port which might help.

            The DOCKER_SOCK option was added to fabric-samples in main but doesn't appear to be in the 2.2 branch so be aware you aren't using a fabric LTS release here

            The caveat is I've not tried this so no guarantees it will work

            Unfortunately Windows is not given much attention at the moment for using fabric so the best advice I can give you at this time would be to use linux instead as your platform (you can use WSL2 but you should google installing docker into a WSL2 distro as it does require a bit of extra work)

            Source https://stackoverflow.com/questions/69686333

            QUESTION

            Running commands all at once throws error while running commands one after another is ok
            Asked 2021-Oct-20 at 09:52

            I created a chaincode and deployed it on the test network. I call the transactions from command line.

            ...

            ANSWER

            Answered 2021-Oct-20 at 09:31

            I would suggest adding --waitForEvent to each of the invoke commands otherwise you aren't waiting for the transaction to be committed to the ledger, so subsequent invokes may not see the results of previous invokes

            Source https://stackoverflow.com/questions/69643219

            QUESTION

            Why doesn't Go chaincode need annotations?
            Asked 2021-Aug-27 at 09:33

            By looking at chaincode-java and chaincode-go in https://github.com/hyperledger/fabric-samples/tree/main/asset-transfer-basic, I find the java implementation requires annotations like @Transaction and @Contract, while the Go one does not.

            As in Java, I can use @Contract(name) to change contract name, how would I do so in Go?

            If Go doesn't need @Transaction(intent), why does Java require it?

            ...

            ANSWER

            Answered 2021-Aug-27 at 09:33

            Go does not support annotations. fabric-contract-api-go turns into an accessible operation every public method that has a smart contract as receiver and uses reflection to build metadata and such kind of things (from v2.X).

            Java supports annotations. Reflection in Java works in a different way than in Go and its performance is really poor. Thus, annotations are preferred.

            Languages differ from each other in many things apart from its syntax.

            And about chaincode name, you specify your preferred name and version number when packaging your Go chaincode. It does not depend on the source code.

            Source https://stackoverflow.com/questions/68950258

            QUESTION

            Hyperledger Fabric- How do I resolve 'ProposalResponsePayloads do not match' when my smart contract is deterministic?
            Asked 2021-Jun-28 at 05:49

            I'm trying to invoke a chaincode function that sets details about a crop. This function doesn't use date/time, and is logically deterministic. I've checked that the chaincode is successfully installed for each organization of the channel and committed to the channel using peer lifecycle chaincode queryinstalled and peer lifecycle chaincode querycommitted.

            However, when I run peer chaincode invoke, it yields an error Error: could not assemble transaction: ProposalResponsePayloads do not match.

            There was a broader question that covered some common causes of error, but I'm not completely sure if any of the reasons listed are applicable in my case (Hyperledger Fabric: Error: could not assemble transaction: ProposalResponsePayloads do not match).

            This was the invoke command:

            ...

            ANSWER

            Answered 2021-Jun-28 at 05:49

            try to use only one peer to endorsement,like these:

            Source https://stackoverflow.com/questions/68143539

            QUESTION

            The Name of Hyperledger Fabric Test Network is not detected by an Application given in the fabric samples
            Asked 2021-Jun-15 at 11:31

            I just reinstalled Fabric Samples v2.2.0 from Hyperledger Fabric repository according to the documentation.

            But when I try to run asset-transfer-basic application located in fabric-samples/asset-transfer-basic/application-javascript directory by running node app.js the wallet is created and an admin and user is registered. But then it tries to invoke the function as given in app.js and shows this error

            ...

            ANSWER

            Answered 2021-Jan-29 at 04:04

            In my opinion, the CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE setting seems to be wrong.
            you can check docker-compose.yaml or core.yaml

            1. docker-compose.yaml
            • I will explain fabric-samples/test-network as targeting according to your current situation.
            • You can check in CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE in docker-compose.yaml
            • Perhaps in your case(fabric-samples/test-network), the value of ${COMPOSE_PROJECT_NAME} was not set properly, so it was set to _test.
            • Make sure the value is set correctly and change it to your network name.

            Source https://stackoverflow.com/questions/65932112

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install fabric-samples

            To use the Fabric samples, you need to download the Fabric Docker images and the Fabric CLI tools. First, make sure that you have installed all of the Fabric prerequisites. You can then follow the instructions to Install the Fabric Samples, Binaries, and Docker Images in the Fabric documentation. In addition to downloading the Fabric images and tool binaries, the Fabric samples will also be cloned to your local machine.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/hyperledger/fabric-samples.git

          • CLI

            gh repo clone hyperledger/fabric-samples

          • sshUrl

            git@github.com:hyperledger/fabric-samples.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Blockchain Libraries

            bitcoin

            by bitcoin

            go-ethereum

            by ethereum

            lerna

            by lerna

            openzeppelin-contracts

            by OpenZeppelin

            bitcoinbook

            by bitcoinbook

            Try Top Libraries by hyperledger

            fabric

            by hyperledgerGo

            sawtooth-core

            by hyperledgerPython

            blockchain-explorer

            by hyperledgerJavaScript

            besu

            by hyperledgerJava

            fabric-sdk-java

            by hyperledgerJava