The marbles sample shows how to deploy and run a Hyperledger Fabric Node.js SDK application on Alibaba Cloud Blockchain as a Service (BaaS). The sample includes a chaincode and a browser-based marble-trading game. This guide walks you through the full setup — from configuring the SDK connection profile to playing the game in your browser.
Prerequisites
Before you begin, ensure that you have:
A running Hyperledger Fabric network on BaaS with at least one organization and channel
The SDK connection profile (
connection-profile-standard.json) downloaded from the BaaS consoleNode.js v8 and npm installed
To verify your versions:
$ node --version
V8.11.2
$ npm --version
5.6.0How it works
The setup follows three sequential steps:
Download the sample package and configure the connection profile with your organization's Certificate Authority (CA) credentials.
Upload and instantiate the marbles chaincode on your BaaS channel.
Start the app, connect it to your chaincode, and start trading marbles.
Step 1: Download and configure the sample
1.1 Download the package
Download node-sdk-demo-1.4.5 and extract it to any directory. Copy your connection-profile-standard.json (downloaded from the BaaS console) into the node-sdk-demo/config directory.
The final directory structure looks like this:

1.2 Configure the connection profile
The connection profile tells the Node.js SDK how to connect to your Fabric network. You need to add your organization's CA credentials to the certificateAuthorities section so the SDK can enroll users and obtain certificates.
Open config/connection-profile-standard.json and add a registrar entry under the CA that belongs to your organization:
"registrar": [
{
"enrollId": "user",
"enrollSecret": "user-secret"
}
]For example, if the username is user and the password is user-secret, and the user belongs to the test10 organization, add the credentials to the CA entry ca1.test10.aliyunbaas.top.
The modified certificateAuthorities section looks like this:

Tip: Paste the JSON into jsonlint.com to format and validate it before saving.
Step 2: Upload the chaincode
Upload node-sdk-demo/chaincode/marbles_v4.cc to BaaS, then instantiate it on your channel. For detailed steps, see Deploy chaincodes.
Step 3: Run the marbles app
3.1 Install dependencies and start the app
From the node-sdk-demo directory, install the npm dependencies and start the app:
npm install --registry http://registry.npmmirror.com
gulp marbles_baasWhen the app starts successfully, you see the following output:
Debug: Open your browser to http://localhost:3001 and login to tweak settings for startupOpen http://localhost:3001 in your browser. If prompted for a password, enter admin.
3.2 Configure the chaincode settings
The app opens on a setup guide page. Select Guided mode. It automatically jumps to step 3, where you configure the chaincode connection:

Fill in the following fields:
| Field | Value |
|---|---|
channel | The channel name where you uploaded marbles_v4 (for example, first-channel) |
chaincode_id | marbles |
chaincode_version | v4 |
Click Try Again. If the chaincode is detected successfully, you see the following page:

If the check fails, confirm that the chaincode has been uploaded and instantiated on the correct channel.
3.3 Play the game
Close the dialog box to start the marble-trading game. Drag marbles from one user to another to transfer assets. Click + next to a user to add a marble, or drag a marble to the trash to delete it.

Expected warnings
When the app starts, you may see error logs similar to:
Missing 'chaincodeId' parameterThis is expected. The connection-profile-standard.json generated by BaaS follows the standard Fabric connection profile format, which does not include chaincode-specific configuration — that is handled through the marbles setup guide. These logs do not affect the app's operation.
What's next
Explore the full marbles sample in the community repository
Learn more about the Fabric Node.js SDK in the fabric-sdk-node documentation