All Products
Search
Document Center

Blockchain as a Service:API Overview

Last Updated:Jul 22, 2019

This document introduces API operations supported by the contract platform and describes the responses of the operation calls. For more information about each operation, see relevant topics.

Environment operations

Name Description
Chain You can call this operation to initialize an environment instance.

Account operations

Name Description
CreateAccount You can call this operation to create an account.
TransferBalance You can call this operation to perform a transfer.
SetRecoverkey You can call this operation to set a recovery key.
PreResetPubKey You can call this operation to pre-reset a public key.
ResetPubKey You can call this operation to reset a public key.
UpdateAuthMap You can call this operation to update the weight.

Contract operations

Name Description
contract You can call this operation to create a smart contract instance.
new You can call this operation to deploy a contract.
Name of the user-defined contract method You can call this operation to call a contract.
update You can call this operation to update a contract.

Query operations

Name Description
QueryBlockHeader You can call this operation to query a block header.
QueryLastBlock You can call this operation to query the last block.
QueryBlock You can call this operation to query a specified block.
QueryTransaction You can call this operation to query a transaction.
QueryTransactionReceipt You can call this operation to query a transaction receipt.
QueryAccount You can call this operation to query an account.
QueryContract You can call this operation to query a contract account.

Local execution operations

Name Description
LocalTransaction You can call this operation to execute a common transaction locally.
Contract-related operation methods You can call this operation to execute a contract-related transaction locally.

Native deposit operations

Name Description
NativeDepositData You can call this operation to deposit data.

Event operations

Name Description
event.account You can call this operation to subscribe to an account event.
accountEvent.close You can call this operation to unsubscribe an account event.
event.contract You can call this operation to subscribe to a contract event.
contractEvent.close You can call this operation to unsubscribe a contract event.
event.topic You can call this operation to subscribe to a topic event.
topicEvent.close You can call this operation to unsubscribe a topic event.
event.block You can call this operation to subscribe to a block event.
blockEvent.close You can call this operation to unsubscribe a block event.

Tool operations

Name Description
getHash You can call the GetHash() function to return the hash for a string.
toDecimal You can call this operation to convert a hexadecimal string to a decimal string.
toUtf8 You can call this operation to convert a hexadecimal string to a UTF-8 string.
getKeyInfo You can call this operation to obtain the account information.
decryptAESWithPassword You can call this operation to decrypt the transaction method of the TEE-based blockchain.
decryptTXWithAES You can call this operation to decrypt the transaction method of the TEE-based blockchain.
generateAESKey For the blockchain based on TEE, the specified AES key is used with the specified transaction hash to generate a final AES key for the target transaction.

Responses

Most operations in the JS SDK return results in the same callback mode. However, for contract-related operations, the results are returned differently.

  • Response parameters of common operations
Name Type Description
err string The account name that is used to create a new account.
data object The receipt of the transaction.
  • Response parameters of contract-related operations
Name Type Description
err string The error message. An undefined value indicates that no errors were found.
output Unspecified In the case of deploying a contract, this field is the bytecode of the contract. If this field is called by the contract, the field type is the same as the return value type of the contract method.
data object The receipt of the transaction.

The content of the data field varies with the operation. For more information, check the response of a specified operation.