๐ 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)| Parameter | Type | Description |
|---|---|---|
| name | string | Account name |
| passWd | string | Account password |
1.1.2 Create Key from Mnemonic
Generate keys using existing mnemonic:
utils.CreateKeyFromMnemonic(name string, passWd string, mnemonic string)| Parameter | Type | Description |
|---|---|---|
| mnemonic | string | Account mnemonic phrase |
1.2 Token Utils
1.2.1 Parse Multi-Send String
Convert multi-send string into TransferUnit:
utils.ParseMultiSend(str string)| Parameter | Type | Example |
|---|---|---|
| str | string | "addr1 1okt\naddr2 2okt" |
2. Auth Module
Located in exchain-go-sdk/module/auth.
2.1 Query Account Info
auth.QueryAccount(accAddrStr string)| Parameter | Type | Description |
|---|---|---|
| accAddrStr | string | Bech32 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-sdkWhat'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).