Esta página ainda não está disponível no idioma selecionado. Estamos trabalhando para adicionar mais opções de idiomas. Agradecemos sua compreensão.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Chaincode Library APIs

Updated on 2023-01-16 GMT+08:00

The chaincode library is static and integrated in BCS instances. When developing a chaincode, you can use the API file to locally compile the chaincode.

Download the API file (for the download link, see Downloading Resources), and decompress it to the local GOPATH directory. Refer to the example chaincode provided in section 4.2.6 to import the homomorphic encryption library. After the chaincode is developed, install it in the BCS instance. The chaincode will automatically link to the library code in the instance to invoke the homomorphic encryption library for the chaincode.

The code for importing the homomorphic encryption library for the chaincode is import "ahe/PSW/api/ChainCode".

NOTE:

Do not modify this code line. Otherwise, the chaincode fails to invoke the homomorphic encryption library.

ValidateInitBalance

  • API prototype

    func ValidateInitBalance(BalanceInfo, PubKey string) (InitBalance string, err error)

  • Function description

    Verifies the validity of the balance proof in balanceinfo generated by sdk.InitBalance.

  • Input

    Parameter

    Type

    Description

    Mandatory

    BalanceInfo

    string

    Initial balance data

    Yes

    Pubkey

    string

    Public key for balance encryption

    Yes

  • Output

    Parameter

    Type

    Description

    Mandatory

    InitBalance

    string

    Initial balance ciphertext

    Yes

    err

    error

    Error message

    Yes

  • Processing

    Balance ciphertext provided after the balance validity verification

  • Note

    The account balance authenticity is ensured by the application logic. The chaincode can only check whether the amount is greater than 0 but cannot determine the actual balance of a user.

ValidateTxInfo

  • API prototype

    ValidateTxInfo(txInfo, cipherBalanceA, cipherBalanceB string) (newCipherBalanceA,newCipherBalanceB,newCipherTxA,newCipherTxB string,err error)

  • Function description

    Verifies the validity of the transaction proof in Txinfo generated by PrepareTxInfo.

  • Input

    Parameter

    Type

    Description

    Mandatory

    txinfo

    string

    Transaction proof data

    NOTE:

    The transaction data includes the transaction proof data in addition to the ciphertext of the transaction data. It is obtained from txinfo returned using sdk.PrepareTxInfo.

    Yes

    cipherBalanceA

    string

    Current balance of user A (ciphertext)

    Yes

    cipherBalanceB

    string

    Current balance of user B (ciphertext)

    Yes

  • Output

    Parameter

    Type

    Description

    newCipherBalanceA

    string

    User A' balance to be updated after the transaction

    newCipherBalanceB

    string

    User B' balance to be updated after the transaction

    newCipherTxA

    string

    Transaction amount (encrypted using user A' homomorphic public-key encryption)

    newCipherTxB

    string

    Transaction amount (encrypted using user B' homomorphic public-key encryption)

    err

    error

    Error message

  • Note

    In this money transfer transaction, user A is the payer, and B the payee.

Usamos cookies para aprimorar nosso site e sua experiência. Ao continuar a navegar em nosso site, você aceita nossa política de cookies. Saiba mais

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback