API Overview for Blockchain Service BaaS

ยท

This document summarizes all JS APIs supported by the contract platform, including interface return values. For detailed interface specifications, refer to the relevant documentation.

Core APIs


Environment Interfaces

InterfaceDescription
ChainInitializes a blockchain environment instance.

๐Ÿ‘‰ Learn how to optimize blockchain environments


Account Interfaces

InterfaceDescription
CreateAccountGenerates new blockchain accounts.
TransferBalanceExecutes token transfers between accounts.
SetRecoverkeyConfigures account recovery keys.

Contract Interfaces

InterfaceDescription
contractConstructs contract instances.
newDeploys contracts to the blockchain.
updateUpgrades existing contract code.

Query Interfaces

Retrieve critical blockchain data with these methods:

InterfaceDescription
QueryBlockHeaderFetches block header details.
QueryTransactionReceiptRetrieves transaction execution receipts.

Local Execution Interfaces

Test transactions offline before broadcasting:

InterfaceDescription
LocalTransactionSimulates standard transactions.

๐Ÿ‘‰ Explore advanced local execution techniques


Native Notarization Interfaces

InterfaceDescription
NativeDepositDataStores immutable data proofs on-chain.

Event Interfaces

Subscribe to real-time blockchain events:

InterfaceDescription
event.accountTracks account state changes.
event.contractMonitors contract interactions.

Utility Interfaces

ToolDescription
getHashComputes cryptographic hashes.
toUtf8Converts hex to human-readable strings.

Return Value Specifications

Standard Interface Returns

ParameterTypeDescription
errstringError message (if any).
dataobjectTransaction receipt details.

Contract-Specific Returns

ParameterTypeDescription
outputvariesContract bytecode or method result.

FAQ

Q: How do I handle failed transactions?
A: Check the err field in returns and verify gas parameters before retrying.

Q: Can I test contracts before deployment?
A: Yes, use Local Execution Interfaces for dry-run testing.

Q: What's the cost of native notarization?
A: Fees vary by data size - estimate costs with local execution first.

Q: How frequently do events update?
A: Events trigger in real-time upon on-chain confirmation.

Q: Are there rate limits for API calls?
A: Public nodes may throttle requests; consider dedicated nodes for high volume.

Q: Where can I find complete code samples?
A: Visit our developer portal for SDK integration guides.