Blockchain as a Service:Quick Experience for Free

更新时间:
复制 MD 格式

Alibaba Cloud Blockchain as a Service (BaaS) provides a free contract test chain so you can explore the complete blockchain workflow without setting up your own network. This guide walks you through the full onboarding sequence: applying for a Transport Layer Security (TLS) connection certificate, creating an on-chain account, deploying a smart contract using Cloud IDE, and connecting to the chain through the software development kit (SDK). By the end, you will be able to submit your first on-chain transaction and view it in the blockchain explorer.

The contract test chain is for testing only. Do not upload business code or business data. To set up your own blockchain network, see Create a consortium.

Prerequisites

Before you begin, ensure that you have:

Apply for the contract test chain

  1. Log in to the Alibaba Cloud BaaS console.

  2. In the left-side navigation pane, click Overview under Ant Blockchain.

  3. Click Try for Free, then fill in the pop-up form to apply.

After the application succeeds, you can perform the following operations on the contract test chain:

  • Apply for a TLS connection certificate

  • Create an on-chain account

  • Debug and deploy contracts

  • Connect to the blockchain using SDK

Apply for a TLS connection certificate

After applying for the contract test chain, the platform guides you through the TLS certificate application. Two generation methods are available: Automatically Generated (recommended) and Manually Generated.

The certificate is valid for three years. Re-apply after it expires.

Automatically Generated (recommended)

  1. Fill in the application information and click Apply.

  2. Download the private key and certificate.

Important

You have only one chance to download the private key. Once you leave this page, you cannot download it again.

Certificate download

Manually Generated

Upload a locally generated certificate signing request (CSR) file client.csr and click Apply.

To generate client.key and client.csr on your local machine, see Generate certificates and key pairs locally.

Create an on-chain account

  1. On the contract test chain card, click ··· in the upper-right corner, then click Create Account.

    Create account

  2. In the pop-up window, select a creation method and follow the prompts. Two methods are available: Automatically (recommended) and Manually.

Automatically (recommended)

  1. Select Automatically and fill in the application information.

  2. Click Apply.

  3. Download the public-private key pair in the pop-up window. These keys are required for future application development.

Important

You have only one chance to download the private key. Once you leave this page, you cannot download it again.

Key pair download

Manually

  1. Select Manually and fill in the Account Name, Account Public Key, and Account Recovery Public Key.

  2. Click Apply.

Use Client Tool to generate and manage public and private keys. For steps to generate key pairs locally, see Generate certificates and key pairs locally.

Debug and deploy contracts

After applying for a TLS connection certificate and creating an on-chain account, click Deploy Contract on the contract test chain card to open Cloud IDE — the platform's browser-based contract development environment. Cloud IDE supports developing, compiling, debugging, deploying, and calling contracts in multiple languages.

For detailed usage, see Use Cloud IDE.

Connect to the blockchain using SDK

On the contract test chain card, click ··· to download certificates, development components, or reset certificates.

The contract test chain has been upgraded to v2.19.4. Connect directly through Maven dependencies — no SDK download is required.

For application development guides, see Java SDK developer guide.

SDK connection

Blockchain explorer

After connecting to the contract test chain through the SDK and submitting an on-chain transaction, click View Details on the contract test chain card to open the blockchain explorer. The explorer displays:

  • Total business statistics

  • Network status and node details

  • Current block height

  • Transaction volumes, blocks, and transactions over time

Blockchain explorer

For usage instructions, see View blockchain details.

Generate certificates and key pairs locally

If you chose Manually Generated for the TLS certificate or Manually for the account, generate the required files on your local machine using one of the following methods.

Use OpenSSL

macOS includes OpenSSL by default. No installation is required.

Install OpenSSL on Windows

  1. Download OpenSSL version 1.0.2o (recommended):

  2. Open a command prompt and go to the bin directory of the OpenSSL installation path.

  3. Set the environment variable:

    set OPENSSL_CONF=openssl.cfg

Generate a certificate signing request

Run the following command to generate a private key and a certificate signing request (CSR):

Store the private key file securely and remember the passphrase.
openssl req -newkey rsa:2048 -keyout key_pkcs10.pem -out csr.pem

The command prompts for the following information:

Field Description Example
Country name Two-letter ISO country code CN
State or province name Full province name Zhejiang
Locality name City Hangzhou
Organization name Company name (Pinyin for Chinese companies) YourCompany
Organizational unit name Department IT Dept
Common name Domain name of the SSL-protected website pay.example.com
Email address (Optional) Contact email
Challenge password (Optional)
Optional company name (Optional)

Use the local key service

The BaaS platform provides a Java-based local key service as an alternative to OpenSSL.

Start the local key service

  1. Make sure Java Runtime Environment (JRE) 1.7 or later is installed.

  2. Download baas-crypto-tool-1.0.0.jar.

  3. Start the key service:

    java -jar baas-crypto-tool-1.0.0.jar --server.port=8080

Generate a TLS certificate signing request

In a browser, go to the following URL to generate tlskey.zip:

https://localhost:8080/api/crypto/generateTlsKey?algo=rsa&isPkcs8=true&password=<your-password>

Replace <your-password> with your own password.

Unzip tlskey.zip to get:

  • client.key — used to connect to the blockchain

  • client.csr — the CSR to be signed by the BaaS platform

Generate account key pairs

In a browser, go to the following URL to generate userkey.zip:

http://localhost:8080/api/crypto/generateUserKey?algo=ec&isPkcs8=true&password=<your-password>

Replace <your-password> with your own password.

Unzip userkey.zip to get:

  • user.key — the account private key

  • pub.txt — the account public key

Run the command twice to generate two key pairs: one for the account and one for account recovery.

What's next

After completing the free trial, continue with these resources: