All Products
Search
Document Center

Data Written Compliance

Last Updated: Jun 11, 2020

When you upload data to a blockchain by using a REST API, you can integrate Alibaba Cloud Blockchain as a Service (BaaS) with the Content Moderation service to check data before the upload. This prevents illegal data from being uploaded to the blockchain.

This topic uses Node. js as an example to describe how to use a REST API to check data compliance before uploading the data to a blockchain.

Prerequisites

  1. The cloud service integration module is installed in the blockchain instance, and Alibaba Cloud BaaS is allowed to integrate with the Content Moderation service.
  2. Cloud service integration sample code is downloaded.
  3. Node.js v8.17.0 or later is installed.

Procedure

  1. Deploy sample chaincode notary to the channel by referring to Chaincode Deployment.
  2. Modify main.js in sample code invoke-with-content-check by referring to Use REST APIs.
  3. Go to the invoke-with-content-check directory and execute npm install to install the dependencies of the node.
  4. Execute node main.js to start the instance.

Sample output

  1. Data 1581905807512 pushed to blockchain with transaction 284d0b2b89db5bc5489127de863d0bb9b9d0a5f05bae67762567a3aff113822a
  2. Content Moderation check failed: Send transaction failed: CONTENT_CHECK returned error VERIFY_FAILED: Content Moderation Check failed, suggestion block. key: 1581905807512, value: <Sensitive data for the test is omitted.>
  3. Content Moderation check failed: Send transaction failed: CONTENT_CHECK returned error VERIFY_FAILED: Content Moderation Check failed, suggestion block. Key: 1581905807512, value: <Sensitive data for the test is omitted.>

More information

If the default content check policies fail to meet your business needs, you can log on to the Content Moderation console and add check rules or adjust check behavior by referring to Custom text library.