Giter VIP home page Giter VIP logo

marbles's Introduction

*Read this in other languages: **, 한국어, 日本, português

Marbles Demo

About Marbles

  • The underlying network for this application is the Hyperledger Fabric, a Linux Foundation project. You may want to review these instructions to understand a bit about the Hyperledger Fabric.

  • This demo is to aid a developer learn the basics of chaincode and app development with a Fabric network.

  • This is a very simple asset transfer demonstration. Multiple users can create and transfer marbles with each other.

Versions

There are multiple versions of marbles. This version is compatible with Hyperledger Fabric v1.1x. You can find the other marble versions by checking out other branches.


Application Background

Hold on to your hats everyone, this application is going to demonstrate transferring marbles between many marble owners leveraging Hyperledger Fabric. We are going to do this in Node.js and a bit of GoLang. The backend of this application will be the GoLang code running in our blockchain network. From here on out the GoLang code will be referred to as 'chaincode' or 'cc'. The chaincode itself will create a marble by storing it to the chaincode state. The chaincode itself can store data as a string in a key/value pair setup. Thus, we will stringify JSON objects to store more complex structures.

Attributes of a marble:

  1. id (unique string, will be used as key)
  2. color (string, css color names)
  3. size (int, size in mm)
  4. owner (string)

We are going to create a UI that can set these values and store them in our blockchain's ledger. The marble is really a key value pair. The key is the marble id, and the value is a JSON string containing the attributes of the marble (listed above). Interacting with the cc is done by using the gRPC protocol to a peer on the network. The details of the gRPC protocol are taken care of by an SDK called Hyperledger Fabric Client SDK. Check the picture below for topology details.

Application Communication Flow

  1. The admin will interact with Marbles, our Node.js application, in their browser.
  2. This client side JS code will open a websocket to the backend Node.js application. The client JS will send messages to the backend when the admin interacts with the site.
  3. Reading or writing the ledger is known as a proposal. This proposal is built by Marbles (via the SDK) and then sent to a blockchain peer.
  4. The peer will communicate to its Marbles chaincode container. The chaincode will run/simulate the transaction. If there are no issues it will endorse the transaction and send it back to our Marbles application.
  5. Marbles (via the SDK) will then send the endorsed proposal to the ordering service. The orderer will package many proposals from the whole network into a block. Then it will broadcast the new block to peers in the network.
  6. Finally the peer will validate the block and write it to its ledger. The transaction has now taken effect and any subsequent reads will reflect this change.

Marbles Setup

Before you tackle the various instructions below decide what type of setup you really want. It is possible to skip the developer setup and get Marbles running with 2-3 brainless clicks. If you want a developer's setup, follow the instructions 0 - 4 below. By the end of it you will be a hyperledger fabric pro, and have the setup to develop an application of your own design. If you want to skip all of that and simply try marbles on a IBP (IBM Blockchain Platform) network then follow the Toolchain setup flow. If you really want to impress your friends, do both.

If you already used the Toolchain setup then skip down to the Use Marbles section. If you are choosing the dev setup, then keep reading. The good news is marbles and the blockchain network can be setup for different configurations depending on your preference. The bad news is this makes the instructions complicated. If you are new to Hyperledger Fabric and want the simplest setup then follow the 🍭 emoji. Whenever there are options and you must choose your own adventure, I'll drop a 🍭 emoji on the option that is the simplest. This is the option for you.

0. Setup Local Environment

Follow these environment setup instructions to install Git, Go and Node.js.

  • When you have finished come back to this tutorial. Start the next section "Download Marbles" below.

1. Download Marbles

We need to download marbles to your local system. Let’s do this with Git by cloning this repository. You will need to do this step even if you plan on hosting marbles in IBM Cloud.

  • Open a command prompt/terminal and browse to your desired working directory

  • Run the following command:

     git clone https://github.com/IBM-Blockchain/marbles.git --depth 1
     cd marbles
    
  • Great I'll meet you at step 2.

2. Get a Network

Hello again. Now we need a blockchain network.

Choose 1 option below:

  • Option 1: Create a network with the IBM Cloud IBM Blockchain Service - instructions
  • Option 2: 🍭 Use a locally hosted Hyperledger Fabric Network - instructions

3. Install and Instantiate Chaincode

OK, almost there! Now we need to get our marbles chaincode running. Remember the chaincode is a vital component that ultimately creates our marbles transactions on the ledger. It is GoLang code that needs to be installed on our peer, and then instantiated on a channel. The code is already written for you! We just need to get it running. There are two ways to do this.

Choose the only option that is relevant for your setup:

  • Option 1: Install and instantiate chaincode with your IBM Blockchain Service - instructions
  • Option 2: 🍭 Install and instantiate chaincode with the SDK locally - instructions

4. Host Marbles

Last but not least we need marbles running somewhere.

Choose 1 option below:


Use Marbles

  1. If you are at this step, you should have your environment setup, blockchain network created, marbles app and chaincode running. Right? If not look up for help (up the page, not literally upwards).

  2. Open up your favorite browser and browse to http://localhost:3001 or your IBM Cloud www route.

    • If the site does not load, check your node console logs for the hostname/ip and port marbles is using.
  3. Finally we can test the application. Click the "+" icon on one of your users in the "United Marbles" section

  4. Fill out all the fields, then click the "CREATE" button

  5. After a few seconds your new marble should have appeared.

    • If not refresh the page by hitting the refresh button in your browser
  6. Next let’s trade a marble. Drag and drop a marble from one owner to another. Only trade it to owners within "United Marbles" if you have multiple marble companies. It should temporary disappear and then redraw the marble within its new owner. That means it worked!

    • If not refresh the page
  7. Now let’s delete a marble by dragging and dropping it into the trash can. It should disappear after a few seconds.

  8. Refresh the page to double check that your actions "stuck".

  9. Use the search box to filter on marble owners or marble company names. This is helpful when there are many companies/owners.

    • The pin icon will prevent that user from being filtered out by the search box.
  10. Now let's turn on the special walkthrough. Click the "Settings" button near the top of the page.

    • A dialog box will open.
    • Click the "Enabled" button to enabled Story Mode
    • Click the "x" in the top right to close the menu.
    • Now pick another marble and drag it to another user. You should see a breakdown of the transaction process. Hopefully it gives you a better idea of how Fabric works.
    • Remember you can disable story mode when it becomes frustratingly repetitive and you are a cold husk of your former self.
  11. Congratulations you have a working marbles application :)!

Blockchain Background

Before we talk about how Marbles works let’s discuss the flow and topology of Hyperledger Fabric. Let's get some definitions out of the way first.

Definitions:

Peer - A peer is a member of the blockchain and is running Hyperledger Fabric. From marble's context, the peers are owned and operated by my marble company.

CA - The CA (Certificate Authority) is responsible for gatekeeping our blockchain network. It will provide transaction certificates for clients such as our marbles node.js application.

Orderer - An orderer or ordering service is a member of the blockchain network whose main responsibility is to package transactions into blocks.

Users - A user is an entity that is authorized to interact with the blockchain. In the Marbles context, this is our admin. The user can query and write to the ledger.

Blocks - Blocks contain transactions and a hash to verify integrity.

Transactions or Proposals - These represent interactions to the blockchain ledger. A read or write request of the ledger is sent as a transaction/proposal.

Ledger - This is the storage for the blockchain on a peer. It contains the actual block data which consist of transaction parameters and key value pairs. It is written by chaincode.

Chaincode - Chaincode is Hyperledger Fabric speak for smart contracts. It defines the assets and all rules about assets.

Assets - An asset is an entity that exists in the ledger. It’s a key value pair. In the context of marbles this is a marble, or a marble owner.

Let’s look at the operations involved when creating a new marble.

  1. The first thing that happens in marbles is registering our admin user with our network's CA. If successful, the CA will send Marbles enrollment certificates that the SDK will store for us in our local file system.
  2. When the admin creates a new marble from the user interface the SDK will create an invocation transaction.
  3. The create marble transaction gets built as a proposal to invoke the chaincode function init_marble().
  4. Marbles (via the SDK) will send this proposal to a peer for endorsement.
  5. The peer will simulate the transaction by running the Go function init_marble() and record any changes it attempted to write to the ledger.
  6. If the function returns successfully the peer will endorse the proposal and send it back to Marbles. Errors will also be sent back, but the proposal will not be endorsed.
  7. Marbles (via the SDK), will then send the endorsed proposal to the orderer.
  8. The orderer will organize a sequence of proposals from the whole network. It will check the sequence of transactions is valid by looking for transactions that conflict with each other. Any transactions that cannot be added to the block because of conflicts will be marked as errors. The orderer will broadcast the new block to the peers of the network.
  9. Our peer will receive the new block and validate it by looking at various signatures and hashes. It is then finally committed to the peer's ledger.
  10. At this point the new marble exists in our ledger and should soon exist in all peer's ledgers.

SDK Deeper Dive

Now let's see how we interface with the Fabric Client SDK. Almost all of the configuration options can be found in our "connection profile" (aka cp). Your connection profile might be coming from a file such as/config/connection_profile_tls.json, or it might be from an environmental variable. If you are unsure which, check the logs when marbles starts. You will either see Loaded connection profile from an environmental variable or Loaded connection profile file <some name here>. The cp is JSON and it has the hostname (or ip) and port of various components of our blockchain network. The connection_profile_lib found in the ./utils folder, has functions to retrieve data for the SDK.

Configure SDK:

First action is to enroll the admin. Look at the following code snippet on enrollment. There are comments/instructions below the code.

//enroll admin
enrollment.enroll = function (options, cb) {
// [Step 1]
    var client = new FabricClient();
    var channel = client.newChannel(options.channel_id);
    logger.info('[fcw] Going to enroll for mspId ', options);

// [Step 2]
    // Make eCert kvs (Key Value Store)
    FabricClient.newDefaultKeyValueStore({
        path: path.join(os.homedir(), '.hfc-key-store/' + options.uuid) //store eCert in the kvs directory
    }).then(function (store) {
        client.setStateStore(store);

// [Step 3]
        return getSubmitter(client, options);              //do most of the work here
    }).then(function (submitter) {

// [Step 4]
        channel.addOrderer(new Orderer(options.orderer_url, options.orderer_tls_opts));

// [Step 5]
        channel.addPeer(new Peer(options.peer_urls[0], options.peer_tls_opts));
        logger.debug('added peer', options.peer_urls[0]);

// [Step 6]
        // --- Success --- //
        logger.debug('[fcw] Successfully got enrollment ' + options.uuid);
        if (cb) cb(null, { channel: channel, submitter: submitter });
        return;

    }).catch(

        // --- Failure --- //
        function (err) {
            logger.error('[fcw] Failed to get enrollment ' + options.uuid, err.stack ? err.stack : err);
            var formatted = common.format_error_msg(err);
            if (cb) cb(formatted);
            return;
        }
    );
};

Step 1. The first thing the code does is create an instance of our SDK.

Step 2. Next we create a key value store to store the enrollment certificates with newDefaultKeyValueStore

Step 3. Next we enroll our admin. This is when we authenticate to the CA with our enroll ID and enroll secret. The CA will issue enrollment certificates which the SDK will store in the key value store. Since we are using the default key value store, it will be stored in our local file system.

Step 4. After successful enrollment we set the orderer URL. The orderer is not needed yet, but will be when we try to invoke chaincode. - The business with ssl-target-name-override is only needed if you have self signed certificates. Set this field equal to the common name you used to create the PEM file.

Step 5. Next we set the Peer URLs. These are also not needed yet, but we are going to set up our SDK chain object fully.

Step 6. At this point the SDK is fully configured and ready to interact with the blockchain.

Code Structure

This application has 3 coding environments to juggle.

  1. The Chaincode Part - This is GoLang code that runs on/with a peer on your blockchain network. Also, called cc. All marbles/blockchain transactions ultimately happen here. These files live in /chaincode.
  2. The Client Side JS Part - This is JavaScript code running in the user's browser. User interface interaction happens here. These files live in /public/js.
  3. The Server Side JS Part - This is JavaScript code running our application's backend. ie Node.js code which is the heart of Marbles! Sometimes referred to as our node or server code. Functions as the glue between the marble admin and our blockchain. These files live in /utils and /routes.

Remember these 3 parts are isolated from each other. They do not share variables nor functions. They will communicate via a networking protocol such as gRPC, WebSockets, or HTTP.

Marbles Deeper Dive

Hopefully you have successfully traded a marble or two between users. Let’s look at how transferring a marble is done by starting at the chaincode.

/chaincode/marbles.go

    type Marble struct {
        ObjectType string        `json:"docType"`
        Id       string          `json:"id"`
        Color      string        `json:"color"`
        Size       int           `json:"size"`
        Owner      OwnerRelation `json:"owner"`
    }

/chaincode/write_ledger.go

    func set_owner(stub shim.ChaincodeStubInterface, args []string) pb.Response {
        var err error
        fmt.Println("starting set_owner")

        // this is quirky
        // todo - get the "company that authed the transfer" from the certificate instead of an argument
        // should be possible since we can now add attributes to the enrollment cert
        // as is.. this is a bit broken (security wise), but it's much much easier to demo! holding off for demos sake

        if len(args) != 3 {
            return shim.Error("Incorrect number of arguments. Expecting 3")
        }

        // input sanitation
        err = sanitize_arguments(args)
        if err != nil {
            return shim.Error(err.Error())
        }

        var marble_id = args[0]
        var new_owner_id = args[1]
        var authed_by_company = args[2]
        fmt.Println(marble_id + "->" + new_owner_id + " - |" + authed_by_company)

        // check if user already exists
        owner, err := get_owner(stub, new_owner_id)
        if err != nil {
            return shim.Error("This owner does not exist - " + new_owner_id)
        }

        // get marble's current state
        marbleAsBytes, err := stub.GetState(marble_id)
        if err != nil {
            return shim.Error("Failed to get marble")
        }
        res := Marble{}
        json.Unmarshal(marbleAsBytes, &res)           //un stringify it aka JSON.parse()

        // check authorizing company
        if res.Owner.Company != authed_by_company{
            return shim.Error("The company '" + authed_by_company + "' cannot authorize transfers for '" + res.Owner.Company + "'.")
        }

        // transfer the marble
        res.Owner.Id = new_owner_id                   //change the owner
        res.Owner.Username = owner.Username
        res.Owner.Company = owner.Company
        jsonAsBytes, _ := json.Marshal(res)           //convert to array of bytes
        err = stub.PutState(args[0], jsonAsBytes)     //rewrite the marble with id as key
        if err != nil {
            return shim.Error(err.Error())
        }

        fmt.Println("- end set owner")
        return shim.Success(nil)
    }

This set_owner() function will change the owner of a particular marble. It takes in an array of strings input argument and returns nil if successful. Within the array the first index should have the id of the marble which is also the key in the key/value pair. We first need to retrieve the current marble struct by using this id. This is done with stub.GetState(marble_id) and then unmarshal it into a marble structure with json.Unmarshal(marbleAsBytes, &res). From there we can index into the structure with res.Owner.Id and overwrite the marble's owner with the new owners Id. Next we Marshal the structure back up so that we can use stub.PutState() to overwrite the marble with its new attributes.

Let’s take 1 step up and look at how this chaincode was called from our node.js app.

/utils/websocket_server_side.js

    //process web socket messages
    ws_server.process_msg = function (ws, data) {
        const channel = cp.getChannelId();
        const first_peer = cp.getFirstPeerName(channel);
        var options = {
            peer_urls: [cp.getPeersUrl(first_peer)],
            ws: ws,
            endorsed_hook: endorse_hook,
            ordered_hook: orderer_hook
        };
        if (marbles_lib === null) {
            logger.error('marbles lib is null...');             //can't run in this state
            return;
        }

        // create a new marble
        if (data.type == 'create') {
            logger.info('[ws] create marbles req');
            options.args = {
                color: data.color,
                size: data.size,
                marble_owner: data.username,
                owners_company: data.company,
                owner_id: data.owner_id,
                auth_company: process.env.marble_company,
            };

            marbles_lib.create_a_marble(options, function (err, resp) {
                if (err != null) send_err(err, data);
                else options.ws.send(JSON.stringify({ msg: 'tx_step', state: 'finished' }));
            });
        }

        // transfer a marble
        else if (data.type == 'transfer_marble') {
            logger.info('[ws] transferring req');
            options.args = {
                marble_id: data.id,
                owner_id: data.owner_id,
                auth_company: process.env.marble_company
            };

            marbles_lib.set_marble_owner(options, function (err, resp) {
                if (err != null) send_err(err, data);
                else options.ws.send(JSON.stringify({ msg: 'tx_step', state: 'finished' }));
            });
        }
        ...

This snippet of process_msg() receives all websocket messages (code found in app.js). It will detect what type of ws (websocket) message was sent. In our case, it should detect a transfer_marble type. Looking at that code we can see it will setup an options variable and then kick off marbles_lib.set_marble_owner(). This is the function that will tell the SDK to build the proposal and process the transfer action.

Next let’s look at that function.

/utils/marbles_cc_lib.js

    //-------------------------------------------------------------------
    // Set Marble Owner
    //-------------------------------------------------------------------
    marbles_chaincode.set_marble_owner = function (options, cb) {
        console.log('');
        logger.info('Setting marble owner...');

        var opts = {
            peer_urls: g_options.peer_urls,
            peer_tls_opts: g_options.peer_tls_opts,
            channel_id: g_options.channel_id,
            chaincode_id: g_options.chaincode_id,
            chaincode_version: g_options.chaincode_version,
            event_urls: g_options.event_urls,
            endorsed_hook: options.endorsed_hook,
            ordered_hook: options.ordered_hook,
            cc_function: 'set_owner',
            cc_args: [
                options.args.marble_id,
                options.args.owner_id,
                options.args.auth_company
            ],
        };
        fcw.invoke_chaincode(enrollObj, opts, cb);
    };
        ...

The the set_marble_owner() function is listed above. The important parts are that it is setting the proposal's invocation function name to "set_owner" with the line fcn: 'set_owner'. Note that the peer and orderer URLs have already been set when we enrolled the admin. By default the SDK will send this transaction to all peers that have been added with channel.addPeer. In our case the SDK will send to only 1 peer, since we have only added the 1 peer. Remember this peer was added in the enrollment section.

Now let’s look 1 more step up to how we sent this websocket message from the UI.

/public/js/ui_building.js

    $('.innerMarbleWrap').droppable({drop:
        function( event, ui ) {
            var marble_id = $(ui.draggable).attr('id');

            //  ------------ Delete Marble ------------ //
            if($(event.target).attr('id') === 'trashbin'){
                // [removed code for brevity]
            }

            //  ------------ Transfer Marble ------------ //
            else{
                var dragged_owner_id = $(ui.draggable).attr('owner_id');
                var dropped_owner_id = $(event.target).parents('.marblesWrap').attr('owner_id');

                console.log('dropped a marble', dragged_owner_id, dropped_owner_id);
                if (dragged_owner_id != dropped_owner_id) {
                $(ui.draggable).addClass('invalid bounce');
                    transfer_marble(marble_id, dropped_owner_id);
                    return true;
                }
            }
        }
    });

    ...

    function transfer_marble(marbleName, to_username, to_company){
        show_tx_step({ state: 'building_proposal' }, function () {
            var obj = {
                type: 'transfer_marble',
                id: marbleId,
                owner_id: to_owner_id,
                v: 1
            };
            console.log(wsTxt + ' sending transfer marble msg', obj);
            ws.send(JSON.stringify(obj));
            refreshHomePanel();
        });
    }

In the first section referencing $('.innerMarbleWrap') you can see we used jQuery and jQuery-UI to implement the drag and drop functionality. With this code we get a droppable event trigger. Much of the code is spent parsing for the details of the marble that was dropped and the user it was dropped into.

When the event fires we first check to see if this marble actually moved owners, or if it was just picked up and dropped back down. If its owner has changed we go off to the transfer_marble() function. This function creates a JSON message with all the needed data and uses our websocket to send it with ws.send().

The last piece of the puzzle is how Marbles realize the transfer is complete. Well, marbles will periodically check on all the marbles and compares it to the last known state. If there is a difference it will broadcast the new marble state to all connected JS clients. The clients will receive this websocket message and redraw the marbles.

Now you know the whole flow. The admin moved the marble, JS detected the drag/drop, client sends a websocket message, marbles receives the websocket message, sdk builds/sends a proposal, peer endorses the proposal, sdk sends the proposal for ordering, the orderer orders and sends a block to peer, our peer commits the block, marbles node code gets new marble status periodically, sends marble websocket message to client, and finally the client redraws the marble in its new home.

That’s it! Hope you had fun transferring marbles.

Marbles FAQs

Do you have questions about why something in marbles is the way it is? Or how to do something? Check out the FAQ .

Feedback

I'm very interested in your feedback. This is a demo built for people like you, and it will continue to be shaped for people like you. On a scale of no-anesthetic-root-canal to basket of puppies, how was it? If you have any ideas on how to improve the demo/tutorial, please reach out! Specifically:

  • Did the format of the readme work well for you?
  • At which points did you get lost?
  • Is something broken!?
  • Did your knowledge grow by the end of the tutorial?
  • Was something particularly painful?
  • Did it make you have an existential crisis and you are suddenly unsure of what it means to be, you?

Use the GitHub Issues section to communicate any improvements/bugs and pain points!

Contribute

If you want to help improve the demo check out the contributing guide

License

Apache 2.0


marbles's People

Contributors

anishman avatar balakrishna513 avatar benjsmi avatar dhyey-ibm avatar dhyey20 avatar dshuffma-ibm avatar g8rengr avatar ichaobuster avatar jmarca avatar joequant avatar lat94 avatar lnrego avatar macinjoke avatar mastersingh24 avatar mcr222 avatar miku2000 avatar mrshah-at-ibm avatar rantwijk avatar rmohta avatar ronaldpetty avatar seanbarclay avatar some-ibmer avatar szbra avatar teora avatar wwalisa avatar yamachan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

marbles's Issues

How to host marbles locally?

I run npm install and gulp marbles1. And open web browser with url http://localhost:3001/. In the browser, login with admin. The console side outputs many errors:

error: Error: Calling enrollment endpoint failed with error [Error: connect ECONNREFUSED 127.0.0.1:7054]
    at ClientRequest.<anonymous> (/home/allen/gopath/src/github.com/hyperledger/marbles/node_modules/fabric-ca-client/lib/FabricCAClientImpl.js:568:12)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1278:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
error: [fcw] Failed to get enrollment marbles-marbles-ibm-mychannel-fabric-peer-1a Error: Failed to obtain an enrolled user
    at ca_client.enroll.then.then.then.catch (/home/allen/gopath/src/github.com/hyperledger/marbles/utils/fc_wrangler/enrollment.js:131:12)
    at process._tickCallback (internal/process/next_tick.js:103:7)
error: [fcw] could not format error
error: could not enroll...

Run docker ps -a, I can not find any containers running. Does marbles need start docker-compose blockchain network first before running gulp marbles1? And how to host marbles locally? And most of most, does marbles support the latest fabric 1.0.0 release? Please give us some instructions.

Delete functionality

The blockchain being an append only ledger, doesn't the delete functionality go against the principles of a blockchain?

Query Failure

I deployed marbles in localhost, everything run fine until some of time.
When I wake up this morning, and tried to run marbles again, I got this error:

read  - success: { jsonrpc: '2.0',
  error:
   { code: -32003,
     message: 'Query failure',
     data: 'Error when querying chaincode: Error:Failed to launch chaincode spec(Timeout expired while starting chaincode 14b711be6f0d00
b190ea26ca48c22234d93996b6e625a4b108a7bbbde064edf0179527f30df238d61b66246fe1908005caa5204dd73488269c8999276719ca8b(networkid:dev,peerid:
c9527fe1-2332-48aa-8e6f-797d0689c52e_vp1,tx:f77a672d-b239-498b-9e54-803ebeccfca5))' },
  id: 1466646199791 }
marbles index msg error: [SyntaxError: Unexpected token u]

All marbles did I create also dissapear and I can't create new marble.
Any idea what happened?

Sample application deployment tracking: repository URL is missing

Hello!

It appears that the application is using the Sample application deployment tracking library cf-deployment-tracker-client(https://github.com/IBM-Blockchain/marbles/blob/master/app.js#L108) but doesn't specify a value for the repository property in package.json. Without this property no traceback information to your github repository is recorded. Please consider adding the following to package.json

    ...
    "dependencies": {
        ...   
       "cf-deployment-tracker-client": "*"
    },
    ...
   "repository": {
     "type": "git",
     "url": "https://github.com/IBM-Blockchain/marbles.git"
   }

as shown in this example: https://github.com/IBM-Bluemix/node-helloworld/blob/master/package.json#L9-18

missing network manual configuration

Hi,

Setup Options:
So the cc is great and all but first we need a blockchain network. Choose 1 option below:

(1) Deploy the app on my local machine and create a network manually

OR

(2) Deploy the app and network at once on Bluemix. Simply click this button Deploy to Bluemix then continue hereptions:
So the cc is great and all but first we need a blockchain network. Choose 1 option below:

(1) Deploy the app on my local machine and create a network manually

OR

(2) Deploy the app and network at once on Bluemix. Simply click this button Deploy to Bluemix then continue here

manually link is broken: "https://github.com/IBM-Blockchain/marbles/blob/master/tutorial_part1.md#Network"
and so so network manual configuration is missing.

thanks.

Chaincode loading from repo

Any particular reason that the server loads the chaincode from another repo?
Wouldn't it be easier if you can have the chaincode file in the same directory as your app.js and loading from there?
Saves the hassle of pushing every small change to your chaincode.

No net address for eth1

I'm following the tutorial for setting up environment and network in my own laptop.My VP are setup and I'm able to query and invoke transactions on them. In the steps for "Marbles Adjust for local network" , in the step 6 it says to change the setup.js and figure out the address the Vagrant virtual machine offers to the local machine. When I run ifconfig there is no eth1 - net addr (as shown in screenshot. )
screen shot 2016-07-03 at 11 23 27 pm

While setting up the Vagrant environment, I used Wi-Fi adapter to bridge connection between vagrant and local machine

deploy resp error - there is no chaincode hash name in response: { jsonrpc: '2.0', error: { code: -32001, message: 'Deployment failure',

Hi, I am getting the below error when trying to deploy the marbles application on local vagrant environment. It was working fine before and I have n't modified any thing specifically except that IP addresses when I connect to different network.


[ibc-js] Deploy Chaincode - Starting
[ibc-js] function: init , arg: [ '99' ]

 Waiting...


 deploy resp error - there is no chaincode hash name in response: { jsonrpc: '2.0',

error:
{ code: -32001,
message: 'Deployment failure',
data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long' },
id: 1470050652578 }
! looks like a deploy error, holding off on the starting the socket
{ name: 'deploy() error no cc name',
code: 502,
details:
{ jsonrpc: '2.0',
error:
{ code: -32001,
message: 'Deployment failure',
data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long' },
id: 1470050652578 } }


Please let me know what could be the reason for this issue and if any possible solution.

read property '0' undefined

Hi I am little bit confused about the marble tutorial

npm install
gulp

its done here locally on osx yosemite with the blockchain hyperledger api connectivity
the mycreds_bluemix.json is correctly filled with credentials and users (user_type1_0 plus the secret)

I am experiencing this nodejs error and I can understand why.

TypeError: Cannot read property '0' of undefined
at Object. (/.../marbles.v2/app.js:218:20)

node -v
v7.2.1

npm -v
4.1.1

looking at the line mentioned in code snippet: peers: [peers[0]],

thanks

watch-sass error after building marbles app offline

I'm trying to build the marbles app offline and connect it to a Bluemix blockchain.

after changing mycreds.json to appropriate values, installing dependencies I get this error:

[15:01:41] Using gulpfile ~/SchoolCode/capstone/marbles/gulpfile.js
[15:01:41] Starting 'build-sass'...
[15:01:41] Finished 'build-sass' after 16 ms
[15:01:41] Starting 'watch-sass'...
[15:01:41] 'watch-sass' errored after 9.2 ms
[15:01:41] Error: watch /home/andreibuiza/SchoolCode/capstone/marbles/scss/ ENOSPC
    at exports._errnoException (util.js:1026:11)
    at FSWatcher.start (fs.js:1429:19)
    at Object.fs.watch (fs.js:1456:11)
    at Gaze._watchDir (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/gaze.js:289:30)
    at /home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/gaze.js:358:10
    at iterate (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/helper.js:52:5)
    at Object.forEachSeries (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/helper.js:66:3)
    at Gaze._initWatched (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/gaze.js:354:10)
    at Gaze.add (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/gaze.js:177:8)
    at new Gaze (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/gaze.js:74:10)
    at gaze (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gaze/lib/gaze.js:86:10)
    at Object.module.exports [as watch] (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/glob-watcher/index.js:12:17)
    at Gulp.watch (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/gulp/index.js:35:16)
    at Gulp.<anonymous> (/home/andreibuiza/SchoolCode/capstone/marbles/gulpfile.js:42:7)
    at module.exports (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/home/andreibuiza/SchoolCode/capstone/marbles/node_modules/orchestrator/index.js:273:3)

Anyone have a clue to solve this ?

Query error on new deployment from local

Getting the following error
When I call this function on new deployment,

chaincode.query.read(['_marbleindex']

error: { name: 'query() error',
code: 400,
details: '{"Error": "Error:Failed to launch chaincode spec(Error starting container: API error (500): Error: image library/dev-3939016b-d70c-4a46-b754-dcc10d9ceb87_vp1-c29ff1807036492ec8602bb935cee8cc7cb6a45eba307aa642bed12ceceb9dc997e54edd6584936e3976b54125f94a931527494284360aa88bd9ea051aab2da1 not found\n)"}' }

Error loading the chaincode or network

------------------------------------------ Server Up - localhost:3000 ------------------------------------------
Running using Developer settings

  • Tracking Deployment
    loading hardcoded peers
    loading hardcoded users
    [ibc-js] Peer: vp0-vp0...:7050
    [ibc-js] Registering vp0-vp0...:7050 w/enrollId - bob
    [ibc-js] Register - failure x1 : bob 401
    [ibc-js] going to try to register again in 30 secs
    [ibc-js] Registering vp0-vp0...:7050 w/enrollId - bob
    [ibc-js] Register - failure x2 : bob 401
    ! looks like an error loading the chaincode or network, app will fail
    { name: 'register() error',
    code: 401,
    details: { Error: 'rpc error: code = 2 desc = Identity or token does not match.' } }

{
"credentials": {
"peers": [{
"api_host": "localhost",
"api_port": 7050,
"type": "peer",
"id": "vp0"
}],
"users": [{
"enrollId": "bob",
"enrollSecret": "NOE63pEQbL25"
}],
"cert": "https://blockchain-certs.mybluemix.net/us.blockchain.ibm.com.cert"
}
}

Also I get

Error creating connection to peer address 172.20.0.7:7051: grpc: timed out when dialing
in console when I run "docker-compose -f four-peer-ca.yaml up"

[ibc-js] deploy - failure: 500 ! looks like a deploy error, holding off on the starting the socket.......many thanks for help

Hello sir......my environment is running Nodejs app on local and use Blockchain on Bluemix. I encounter an error in bellow when Nodejs app try to deploy chaincode....Please give some help, many thanks!

Running using Developer settings

  • Tracking Deployment
    loading hardcoded peers
    loading hardcoded users
    [ibc-js] Peer: vp0-e09125f8-45d...:30303
    [ibc-js] No membership users found after filtering, assuming this is a network w/o membership
    [ibc-js] removing temp dir
    [ibc-js] Downloading zip
    redirect... https://codeload.github.com/IBM-Blockchain/marbles-chaincode/zip/master
    [ibc-js] Downloading zip
    [ibc-js] Unzipping zip
    [ibc-js] Unzip done
    [ibc-js] Scanning files [ 'part2_chaincode.go' ]
    [ibc-js] Parsing file for shim version
    [ibc-js] Found shim version: github.com/hyperledger/fabric/core/chaincode/shim
    [ibc-js] Parsing file for invoke functions - part2_chaincode.go
    [ibc-js] Found cc invoke function: init
    [ibc-js] Found cc invoke function: delete
    [ibc-js] Found cc invoke function: write
    [ibc-js] Found cc invoke function: init_marble
    [ibc-js] Found cc invoke function: set_user
    [ibc-js] Found cc invoke function: open_trade
    [ibc-js] Found cc invoke function: perform_trade
    [ibc-js] Found cc invoke function: remove_trade
    [ibc-js] Parsing file for query functions - part2_chaincode.go
    [ibc-js] Found cc query function: read
    [ibc-js] load_chaincode() finished
    [ibc-js] Deploy Chaincode - Starting
    [ibc-js] function: init , arg: [ '99' ]

     Waiting...
    

    [ibc-js] deploy - failure: 500
    ! looks like a deploy error, holding off on the starting the socket
    { name: 'deploy() error',
    code: 500,
    details:
    { Error: socket hang up
    at createHangUpError (_http_client.js:252:15)
    at TLSSocket.socketOnEnd (_http_client.js:344:23)
    at emitNone (events.js:91:20)
    at TLSSocket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:975:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)

    at process._tickCallback (internal/process/next_tick.js:98:9) code: 'ECONNRESET' } }

    It seems problem happen in user register....."No membership users found after filtering, assuming this is a network w/o membership". I modified mycreds.json by the user listed in Service Credentials page on Bluemix. Bellow is my mycreds.json

    {
    "credentials": {
    "peers": [
    {
    "discovery_host": "e09125f8-45df-4cce-96b5-8ce57858f622_vp0.us.blockchain.ibm.com",
    "discovery_port": 30303,
    "api_host": "e09125f8-45df-4cce-96b5-8ce57858f622_vp0.us.blockchain.ibm.com",
    "api_port_tls": 30303,
    "api_port": 443,
    "type": "peer",
    "network_id": "e09125f8-45df-4cce-96b5-8ce57858f622",
    "container_id": "ea18a428f5133461b99edcfbb4c59d2da6cce006ddcb252a4faf496b2fa13e06",
    "id": "e09125f8-45df-4cce-96b5-8ce57858f622_vp0",
    "api_url": "http://e09125f8-45df-4cce-96b5-8ce57858f622_vp0.us.blockchain.ibm.com:433"
    }
    ],
    "ca": {
    "e09125f8-45df-4cce-96b5-8ce57858f622_ca": {
    "url": "e09125f8-45df-4cce-96b5-8ce57858f622_ca.us.blockchain.ibm.com:30303",
    "discovery_host": "e09125f8-45df-4cce-96b5-8ce57858f622_ca.us.blockchain.ibm.com",
    "discovery_port": 30303,
    "api_host": "e09125f8-45df-4cce-96b5-8ce57858f622_ca.us.blockchain.ibm.com",
    "api_port_tls": 30303,
    "api_port": 433,
    "type": "ca",
    "network_id": "e09125f8-45df-4cce-96b5-8ce57858f622",
    "container_id": "3a17bd002c297e375190462377aa503a17cd2c9a53e13514f161e09bbad0772e"
    }
    },
    "users": [
    {
    "username": "user_type8_3b11bb4a7e",
    "secret": "2ae4ecee2f",
    "enrollId": "user_type8_3b11bb4a7e",
    "enrollSecret": "2ae4ecee2f"
    }
    ],
    "cert": "https://blockchain-certs.mybluemix.net/us.blockchain.ibm.com.cert"
    }

    }

    I had tried another user but still have other error. It look register error.

    Running using Developer settings

  • Tracking Deployment
    loading hardcoded peers
    loading hardcoded users
    [ibc-js] Peer: vp0-e09125f8-45d...:30303
    [ibc-js] Registering vp0-e09125f8-45d...:30303 w/enrollId - user_type1_270373e350
    [ibc-js] Register - failure x1 : user_type1_270373e350 500
    [ibc-js] going to try to register again in 30 secs
    [ibc-js] Registering vp0-e09125f8-45d...:30303 w/enrollId - user_type1_270373e350
    [ibc-js] Register - failure x2 : user_type1_270373e350 500
    ! looks like an error loading the chaincode or network, app will fail
    { name: 'register() error',
    code: 500,
    details:
    { Error: socket hang up
    at createHangUpError (_http_client.js:252:15)
    at TLSSocket.socketOnEnd (_http_client.js:344:23)
    at emitNone (events.js:91:20)
    at TLSSocket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:975:12)

    But I can register this user by APIs page on Bluemix. It is strange.

Many thanks for advise!

error deploying chaincode at node startup - chaincode took too long

on a local single node setup, I get this error:

	 deploy resp error - there is no chaincode hash name in response: { jsonrpc: '2.0',
  error:
   { code: -32001,
     message: 'Deployment failure',
     data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long' },
  id: 1484720495587 }
! looks like a deploy error, holding off on the starting the socket
 { name: 'deploy() error no cc name',
  code: 502,
  details:
   { jsonrpc: '2.0',
     error:
      { code: -32001,
        message: 'Deployment failure',
        data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long' },
     id: 1484720495587 } }

Viewing transaction history

How can I view the entire life cycle of the marble since its inception?
For e.g. when created, Bob was the owner, then it was traded for 2 white marbles at block number 12 with Leroy

running locally- error - configure of 'mycreds.json'?

I'm trying to run the marbles example locally- but I ran into this error:

12121j2kkkmm123

12121j2kkkmm1234

kkmm123

I guess maybe it has something to do with my mycreds.json file, because that was the only part of the tutorial I didn't fully grasp.

In the docs this is given as an example:

{
"credentials": {
"peers": [
{
"api_host": "12345678-abcde-_vp0.blockchain.ibm.com", //hostname or ip of peer
"api_port_tls": 443, //https port (optional)
"api_port": 80, //http port
"id": "12345678-abcde-4d6f-_vp0", //unique id of peer
},
],
"users": [
{
"enrollId": "user_type1_1234567890", //enroll username
"enrollSecret": "1234567890" //enroll's secret
}
]
}
}

but I don't really understand how that relates to my system or what I need to change exactly.

{
  "credentials": {
    "peers": [
      {
        "discovery_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp0.blockchain.ibm.com",
        "discovery_port": 30304,
        "api_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp0.blockchain.ibm.com",
        "api_port_tls": 30443,
        "api_port": 30443,
        "type": "peer",
        "network_id": "8aa42d25-c620-4d6f-872e-90545ce399d4",
        "container_id": "82b2cbfd17c5495296cc048edf7d5a7d50032d2e8191e4603626231da648a01c",
        "id": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp0",
        "api_url": "http://8aa42d25-c620-4d6f-872e-90545ce399d4_vp0.blockchain.ibm.com:30443"
      },
      {
        "discovery_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp1.blockchain.ibm.com",
        "discovery_port": 30304,
        "api_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp1.blockchain.ibm.com",
        "api_port_tls": 30443,
        "api_port": 30443,
        "type": "peer",
        "network_id": "8aa42d25-c620-4d6f-872e-90545ce399d4",
        "container_id": "d1e19c515263370793044fb0b64d4a049c4c033c161522782296a635c840ef69",
        "id": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp1",
        "api_url": "http://8aa42d25-c620-4d6f-872e-90545ce399d4_vp1.blockchain.ibm.com:30443"
      },
      {
        "discovery_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp3.blockchain.ibm.com",
        "discovery_port": 30304,
        "api_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp3.blockchain.ibm.com",
        "api_port_tls": 30443,
        "api_port": 30443,
        "type": "peer",
        "network_id": "8aa42d25-c620-4d6f-872e-90545ce399d4",
        "container_id": "bd69aef23dd06381d0cc64b68e834ff4dbb59de311bf4a97b10a606d6f0d68a8",
        "id": "8aa42d25-c620-4d6f-872e-90545ce399d4_vp3",
        "api_url": "http://8aa42d25-c620-4d6f-872e-90545ce399d4_vp3.blockchain.ibm.com:30443"
      }
    ],
    "ca": {
      "8aa42d25-c620-4d6f-872e-90545ce399d4_ca": {
        "url": "8aa42d25-c620-4d6f-872e-90545ce399d4_ca.blockchain.ibm.com:30304",
        "discovery_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_ca.blockchain.ibm.com",
        "discovery_port": 30304,
        "api_host": "8aa42d25-c620-4d6f-872e-90545ce399d4_ca.blockchain.ibm.com",
        "api_port_tls": 30304,
        "api_port": 30443,
        "type": "ca",
        "network_id": "8aa42d25-c620-4d6f-872e-90545ce399d4",
        "container_id": "da818d4c027963635671a81f96c99a17cfa92d052449ef07d40db1419b4a077d"
      }
    },
    "users": [
      {
        "username": "admin",
        "secret": "dfc2dd1fe7",
        "enrollId": "admin",
        "enrollSecret": "dfc2dd1fe7"
      },
      {
        "username": "WebAppAdmin",
        "secret": "00cac86b46",
        "enrollId": "WebAppAdmin",
        "enrollSecret": "00cac86b46"
      },
      {
        "username": "dashboarduser_type1_de9e08c8e7",
        "secret": "d356d1801e",
        "enrollId": "dashboarduser_type1_de9e08c8e7",
        "enrollSecret": "d356d1801e"
      },
      {
        "username": "dashboarduser_type1_733b81ccfb",
        "secret": "d1359b3bb9",
        "enrollId": "dashboarduser_type1_733b81ccfb",
        "enrollSecret": "d1359b3bb9"
      },
      {
        "username": "dashboarduser_type1_4a9f59b3dc",
        "secret": "46863c70da",
        "enrollId": "dashboarduser_type1_4a9f59b3dc",
        "enrollSecret": "46863c70da"
      },
      {
        "username": "dashboarduser_type1_f5387afa3b",
        "secret": "0df4cbc984",
        "enrollId": "dashboarduser_type1_f5387afa3b",
        "enrollSecret": "0df4cbc984"
      },
      {
        "username": "user_type1_c711dabdbe",
        "secret": "d0903ab61d",
        "enrollId": "user_type1_c711dabdbe",
        "enrollSecret": "d0903ab61d"
      },
      {
        "username": "user_type1_14824e9f6d",
        "secret": "1473f80c51",
        "enrollId": "user_type1_14824e9f6d",
        "enrollSecret": "1473f80c51"
      },
      {
        "username": "user_type1_6586bcd182",
        "secret": "e853fa6073",
        "enrollId": "user_type1_6586bcd182",
        "enrollSecret": "e853fa6073"
      },
      {
        "username": "user_type1_07799d5465",
        "secret": "24ee24ca15",
        "enrollId": "user_type1_07799d5465",
        "enrollSecret": "24ee24ca15"
      },
      {
        "username": "user_type1_4c682e8a20",
        "secret": "6880c1e88c",
        "enrollId": "user_type1_4c682e8a20",
        "enrollSecret": "6880c1e88c"
      },
      {
        "username": "user_type2_b5bbab6465",
        "secret": "df62eb3bb8",
        "enrollId": "user_type2_b5bbab6465",
        "enrollSecret": "df62eb3bb8"
      },
      {
        "username": "user_type2_187a4aabfb",
        "secret": "f8af825a13",
        "enrollId": "user_type2_187a4aabfb",
        "enrollSecret": "f8af825a13"
      },
      {
        "username": "user_type2_9f757a0ea7",
        "secret": "2b63039ac9",
        "enrollId": "user_type2_9f757a0ea7",
        "enrollSecret": "2b63039ac9"
      },
      {
        "username": "user_type2_7f91f93fa5",
        "secret": "e607419b15",
        "enrollId": "user_type2_7f91f93fa5",
        "enrollSecret": "e607419b15"
      },
      {
        "username": "user_type2_24b8b22ac6",
        "secret": "6894ea9800",
        "enrollId": "user_type2_24b8b22ac6",
        "enrollSecret": "6894ea9800"
      },
      {
        "username": "user_type4_0289fe29cf",
        "secret": "7251384b2b",
        "enrollId": "user_type4_0289fe29cf",
        "enrollSecret": "7251384b2b"
      },
      {
        "username": "user_type4_2049ded2b4",
        "secret": "b8a51ab655",
        "enrollId": "user_type4_2049ded2b4",
        "enrollSecret": "b8a51ab655"
      },
      {
        "username": "user_type4_cec61f8db5",
        "secret": "b23f764bb3",
        "enrollId": "user_type4_cec61f8db5",
        "enrollSecret": "b23f764bb3"
      },
      {
        "username": "user_type4_1c39d64696",
        "secret": "c74e91332b",
        "enrollId": "user_type4_1c39d64696",
        "enrollSecret": "c74e91332b"
      },
      {
        "username": "user_type4_565ca41b4b",
        "secret": "8a278015b8",
        "enrollId": "user_type4_565ca41b4b",
        "enrollSecret": "8a278015b8"
      },
      {
        "username": "user_type8_8e704c3bcb",
        "secret": "c74eb98482",
        "enrollId": "user_type8_8e704c3bcb",
        "enrollSecret": "c74eb98482"
      },
      {
        "username": "user_type8_ef8c228d33",
        "secret": "e3cbee199d",
        "enrollId": "user_type8_ef8c228d33",
        "enrollSecret": "e3cbee199d"
      },
      {
        "username": "user_type8_2a3d9753fe",
        "secret": "86f50dc81f",
        "enrollId": "user_type8_2a3d9753fe",
        "enrollSecret": "86f50dc81f"
      },
      {
        "username": "user_type8_743bc5dfcf",
        "secret": "7458320203",
        "enrollId": "user_type8_743bc5dfcf",
        "enrollSecret": "7458320203"
      },
      {
        "username": "user_type8_bd45a365d9",
        "secret": "ebd96b87b0",
        "enrollId": "user_type8_bd45a365d9",
        "enrollSecret": "ebd96b87b0"
      }
    ]
  }
}

[ibc-js] Register - failure after IBM update

Hey,
I was running the marbles demo inside of bluemix for the last few days and everything worked perfectly fine. Today IBM released a new version (see here) of its blockchain-service. And suddenly my Application stopped working. It fails to register the users somehow, although the users that are tried are valid users (they are all visible at API -> Network's Enroll IDs and passwords are correct, too).

I would really appreciate some help!
Best regards

EDIT: There seems to be a problem with the Blockchain service itself..so probably this ticket is at the wrong place. I'll wait for IBM to fix their issue and then close this ticket if the error is gone.

Here is what the app log says:

App/0
------------------------------------------ Server Up - 0.0.0.0:61078 ------------------------------------------
2016-07-15T15:07:23.010+0200
App/0
Running using Developer settings
2016-07-15T15:07:23.010+0200
App/0

  • Tracking Deployment
    2016-07-15T15:07:23.010+0200
    App/0
    loading hardcoded users
    2016-07-15T15:07:23.197+0200
    App/0
    [!] looks like you are in bluemix, I am going to clear out the deploy_name so that it deploys new cc.
    2016-07-15T15:07:23.197+0200
    App/0
    overwritting users, loading from a vcap service: ibm-blockchain-5-prod
    2016-07-15T15:07:23.197+0200
    App/0
    loading hardcoded peers
    2016-07-15T15:07:23.197+0200
    App/0
    overwritting peers, loading from a vcap service: ibm-blockchain-5-prod
    2016-07-15T15:07:23.197+0200
    App/0
    [!] hope that is ok budddy
    2016-07-15T15:07:23.197+0200
    App/0
    [ibc-js] Peer: vp0-6cbde53e-afe...:30443
    2016-07-15T15:07:23.200+0200
    App/0
    [ibc-js] Peer: vp1-6cbde53e-afe...:30443
    2016-07-15T15:07:23.203+0200
    App/0
    [ibc-js] Peer: vp2-6cbde53e-afe...:30443
    2016-07-15T15:07:23.203+0200
    App/0
    [ibc-js] Peer: vp3-6cbde53e-afe...:30443
    2016-07-15T15:07:23.203+0200
    App/0
    [ibc-js] Registering vp0-6cbde53e-afe...:30443 w/enrollID - user_type1_eb92dc0802
    2016-07-15T15:07:23.204+0200
    App/0
    [ibc-js] Registering vp3-6cbde53e-afe...:30443 w/enrollID - user_type1_c501966b65
    2016-07-15T15:07:23.212+0200
    App/0
    [ibc-js] Registering vp1-6cbde53e-afe...:30443 w/enrollID - user_type1_61e36d90b2
    2016-07-15T15:07:23.216+0200
    App/0
    [ibc-js] Registering vp2-6cbde53e-afe...:30443 w/enrollID - user_type1_1cb6af04b6
    2016-07-15T15:07:23.217+0200
    App/0
    [ibc-js] going to try to register again in 30 secs
    2016-07-15T15:07:23.447+0200
    App/0
    [ibc-js] Register - failure x1 : user_type1_eb92dc0802 500
    2016-07-15T15:07:23.447+0200
    App/0
    [ibc-js] Register - failure x1 : user_type1_1cb6af04b6 500
    2016-07-15T15:07:23.451+0200
    App/0
    [ibc-js] going to try to register again in 30 secs
    2016-07-15T15:07:23.451+0200
    App/0
    [ibc-js] going to try to register again in 30 secs
    2016-07-15T15:07:23.452+0200
    App/0
    [ibc-js] Register - failure x1 : user_type1_61e36d90b2 500
    2016-07-15T15:07:23.452+0200
    App/0
    [ibc-js] Register - failure x1 : user_type1_c501966b65 500
    2016-07-15T15:07:23.457+0200
    App/0
    [ibc-js] going to try to register again in 30 secs
    2016-07-15T15:07:23.457+0200
    App/0
    Uploaded stats { ok: true }
    2016-07-15T15:07:24.020+0200
    RTR/0
    trade-finance-test.eu-gb.mybluemix.net - [15/07/2016:13:07:24.587 +0000] "GET / HTTP/1.1" 101 0 0 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0" 159.122.215.10:18086 x_forwarded_for:"195.212.29.168, 159.122.215.10" x_forwarded_proto:"http" vcap_request_id:d6168395-8d9a-4d4a-5be1-edd03380b0e8 response_time:0.003958422 app_id:f4346050-bd7d-4271-a42b-0bb5f181c8dc x_global_transaction_id:"418089773"
    2016-07-15T15:07:24.592+0200
    App/0
    [ibc-js] Registering vp0-6cbde53e-afe...:30443 w/enrollID - user_type1_eb92dc0802
    2016-07-15T15:07:53.477+0200
    App/0
    [ibc-js] Registering vp2-6cbde53e-afe...:30443 w/enrollID - user_type1_1cb6af04b6
    2016-07-15T15:07:53.480+0200
    App/0
    [ibc-js] Registering vp1-6cbde53e-afe...:30443 w/enrollID - user_type1_61e36d90b2
    2016-07-15T15:07:53.481+0200
    App/0
    [ibc-js] Registering vp3-6cbde53e-afe...:30443 w/enrollID - user_type1_c501966b65
    2016-07-15T15:07:53.483+0200
    App/0
    [ibc-js] Register - failure x2 : user_type1_eb92dc0802 500
    2016-07-15T15:07:53.705+0200
    App/0
    { name: 'register() error',
    2016-07-15T15:07:53.708+0200
    App/0
    code: 500,
    2016-07-15T15:07:53.708+0200
    App/0
    details: { [Error: socket hang up] code: 'ECONNRESET' } }
    2016-07-15T15:07:53.708+0200
    App/0
    ! looks like an error loading the chaincode or network, app will fail
    2016-07-15T15:07:53.708+0200
    App/0
    [ibc-js] Register - failure x2 : user_type1_61e36d90b2 500
    2016-07-15T15:07:53.709+0200
    App/0
    [ibc-js] Register - failure x2 : user_type1_1cb6af04b6 500
    2016-07-15T15:07:53.709+0200
    App/0
    [ibc-js] Register - failure x2 : user_type1_c501966b65 500
    2016-07-15T15:07:53.714+0200

Running on debian system

If you want to run locally on the Debian-type OS's, you must also install the package nodejs-legacy in order to sucessfully perform npm install. It would be great if you added this to the installation/setup notes :)

Using Marbles demo with IBM Blockchain Local with hardcoded enrollId/Secret

Hello,

Can someone help replace enrollId/Seceret with hardcoded ones from Dockerized IBM Hyperledger from docker hub please?

I am trying to use marbles demo in local machine, first it was connected to HSBN/Bluemix okay. When I tried to use local version of hyperledger( https://hub.docker.com/r/ibmblockchain/ ) - it seems it has a problem using enrollId/Secret as local version's hardcoded id/key (changed in mycred.json) is different format - I see the document said it should contain 'type_1' in the enrollId. Can following key be used with minimal modification? this is from ver0.6 membersvc.yaml...

            test_user0: 1 MS9qrN8hFjlE bank_a
            test_user1: 1 jGlNl6ImkuDo institution_a
            test_user2: 1 zMflqOKezFiA bank_c
            test_user3: 1 vWdLCE00vJy0 bank_a
            test_user4: 1 4nXSrfoYGFCP institution_a
            test_user5: 1 yg5DVhm0er1z bank_b
            test_user6: 1 b7pmSxzKNFiw bank_a
            test_user7: 1 YsWZD4qQmYxo institution_a
            test_user8: 1 W8G0usrU7jRk bank_a
	test_user9: 1 H80SiB5ODKKQ institution_a

Marbles demo for v0.6 fabric ?

Hello, is there marbles demo available for version 0.6.1 of the fabric?

I tried to use it with IBM provided docker-compose fabric(v0.6.1) and getting following error...it seems it requires good amount of app code changes and was curious if anyone had updates yet.

Thanks,

loading hardcoded users
[ibc-js] Peer: vp0-vp0...:1443
[ibc-js] Registering vp0-vp0...:1443 w/enrollId - test_user1
[ibc-js] Registration success x1 : test_user1
[ibc-js] removing temp dir
[ibc-js] Downloading zip
redirect... https://codeload.github.com/IBM-Blockchain/marbles-chaincode/zip/master
[ibc-js] Downloading zip
[ibc-js] Unzipping zip
[ibc-js] Unzip done
[ibc-js] Scanning files [ 'part2_chaincode.go' ]
[ibc-js] Parsing file for shim version
[ibc-js] Found shim version: github.com/hyperledger/fabric/core/chaincode/shim
[ibc-js] Parsing file for invoke functions - part2_chaincode.go
[ibc-js] Found cc invoke function: init
[ibc-js] Found cc invoke function: delete
[ibc-js] Found cc invoke function: write
[ibc-js] Found cc invoke function: init_marble
[ibc-js] Found cc invoke function: set_user
[ibc-js] Found cc invoke function: open_trade
[ibc-js] Found cc invoke function: perform_trade
[ibc-js] Found cc invoke function: remove_trade
[ibc-js] Parsing file for query functions - part2_chaincode.go
[ibc-js] Found cc query function: read
[ibc-js] load_chaincode() finished
[ibc-js] Deploy Chaincode - Starting
[ibc-js] function: init , arg: [ '99' ]

     Waiting...


     deploy resp error - there is no chaincode hash name in response: { jsonrpc: '2.0',

error:
{ code: -32001,
message: 'Deployment failure',
data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"\n# github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2\n/opt/gopath/usercode/556595698/src/github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2/part2_chaincode.go:67: cannot use new(SimpleChaincode) (type SimpleChaincode) as type shim.Chaincode in argument to shim.Start:\n\tSimpleChaincode does not implement shim.Chaincode (wrong type for Init method)\n\t\thave Init(*shim.ChaincodeStub, string, []string) ([]byte, error)\n\t\twant Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)\n' },
id: 1478501361330 }
! looks like a deploy error, holding off on the starting the socket
{ name: 'deploy() error no cc name',
code: 502,
details:
{ jsonrpc: '2.0',
error:
{ code: -32001,
message: 'Deployment failure',
data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"\n# github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2\n/opt/gopath/usercode/556595698/src/github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2/part2_chaincode.go:67: cannot use new(SimpleChaincode) (type SimpleChaincode) as type shim.Chaincode in argument to shim.Start:\n\tSimpleChaincode does not implement shim.Chaincode (wrong type for Init method)\n\t\thave Init(*shim.ChaincodeStub, string, []string) ([]byte, error)\n\t\twant Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)\n' },
id: 1478501361330 }
peers:<ID:<name:"vp0" > address:"172.19.0.2:7051" type:VALIDATOR >
vp0_1 | 06:49:31.274 [devops] getChaincodeBytes -> ERRO 140 Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit
vp0_1 | # github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2
vp0_1 | /opt/gopath/usercode/556595698/src/github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2/part2_chaincode.go:67: cannot use new(SimpleCode) as type shim.Chaincode in argument to shim.Start:
vp0_1 | *SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
vp0_1 | have Init(*shim.ChaincodeStub, string, []string) ([]byte, error)
vp0_1 | want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)
vp0_1 | 06:49:31.274 [devops] Deploy -> ERRO 141 Error deploying chaincode spec: type:GOLANG chaincodeID:<path:"https://github.com/ibm-blockchain/marble" > ctorMsg:<args:"init" args:"99" > secureContext:"test_user1"
vp0_1 |
vp0_1 | error: Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"
vp0_1 | # github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2
vp0_1 | /opt/gopath/usercode/556595698/src/github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2/part2_chaincode.go:67: cannot use new(SimpleCode) as type shim.Chaincode in argument to shim.Start:
vp0_1 | *SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
vp0_1 | have Init(*shim.ChaincodeStub, string, []string) ([]byte, error)
vp0_1 | want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)
vp0_1 | 06:49:31.274 [rest] processChaincodeDeploy -> ERRO 142 Error when deploying chaincode: Error getting chaincode package bytes: Error getting code"exit status 2"
vp0_1 | # github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2
vp0_1 | /opt/gopath/usercode/556595698/src/github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2/part2_chaincode.go:67: cannot use new(SimpleCode) as type shim.Chaincode in argument to shim.Start:
vp0_1 | *SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)
vp0_1 | have Init(shim.ChaincodeStub, string, []string) ([]byte, error)
vp0_1 | want Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)
vp0_1 | 06:49:31.274 [rest] ProcessChaincode -> INFO 143 REST successfully deploy chaincode: {"jsonrpc":"2.0","error":{"code":-32001,"message":"Deploymen deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: "exit status 2"\n# github.com/ibm-blockchain/marbt2\n/opt/gopath/usercode/556595698/src/github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2/part2_chaincode.go:67: cannot use new(SimpleChaincode) (t shim.Chaincode in argument to shim.Start:\n\t
SimpleChaincode does not implement shim.Chaincode (wrong type for Init method)\n\t\thave Init(*shim.ChaincodeStuberror)\n\t\twant Init(shim.ChaincodeStubInterface, string, []string) ([]byte, error)\n"},"id":1478501361330}
vp1_1 | 06:49:33.324 [peer] ensureConnected -> DEBU 0c4 Touch service indicates no dropped connections

No route, failed deploy

Hello,

Have tried deploying to bluemix through the "deploy" button on git as well as within my blockchain network on bluemix.

When deployed, I receive the following error upon opening the application:

{ "jsonrpc": "2.0", "error": { "code": -32001, "message": "Deployment failure", "data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: 'exit status 1'\n# cd .; git clone https://github.com/ibm-blockchain/marbles-chaincode /go/usercode/435367883/src/github.com/ibm-blockchain/marbles-chaincode\nCloning into '/go/usercode/435367883/src/github.com/ibm-blockchain/marbles-chaincode'...\nfatal: unable to access 'https://github.com/ibm-blockchain/marbles-chaincode/': Failed to connect to github.com port 443: No route to host\npackage github.com/ibm-blockchain/marbles-chaincode/hyperledger/part2: exit status 128\n" }, "id": 1475514717593 }

Have I failed to do something rudimentary?

Thanks!

Always failing to Register user with gulp

[ibc-js] Registering  eedd070b694947d382a9aace7bb52783-vp2-eedd070b6949...:5004  w/enrollId - user_type1_0
Register - failure x1 : user_type1_0 401
! looks like an error loading the chaincode or network, app will fail
 { name: 'register() error',
  code: 401,
  details: { Error: 'rpc error: code = 2 desc = Identity or token does not match.' } }

Refactor to use hfc

as fabric v0.7+ no longer has REST apis, so we should use hfc package instead of ibm-blockchain-js

fs.access error

When I start node app.js, I receive the following error. How can I fix this?

    fs.access(unzip_cc_dest, cb_file_exists);                                       //check if files exist ye
       ^

TypeError: Object # has no method 'access'
at cb_ready (/root/marbles/node_modules/ibm-blockchain-js/index.js:181:6)
at /root/marbles/node_modules/ibm-blockchain-js/lib/helper.js:44:4
at Object.oncomplete (fs.js:107:15)

Proposed changes to marbles demo documentation.

Here's a few changes I'd suggest to the getting started demo documentation. To be clear, the path I followed was running marbles app on my local system using a blockchain network in bluemix.

  1. Suggestion: Keep as much "informational" stuff out of the initial instructions as possible. Too much information causes people to get confused IMO. Not sure if they need to care about
    certain things or if they are extra.

For example, get rid of the whole "chaincode" part of these instructions. If they want to learn chaincode, they can do it via the link. If they don't want to yet, this will just confuse them, especially with code snippets since they'll likely think they need to do these. Flow should be context flows then setup options.

  1. All Screenshots and instructions need to be updated to match new UI. I captured a few of these.

  2. In the instructions where you have "Keep creds at the default value" - There's only one but it's not selected. You don't need to do anything here. I'd clarify that.

  3. In the instructions where you tell the user to rename network to "my blockchain". Can be renamed from bluemix dashboard. Need to tell people how to get back and rename. I wouldn't assume they know bluemix.

  4. In the doc where you tell user to "Copy the value of the whole JSON object to the mycreds.json file in the root of this project". You haven't told them to clone the project yet at this point. I'd either have them copy this off and save it locally somewhere "You'll use these credentials later" or more likely refer them back to how to get this information when they actually get to the point of editing the file after cloning the project.

  5. Where you tell them this "Next we need to install our dependencies. Open a command prompt/terminal and browse to the root of this project." Give them the exact directory name.

  6. For this:

npm install gulp -g
npm install

I see some warnings. Need to tell them how to check if it worked or not or at least let them know about the warnings and what's OK vs what isn't.

  1. I'd have multiple sets of instructions for editing the JSON file..basically the section you have where you tell them "if your usecase is this, you need to edit the JSON file". Expand each one of those to show exactly what they need to do for each usecase. Part of the confusion I think comes from the fact that the instructions jump around between the different usecases.

  2. VCAP, define this and make it clear it's an environment variable everytime it's referenced and where it will be set and where it won't.

Gulp error

Hi,
I am trying to setup marbles with my bluemix. I have deployed the app directly to bluemix and now following the instructions. But I'm getting a "Unhandled error event" in 'events.js' line 141, error on gulp command. Can anyone please explain what I might be doing wrong.
screen shot 2016-06-15 at 11 44 31 am

chaincode directory

I run takes marvels chaincode local download, it did not find the directory connection ...

Under inde part of the js code, I'd like to run the js chaincode local, download the code in relation to the local server time-consuming just to be running on the local server.

How can I change non-zip and unzip and local chaincode call in the following?

        zip_url: 'https://github.com/ibm-blockchain/marbles-chaincode/archive/master.zip', 
        unzip_dir: 'marbles-chaincode-master / part2_v1.0.0', 
        git_url: 'https://github.com /ibm-blockchain/marbles-chaincode/part2_v1.0.0 '

Error on redeploy

I've modified chaincode go code and I would like to redeploy to apply changes.

I'm deploying to bluemix

The problem is that I'm receiving the following error

  hfc $GOPATH: blockchain/app +0ms
  hfc projDir: blockchain/app/src/chaincode +0ms
  hfc GenerateParameterHash... +0ms
  hfc path: chaincode +1ms
  hfc func: init +0ms
  hfc args: a,100,b,200 +0ms
  hfc str: chaincodeinita100b200 +0ms
  hfc strHash: 9917933edde33368e8725555a00183d9d4d3d3eb8231270f96f0cf6937e75438 +0ms
  hfc hash: ad56458b896701114f996106bc54c5a6f18cf948f4a0eb6bfd2bc45438c9159c +3s
  hfc type of request.certificatePath: string +0ms
  hfc request.certificatePath: /certs/peer/cert.pem +0ms
  hfc Adding COPY certificate.pem command +0ms
  hfc Created Dockerfile at [blockchain/app/src/chaincode/Dockerfile] +2ms
  hfc GenerateTarGz +0ms
  hfc Created deployment archive at [/tmp/deployment-package.tar.gz] +3s
  hfc chaincodeID: {"path":"","name":"ad56458b896701114f996106bc54c5a6f18cf948f4a0eb6bfd2bc45438c9159c"} +2ms
  hfc chaincodeSpec: {"type":1,"chaincodeID":{"path":"","name":"ad56458b896701114f996106bc54c5a6f18cf948f4a0eb6bfd2bc45438c9159c"},"ctorMsg":{"args":[{"buffer":{"type":"Buffer","data":[105,110,105,116]},"offset":0,"markedOffset":-1,"limit":4,"littleEndian":false,"noAssert":false},{"buffer":{"type":"Buffer","data":[97]},"offset":0,"markedOffset":-1,"limit":1,"littleEndian":false,"noAssert":false},{"buffer":{"type":"Buffer","data":[49,48,48]},"offset":0,"markedOffset":-1,"limit":3,"littleEndian":false,"noAssert":false},{"buffer":{"type":"Buffer","data":[98]},"offset":0,"markedOffset":-1,"limit":1,"littleEndian":false,"noAssert":false},{"buffer":{"type":"Buffer","data":[50,48,48]},"offset":0,"markedOffset":-1,"limit":3,"littleEndian":false,"noAssert":false}]},"timeout":0,"secureContext":"","confidentialityLevel":0,"metadata":{"buffer":{"type":"Buffer","data":[]},"offset":0,"markedOffset":-1,"limit":0,"littleEndian":false,"noAssert":false},"attributes":[]} +2ms
  hfc Read in deployment archive from [/tmp/deployment-package.tar.gz] +9ms
  hfc Set confidentiality level to PUBLIC +38ms
  hfc Temporary archive deleted successfully ---> /tmp/deployment-package.tar.gz +1ms
  hfc File deleted successfully ---> blockchain/app/src/chaincode/Dockerfile +0ms
  hfc Calling TransactionContext.execute +1ms
  hfc Executing transaction +0ms
  hfc [TransactionContext] TCert already cached. +0ms
  hfc Process Confidentiality... +1ms
  hfc Sign transaction... +1ms
  hfc Send transaction... +238ms
  hfc Confidentiality:  0 +0ms
  hfc reg txid ad56458b896701114f996106bc54c5a6f18cf948f4a0eb6bfd2bc45438c9159c +0ms
  hfc waiting 60 seconds before emitting complete event +4ms
  hfc peer.sendTransaction +162ms
  hfc timeout uuid= ad56458b896701114f996106bc54c5a6f18cf948f4a0eb6bfd2bc45438c9159c +60s

Failed to deploy chaincode: request={"fcn":"init","args":["a","100","b","200"],"chaincodePath":"chaincode","certificatePath":"/certs/peer/cert.pem"}, error="timed out waiting for transaction to complete"

Marbles timeout

When I try to run marbles (version 2) using the gulp command I get the below error. I am running fabric locally using vagrant.

[ibc-js] Deploy Chaincode - Starting
[ibc-js] function: init , arg: [ '99' ]

Waiting...

[http POST - y] localhost:7050
[http POST - y] /chaincode
body: {"jsonrpc":"2.0","method":"deploy","params":{"type":1,"chaincodeID":{"path":"http://gopkg.in/ibm-blockchain/marbles.v2/chaincode"},"ctorMsg":{"function":"init","args":["99"]},"secureContext":"bob"},"id":XXXXXXXXXXX}

[http POST - y] Error - request timed out
[ibc-js] deploy - failure: 408
! looks like a deploy error, holding off on the starting the socket
{ name: 'deploy() error',
code: 408,
details: 'Request timed out' }
[http POST - y] Error - request timed out
[http POST - y] Status code: 200

I changed the content of 'mycreds_docker_compose.json" to:

{
"credentials": {
"peers": [{
"api_host": "localhost",
"api_port": 7050,
"type": "peer",
"id": "vp0"
}],
"users": [{
"enrollId": "bob",
"enrollSecret": "NOE63pEQbL25"
}],
"cert": "https://blockchain-certs.mybluemix.net/us.blockchain.ibm.com.cert"
}
}

And the command to start the peer is:
peer node start --logging-level=DEBUG

And in the app.js I changed
deploytimeout: 30000
to
deploytimeout: 120000

As otherwise I received the bellow error:

[ibc-js] Deploy Chaincode - Starting
[ibc-js] function: init , arg: [ '99' ]

Waiting...
deploy resp error - there is no chaincode hash name in response: { json rpc: '2.0',
error:
{ code: -32001,
message: 'Deployment failure',
data: 'Error when deploying chaincode: Error getting chaincode package byte s: Error getting code Getting chaincode took too long' },
id: 1489827931548 }
! looks like a deploy error, holding off on the starting the socket
{ name: 'deploy() error no cc name',
code: 502,
details:
{ jsonrpc: '2.0',
error:
{ code: -32001,
message: 'Deployment failure',
data: 'Error when deploying chaincode: Error getting chaincode package b ytes: Error getting code Getting chaincode took too long' },
id: 1489827931548 } }

Unable to Connect to Bluemix Network

Hi,
Newbie here trying to learn/demo on the Marble Application. Unfortunately i am not able to connec to the BlockChain Network. Can anyone share the reasons on the issue and possible work arounds?
_Error Message_
Start Up Error
{ "code": "ECONNRESET" }
This application cannot run without the blockchain network :(

Thank You
Aswink

local docker deploy

I'm having similar issues with deploying the marbles demo like in #38 . Didn't seem like it was resolved, so here goes:

I'm using [email protected]:IBM-Blockchain/fabric-images.git

$ echo $ARCH_TAG
x86_64-0.6.1-preview
$ cat docker-compose/single-peer-ca.yaml 
version: '2'
services:
  baseimage:
    build: ./baseimage
    image: hyperledger/fabric-baseimage:latest

  membersrvc:
    image: ibmblockchain/fabric-membersrvc:${ARCH_TAG}
    networks:
      - blockchain-net
    extends:
      file: base/membersrvc.yaml
      service: membersrvc

  vp:
    image: ibmblockchain/fabric-peer:${ARCH_TAG}
    networks:
      - blockchain-net
    extends:
      file: base/peer-secure-base.yaml
      service: peer-secure-base
    ports:
      - "7050:7050"
      - "7051:7051"
      - "7053:7053"
    environment:
      - CORE_PEER_ID=vp0
      - CORE_SECURITY_ENROLLID=vp
      - CORE_SECURITY_ENROLLSECRET=f3489fy98ghf
    links:
      - membersrvc

networks:
  blockchain-net:
    external:
      name: blockchain-net

This seems to start ok:

$ docker-compose -f single-peer-ca.yaml up

Now, for the marbles demo after building it under blockchain-marbles-v2:

$ docker run --name ${SERVICE} --network blockchain-net -p 3000:3000 -it -d ${SERVICE} bash

In another window, I can see that they are in the same network:

$ docker network inspect blockchain-net
...
        "Containers": {
            "a671e00d7608ed18c2d0797848c2f844ff74d3d7b12f0a684e70b5c9c916ac2b": {
                "Name": "blockchain-marbles-v2",
                "EndpointID": "651c68f4c351c735bd0753fa40162cf91317e2c390c7915299f49b31fb93abed",
                "MacAddress": "02:42:0a:c8:00:02",
                "IPv4Address": "10.200.0.2/16",
                "IPv6Address": ""
            },
            "d1df6af60c2d84269eb3a4701c90de51b79aca3bceda656743cd9c400bfbf44d": {
                "Name": "dockercompose_membersrvc_1",
                "EndpointID": "5a5756da41df6179fda814a96ad095773b429b6880b1354a351dcac2c45689bb",
                "MacAddress": "02:42:0a:c8:00:04",
                "IPv4Address": "10.200.0.4/16",
                "IPv6Address": ""
            },
            "f225d585b77f6707f79be701426cda0354ef346f9a6dfb238d12959b9fd2b036": {
                "Name": "dockercompose_vp_1",
                "EndpointID": "eebe85a50ef5465716dd7c3a62072a4ff1b9a7c0688ee769163bcb8a7f1353b2",
                "MacAddress": "02:42:0a:c8:00:05",
                "IPv4Address": "10.200.0.5/16",
                "IPv6Address": ""
            }
        },

I changed the api_host to dockercompose_vp_1 in file mycreds_docker_compose.json:

{
	"credentials": {
		"peers": [{
			"api_host": "dockercompose_vp_1",
			"api_port": 7050,
			"type": "peer",
			"id": "vp0"
		}],
		"users": [{
			"enrollId": "bob",
			"enrollSecret": "NOE63pEQbL25"
		}],
		"cert": "https://blockchain-certs.mybluemix.net/us.blockchain.ibm.com.cert"
	}
}

Inside the container, I run gulp:

Running using Developer settings
- Tracking Deployment
loading hardcoded peers
loading hardcoded users
[ibc-js] Peer:  vp0-vp0...:7050
[ibc-js] Registering  vp0-vp0...:7050  w/enrollId - bob
[ibc-js] Registration success x1 : bob
[ibc-js] removing temp dir
[ibc-js] Downloading zip
redirect... https://codeload.github.com/IBM-Blockchain/marbles/zip/v2.0
[ibc-js] Downloading zip
[ibc-js] Unzipping zip
[ibc-js] Unzip done
[ibc-js] Scanning files [ 'marbles_chaincode.go' ]
[ibc-js] Parsing file for shim version
[ibc-js] Found shim version: github.com/hyperledger/fabric/core/chaincode/shim
[ibc-js] Parsing file for invoke functions - marbles_chaincode.go
[ibc-js] Found cc invoke function:  init
[ibc-js] Found cc invoke function:  delete
[ibc-js] Found cc invoke function:  write
[ibc-js] Found cc invoke function:  init_marble
[ibc-js] Found cc invoke function:  set_user
[ibc-js] Found cc invoke function:  open_trade
[ibc-js] Found cc invoke function:  perform_trade
[ibc-js] Found cc invoke function:  remove_trade
[ibc-js] Parsing file for query functions - marbles_chaincode.go
[ibc-js] Found cc query function:  read
[ibc-js] load_chaincode() finished
[ibc-js] Deploy Chaincode - Starting
[ibc-js] 	function: init , arg: [ '99' ]


	 Waiting...


	 deploy resp error - there is no chaincode hash name in response: { jsonrpc: '2.0',
  error: 
   { code: -32001,
     message: 'Deployment failure',
     data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long' },
  id: 1483146533342 }
! looks like a deploy error, holding off on the starting the socket
 { name: 'deploy() error no cc name',
  code: 502,
  details: 
   { jsonrpc: '2.0',
     error: 
      { code: -32001,
        message: 'Deployment failure',
        data: 'Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long' },
     id: 1483146533342 } }

On the peer side, I see traffic, but ultimately, there's an error:

vp_1          | 01:08:50.024 [crypto] Debugf -> DEBU 0ac [client.bob] Storing TLS key and certificate for user [bob]...
vp_1          | 01:08:50.027 [crypto] Debug -> DEBU 0ad [client.bob]  Registering node crypto engine...done!
vp_1          | 01:08:50.028 [crypto] Info -> INFO 0ae [client.bob]  Register crypto engine...
vp_1          | 01:08:50.032 [crypto] Info -> INFO 0af [client.bob]  Register crypto engine...done.
vp_1          | 01:08:50.032 [crypto] Debugf -> DEBU 0b0 [client.bob] Registration of node [%!s(crypto.NodeType=0)] with name [bob] completed
vp_1          | 01:08:50.032 [crypto] Debug -> DEBU 0b1 [client.bob]  Closing keystore...
vp_1          | 01:08:50.032 [crypto] Debug -> DEBU 0b2 [client.bob]  Closing keystore...done!
vp_1          | 01:08:50.032 [crypto] RegisterClient -> INFO 0b3 Registering client [bob] with name [bob]...done!
vp_1          | 01:08:50.033 [rest] Register -> INFO 0b4 Storing login token for user 'bob'.
vp_1          | 01:08:50.035 [rest] Register -> INFO 0b5 Login successful for user 'bob'.
vp_1          | 01:08:53.350 [rest] ProcessChaincode -> INFO 0b6 REST processing chaincode request...
vp_1          | 01:08:53.361 [rest] processChaincodeDeploy -> INFO 0b7 REST deploying chaincode...
vp_1          | 01:08:53.364 [rest] processChaincodeDeploy -> INFO 0b8 Local user 'bob' is already logged in. Retrieving login token.
vp_1          | 01:08:53.366 [devops] getChaincodeBytes -> DEBU 0b9 Received build request for chaincode spec: type:GOLANG chaincodeID:<path:"http://gopkg.in/ibm-blockchain/marbles.v2/chaincode" > ctorMsg:<args:"init" args:"99" > secureContext:"bob" 
vp_1          | 01:08:53.375 [golang/hash] getCodeFromHTTP -> DEBU 0ba getCodeFromHTTP gopkg.in/ibm-blockchain/marbles.v2/chaincode
vp_1          | 01:08:53.381 [golang/hash] getCodeFromHTTP -> DEBU 0bb go get gopkg.in/ibm-blockchain/marbles.v2/chaincode
vp_1          | 01:09:23.436 [devops] getChaincodeBytes -> ERRO 0bc Error getting chaincode package bytes: Error getting code Getting chaincode took too long
vp_1          | 01:09:23.436 [devops] Deploy -> ERRO 0bd Error deploying chaincode spec: type:GOLANG chaincodeID:<path:"http://gopkg.in/ibm-blockchain/marbles.v2/chaincode" > ctorMsg:<args:"init" args:"99" > secureContext:"bob" 
vp_1          | 
vp_1          |  error: Error getting chaincode package bytes: Error getting code Getting chaincode took too long
vp_1          | 01:09:23.437 [rest] processChaincodeDeploy -> ERRO 0be Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long
vp_1          | 01:09:23.439 [rest] ProcessChaincode -> INFO 0bf REST successfully deploy chaincode: {"jsonrpc":"2.0","error":{"code":-32001,"message":"Deployment failure","data":"Error when deploying chaincode: Error getting chaincode package bytes: Error getting code Getting chaincode took too long"},"id":1483146533342}

Any ideas how to fix this?

Thanks!

v3 docker network cannot be set up as COP enrollment credentials not available

Hi,

I'd like to set up a local network for deploying the marbles app in version 3 as described at:
https://github.com/IBM-Blockchain/marbles/blob/v3.0/docs/use_local_hyperledger.md

The referenced connecathon setup uses a hosted COP server which is behind a firewall. To access this credentials are required, that only have been provided to the participants.

Could you please provide those or explain another way to set up such a network.

Thank you in advance,
kc

deploy - failure: 408

When I marbles node app.js, I receive the following error. How can I fix about this?

[ibc-js] deploy - failure: 408
! looks like a deploy error, holding off on the starting the socket
{ name: 'deploy() error',
code: 408,
details: 'Request timed out' }

In docker toolbox getting ECONNREFUSED error and registration failure

HI @dshuffma-ibm ,

i am trying to run marbles application using docker toolbox option in local.

While executing the gulp command in the prompt getting the ECONNREFUSED error and registration failure message.

My docker-compose.yml file looks like:

membersrvc:

image: hyperledger/fabric-membersrvc
command: membersrvc
vp0:
image: hyperledger/fabric-peer
environment:
- CORE_PEER_ADDRESSAUTODETECT=true
- CORE_VM_ENDPOINT=http://172.17.0.1:2375
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_ID=vp0
- CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
- CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
- CORE_SECURITY_ENABLED=true
- CORE_SECURITY_ENROLLID=test_vp0
- CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
links:
- membersrvc
command: sh -c "sleep 5; peer node start --peer-chaincodedev"

my mycreds_docker_compose.json file looks like:

{

"credentials": {
	"peers": [{
		"api_host": "localhost",
		"api_port": 7050,
		"type": "peer",
		"id": "vp0"
	}],
	"users": [{
		"enrollId": "bob",
		"enrollSecret": "NOE63pEQbL25"
	}],
}

}

Can you please explain what are all the configuration changes need to do in the following files app.js, setup.js, docker-compose.yml and mycreds_docker_compose.json.

Deployment to Bluemix failed

Deployment demo to Bluemix IBM Bluemix United Kingdom failed with errors:

Downloading artifacts...DOWNLOAD SUCCESSFUL
Target: https://api.eu-gb.bluemix.net
Creating service instance myblockchain in org [email protected] / space dev as [email protected]...
FAILED
Server error, status code: 502, error code: 10001, message: Service broker error: Calling url >https://broker-prod.blockchain.ibm.com/v2/service_instances/f392e168-cc79-432b-8c08-cbcce425296b?accepts_incomplete=true failed with error message read ECONNRESET

Finished: FAILED
Stage has no runtime information

[ERROR] Tag latest not found in repository docker.io/ibmblockchain/fabric-membersrvc

Using Docker Compose Local to run Hyperledger Network
follow the documentation: https://hub.docker.com/r/ibmblockchain/fabric-peer/
Step 5. Try to run one of the two docker compose files, single-peer-ca.yaml or four-peer-ca.yaml.
Get Error like this:

$ sudo docker-compose -f four-peer-ca.yaml up
WARNING: The ARCH_TAG variable is not set. Defaulting to a blank string.
Pulling membersrvc (ibmblockchain/fabric-membersrvc:latest)...
Pulling repository docker.io/ibmblockchain/fabric-membersrvc
ERROR: Tag latest not found in repository docker.io/ibmblockchain/fabric-membersrvc

Docker Version:
docker-compose version 1.5.2, build unknown
docker-py version: 1.8.0
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016

System Version:
Distributor ID: Ubuntu
Description: Ubuntu 16.04 LTS
Release: 16.04
Codename: xenial

Cannot download chaincode from local deployment

Hi!
I am trying to set up the marbles application by setting up a local network of VPs and a local CA too.

I have been capable of building everything and all the steps are executed properly until the deployment of the chaincode:

Waiting...
   [ibc-js] deploy - failure: 400
   ! looks like a deploy error, holding off on the starting the socket
    { name: 'deploy() error',
     code: 400,
     details: { Error: 'Error getting chaincode package bytes: Error getting code p
   rocess done with error = exit status 1' } }

when I set git_url to: github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 it finds the chaincode and deploys it.

I don't know why the git_url to: https://github.com/IBM-Blockchain/marbles-chaincode/part2_v1.0.0 it fails to download it.

docker-compose error: manifest for ibmblockchain/fabric-membersrvc: latest not found

I used Docker Toolbox on Windows 7 and I followed the guide of IBM blockchain to pull the heyperledger fabric. When I ran the "docker-compose -f single-peer-ca.yaml up" command, I found this error message:
[31mERROR[0m: manifest for ibmblockchain/fabric-membersrvc: latest not found
I ran "docker images" command and saw that the tag of "ibmblockchain/fabric-membersrvc" was "x86_64-0.6.1-preview" (it is indeed not the latest) and the tag of "ibmblockchain/fabric-peer" was also x86_64-0.6.1-preview.
How to make them the latest? Thanks!

Local installation tutorial

Request: local (non-bluemix) installation tutorial with all the following configuration steps specified:

  1. docker-compose.yml
  2. options in app.js
  3. mycreds_docker json
  4. os / environment (e.g. OSX / ubuntu / windows / vagrant)

that gets the demo working. See #13 (comment)

Undefined setTimeout references in tutorial_part2.md

part2 makes two references to not using setTimeout() anymore but this is not something that is talked about in part1.
Either part1 needs to talk about setTimeout() so the reader understands the reference in part2 or part2 should not talk about it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.