Getting started with the wallet API

Constants

EXTERNAL_CHAIN

Indicate the external chain.

INTERNAL_CHAIN

Indicate the internal chain.

APIs

getSinglePublicKey

char* getSinglePublicKey(const void* seed, int seedLen)

Get single address wallet public key.

Return

the public key if succeeded, or nullptr if failed.

if you no longer use, call freeBuf to free memory.

Parameter
[in] seed:binary conent of seed.
[in] seedLen:the length of seed.

getSinglePrivateKey

char* getSinglePrivateKey(const void* seed, int seedLen)

Get single address wallet private key.

Return

the private key if succeeded, or nullptr if failed.

if you no longer use, call freeBuf to free memory.

Parameter
[in] seed:binary conent of seed.
[in] seedLen:the length of seed.

getMasterPublicKey

MasterPublicKey* getMasterPublicKey(const void* seed, int seedLen, int coinType)

Get master public key for HD wallet.

Return

the master public key if succeeded, or nullptr if failed.

if you no longer use, delete the pointer of MasterPublicKey.

Parameter
[in] seed:binary conent of seed.
[in] seedLen:the length of seed.
[in] coinType:coin type.

getAddress

char* getAddress(const char* publicKey)

Get address from public key.

Return

the address if succeeded, or nullptr if failed.

if you no longer use, call freeBuf to free memory.

Parameter
[in] publicKey:the public key.

generateMnemonic

char* generateMnemonic(const char* language, const char* words)

Generate mnemonic.

Return

the mnemonic if succeeded, or nullptr if failed.

if you no longer use, call freeBuf to free memory.

Parameter
[in] language:language, such as english, chinese etc.
[in] words:the words, seperated by ‘ ‘, if the language is english, words is empty string.

getSeedFromMnemonic

int getSeedFromMnemonic(void** seed, const char* mnemonic, const char* language, const char* words, const char* mnemonicPassword)

Get seed from mnemonic.

Return
the seed buffer length if succeeded, or 0 if failed.
Parameter
[out] seed:the seed content, if no longer user, call freeBuf to free memory.
[in] mnemonic:mnemonic, seperated by ‘ ‘.
[in] language:language, such as english, chinese etc.
[in] words:the words, seperated by ‘ ‘, if the language is english, words is empty string.
[in] mnemonicPassword:
 mnemonic password, empty string or effctive password.

getPublicKeyFromPrivateKey

char* getPublicKeyFromPrivateKey(const char* privateKey)

Get public key from private key.

Return

the public key if succeeded, or nullptr if failed.

if you no longer use, call freeBuf to free memory.

Parameter
[in] privateKey:
 the private key.