Go SDK for OKTC Development

ยท

๐Ÿ‘‰ Explore OKTC's Go SDK to streamline your blockchain development with powerful tools and comprehensive documentation.

1. Utils Function

All utility functions are located in the utils package under exchain-go-sdk/utils.

1.1 Account Functions

1.1.1 Create Random Key Info

Generate a random key pair using name and password:

utils.CreateRandomKey(name string, passWd string)
ParameterTypeDescription
namestringAccount name
passWdstringAccount password

1.1.2 Create Key from Mnemonic

Generate keys using existing mnemonic:

utils.CreateKeyFromMnemonic(name string, passWd string, mnemonic string)
ParameterTypeDescription
mnemonicstringAccount mnemonic phrase

1.2 Token Utils

1.2.1 Parse Multi-Send String

Convert multi-send string into TransferUnit:

utils.ParseMultiSend(str string)
ParameterTypeExample
strstring"addr1 1okt\naddr2 2okt"

2. Auth Module

Located in exchain-go-sdk/module/auth.

2.1 Query Account Info

auth.QueryAccount(accAddrStr string)
ParameterTypeDescription
accAddrStrstringBech32 account address

๐Ÿ‘‰ Need help with authentication?

3. Token Module

3.1 Query Token Info

token.QueryToken(ownerAddr string, symbol string)

3.2 Transactions

3.2.1 Token Transfer

token.Transfer(fromInfo keys.Info, passWd string, memo string, toAddrStr string, coinsStr string)

FAQ

How do I install the Go SDK?

go get github.com/okx/exchain-go-sdk

What's the minimum OKT required for transactions?

The network requires 0.002 OKT as minimum gas fee.

How can I track my transaction?

Use the Tendermint module's TX hash lookup feature with tendermint.QueryTx(hashHexStr string).

๐Ÿ‘‰ For advanced features, visit OKTC docs