Wallet API

Go Signing SDK#

Overview#

Go-wallet-sdk is a wallet solution based on Go language that includes various public chains' different cryptographic algorithms and common functionalities. You can use it for creating private keys, addresses, assembling transactions, and performing signatures, among other things. This document will provide a detailed guide on how to use this SDK. Currently, it supports various mainstream blockchains, with each token format having its own independent module implementation. We will continue to add support for more blockchains in the future.

Supported platforms#

As a Go SDK, it can be easily integrated into Web applications, mobile applications, or desktop applications.

Installation and building#

Go GET#

To use the Signing SDK, you first need to install it. You can use go get to get the latest version.

Our Signing SDK supports two types of packages: public packages and single coin modules.

Public packages are for all currencies:

go get -u github.com/okx/go-wallet-sdk/crypto

Integration of individual currencies, taking ETH and BTC as examples:

Integration of ETH:

go get -u github.com/okx/go-wallet-sdk/coins/ethereum

Integration of BTC:

go get -u github.com/okx/go-wallet-sdk/coins/bitcoin

Main features#

Here is a specific introduction to the functions of each module in the Signing SDK.

  • crypto: This module provides commonly used security encryption algorithms and signature algorithms, etc.
  • coins: This module implements methods for building and signing transactions for each coin. Each coin has a corresponding module, such as ethereum, bitcoin, etc. These modules provide transaction building and signing methods for specific coins.

Packages#

Package nameModuleDescription
github.com/okx/go-wallet-sdk/cryptocryptoWe provide common functions about bip32, bip39, ecdsa, ed25519, etc.
github.com/okx/go-wallet-sdk/coins/aptosaptosAptos SDK is used to interact with the Aptos blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/bitcoinbitcoinBitcoin SDK is used to interact with the Bitcoin mainnet or testnet, containing various functions that can be used for web3 wallets. The SDK not only supports Bitcoin, but also supports the following chains: BTC, BSV, DOGE, LTC, TBTC.
github.com/okx/go-wallet-sdk/coins/cosmoscosmosCosmos SDK is used to interact with the Cosmos blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/eoseosEOS SDK is used to interact with the EOS blockchain, containing various functions that can be used for web3 wallets. The SDK not only supports EOS, but also supports WAX.
github.com/okx/go-wallet-sdk/coins/ethereumethereumEthereum SDK is used to interact with the Ethereum blockchain or Evm blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/flowflowFlow SDK is used to interact with the Flow blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/nearnearNear SDK is used to interact with the Near Protocol, containing the main functions needed when interacting with the Near ecosystem.
github.com/okx/go-wallet-sdk/coins/polkadotpolkadotPolkadot SDK is used to interact with the Polkadot blockchain, containing the main functions needed when interacting with the Polkadot ecosystem.
github.com/okx/go-wallet-sdk/coins/solanasolanaSolana SDK is used to interact with the Solana chain, containing the main functions needed when interacting with the Solana ecosystem.
github.com/okx/go-wallet-sdk/coins/stacksstacksStacks SDK is used to interact with the Stacks blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/starknetstarknetStarknet SDK is used to interact with the Starknet blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/suisuiSUI SDK is used to interact with the SUI blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/trontronTRX SDK is used to interact with the TRON blockchain, containing various functions that can be used for web3 wallets.
github.com/okx/go-wallet-sdk/coins/zkspacezkspaceZKSpace SDK is used to interact with ZK contracts, containing various functions that can be used for web3 wallets. The SDK not only supports ZKSpace, but also supports zkSync.

crypto#

This is a library that includes implementations of commonly used security encryption and signature algorithms such as BIP32, BIP39, ECDSA, ED25519, etc. For example:

  • Common BIP32 functions: These functions are mainly used to handle and operate tasks related to the Bitcoin Improvement Payment Protocol (BIP32).
  • BIP39 mnemonic generation, public/private key, and message signing functions: These functions are mainly used to handle and operate tasks related to the Bitcoin Improvement Payment Protocol (BIP39), such as generating mnemonics, public/private keys, and signing messages.
  • Common hash and encoding/decoding functions: These functions are mainly used to handle common hash and encoding/decoding tasks, such as SHA256 hashing, Base64 encoding/decoding, etc.
  • Common ED25519 signature functions: These functions are mainly used to handle and operate tasks related to the ED25519 signature algorithm.
  • Common ECDSA signature functions: These functions are mainly used to handle and operate tasks related to the Elliptic Curve Digital Signature Algorithm (ECDSA).

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/crypto

aptos-sdk#

Aptos SDK is mainly used to integrate Aptos blockchain, containing functions such as private key generation, private key derivation, address generation, and transaction transfer.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/aptos

Supported functions:

Function nameFunctionality
NewAddressGenerate a new address from a private key
ValidateAddressValidate an address
SignRawTransactionSign a transaction

Aptos transaction support types are:

"transfer", "tokenTransfer", "tokenMint", "tokenBurn", "tokenRegister", "dapp", "simulate", "offerNft", "claimNft", "offerNft_simulate", "claimNft_simulate"

For more detailed information about the functions supported by the aptos-sdk package and use cases, you can view the github document for more detailed content: coin-aptos function functions.

bitcoin-sdk#

coin-bitcoin is an SDK for integrating the Bitcoin blockchain. It supports both the Bitcoin mainnet and testnet, and provides a series of functional methods, making it easier for developers to interact with the Bitcoin blockchain. In addition to BTC, it also supports other cryptocurrencies such as BSV, DOGE, LTC, and TBTC.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/bitcoin

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
SignTxSign a transaction
GenerateUnsignedPSBTHexGenerate a PSBT transaction

For more detailed information about the functions supported by the bitcoin-sdk package and use cases, you can view the github document for more detailed content: coin-bitcoin function functions.

cosmos-sdk#

Cosmos SDK is a toolkit for integrating with the Cosmos blockchain, providing a series of functional methods, including generating private keys, deriving private keys, generating addresses, and transferring transactions. It supports currencies including:

  • Atom
  • Axelar
  • Cronos
  • Evmos
  • Iris
  • Juno
  • Kava
  • Kujira
  • Osmos
  • Secret
  • Sei
  • Stargaze
  • Terra

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/cosmos

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
TransferSign a transaction
SignMessageSign a message

For more detailed information about the functions supported by the cosmos-sdk package and use cases, you can view the github document for more detailed content: coin-cosmos function functions.

eos-sdk#

EOS SDK is a toolkit for integrating with the EOS blockchain. It provides a series of functional methods, including generating private keys, deriving private keys, generating addresses, and transaction serialization. In addition to EOS, it also supports the Wax coin.

These functional methods make it easier for developers to interact with the EOS blockchain, including creating and managing wallets, sending and receiving transactions, and querying blockchain information.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/eos

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
SignTransactionSign a transaction

For more detailed information about the functions supported by the eos-sdk package and use cases, you can view the github document for more detailed content: coin-eos function functions.

ethereum-sdk#

Ethereum SDK is a toolkit for integrating with the Ethereum blockchain and other blockchains that support EVM (Ethereum Virtual Machine). It provides a series of functional methods, including generating private keys, deriving private keys, generating addresses, and transferring transactions.

These functional methods make it easier for developers to interact with the Ethereum blockchain, including creating and managing wallets, sending and receiving transactions, and querying blockchain information.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/ethereum

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
SignTransactionSign a transaction
SignMessageSign a message

For more detailed information about the functions supported by the coin-ethereum package and use cases, you can view the github document for more detailed content: coin-ethereum function functions.

flow-sdk#

Flow blockchain is a next-generation, future-oriented blockchain platform, specifically designed for high-performance applications and games.

Flow SDK is a toolkit for integrating with the Flow blockchain. It provides a series of functional methods, enabling developers to interact more conveniently with the Flow blockchain. The specific functionalities offered by the SDK can facilitate the development of applications on the Flow blockchain.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/flow

Supported functions:

Function nameFunctionality
CreateNewAccountTxCreate a new account
SignTxSign a transaction

Flow supports two types of transactions: Account and Transfer.

For more detailed information about the functions supported by the coin-flow package and use cases, you can view the github document for more detailed content: coin-flow function functions.

near-sdk#

Near Protocol is a scalable blockchain platform that achieves high throughput and low latency transaction processing by using a novel consensus mechanism and sharding technology. Near SDK allows developers to interact more conveniently with the Near blockchain.

Near SDK is a toolkit for integrating with the Near Protocol, containing the main functions needed when interacting with the Near ecosystem.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/near

Supported functions:

Function nameFunctionality
NewAccountGet an address through a seed
SignTransactionSign a transaction
TransferTransfer a coin
FullAccessKeyGet a full access key
PublicKeyFromSeedGet a public key from a seed

For more detailed information about the functions supported by the near-sdk package and use cases, you can view the github document for more detailed content: coin-near function functions.

polkadot-sdk#

Polkadot is a multi-chain heterogeneous blockchain platform, which allows various blockchain networks to run in parallel with a shared security model, and can also realize seamless transfer of information and value between chains.

Polkadot SDK is a toolkit for integrating with the Polkadot blockchain, containing the main functions needed when interacting with the Polkadot ecosystem.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/polkadot

Supported functions:

Function nameFunctionality
NewAddressGet an address through a seed
SignTxSign a transaction

For more detailed information about the functions supported by the polkadot-sdk package and use cases, you can view the github document for more detailed content: coin-polkadot function functions.

solana-sdk#

Solana is a high-performance blockchain platform that achieves high throughput and low latency transaction processing through an innovative consensus algorithm and block generation mechanism.

Solana SDK is a toolkit for integrating the Solana blockchain, containing the main functions needed when interacting with the Solana ecosystem.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/solana

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
SignTransactionSign a transaction

For more detailed information about the functions supported by the solana-sdk package and use cases, you can view the github document for more detailed content: coin-solana function functions.

stacks-sdk#

Stacks is an open-source blockchain platform that allows developers to build smart contracts and decentralized applications on the Stacks blockchain.

Stacks SDK is mainly used to integrate Stacks blockchain, containing various functions that can be used for web3 wallets.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/stacks

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
TransferSign a transaction

For more detailed information about the functions supported by the stacks-sdk package and use cases, you can view the github document for more detailed content: coin-stacks function functions.

starknet-sdk#

StarkNet is a decentralized, scalable blockchain network that uses zero-knowledge proof technology to enhance the efficiency and security of transaction processing.

StarkNet SDK is a toolkit for integrating the StarkNet blockchain, providing a series of functional methods that make it easier for developers to interact with the StarkNet blockchain.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/starknet

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
CreateSignedContractTxSign a transaction

For more detailed information about the functions supported by the starknet-sdk package and use cases, you can view the github document for more detailed content: coin-starknet function functions.

sui-sdk#

SUI SDK is a toolkit for integrating the SUI blockchain, containing various functions that can be used for web3 wallets.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/sui

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
SignTransactionSign a transaction
SignMessageSign a message
Note
Note: Unlike SECP256K1, ED25519 only supports hard mode derivation for private keys. For more details, refer to: https://github.com/satoshilabs/slips/blob/master/slip-0010.md

For more detailed information about the functions supported by the sui-sdk package and use cases, you can view the github document for more detailed content: coin-sui function functions.

tron-sdk#

TRON SDK is a toolkit for integrating the TRON blockchain, containing various functions that can be used for web3 wallets.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/tron

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
SignTransactionSign a transaction

For more detailed information about the functions supported by the tron-sdk package and use cases, you can view the github document for more detailed content: coin-tron function functions.

zkspace-sdk#

ZKSpace SDK is mainly used to integrate ZK contracts, containing various functions that can be used for web3 wallets. In addition to ZKSpace, it also supports zkSync.

To get the latest version of the package via go get:

go get -u github.com/okx/go-wallet-sdk/coins/zkspace

Supported functions:

Function nameFunctionality
NewAddressGet a new address through a private key
CreateSignTransferTxSign a transaction

The transaction signature supports data types including: transfer and changePubkey.

For more detailed information about the functions supported by the coin-zkspace package and use cases, you can view the github document for more detailed content: coin-zkspace function functions.

Test Cases#

On GitHub, each module has a corresponding tests directory under its package. This directory contains test cases for various coin modules. You can learn more about the usage of functions in the SDK through these test cases.

Coin FamilyTest Case
BTCTest Case
ETHTest Case
CosmosTest Case
AptosTest Case
EOSTest Case
SolanaTest Case
StacksTest Case
StarknetTest Case
SUITest Case
TRONTest Case
ZkspaceTest Case
FlowTest Case
NearTest Case
PolkadotTest Case

Supported Coins#

Coin FamilyCoinDerivation Path
BTCBTCRegular address:
m/44'/0'/0/0'/0
SegWit:
m/49'/0'/0/0'/0
m/84'/0'/0/0'/0
m/86'/0'/0/0'/0
BTCBCHm/44'/145'/0'/0/0
BTCBSVm/44'/236'/0'/0/0
BTCLTCm/44'/2'/0'/0/0
BTCDogem/44'/3'/0'/0/0
BTCTBTCm/44'/0'/0/0'/0
BTCOmni USDTm/44'/0'/0/0'/0
ETHETHm/44'/60'/0'/0/0
ETHArbitrum Onem/44'/60'/0'/0/0
ETHArbitrum Novam/44'/60'/0'/0/0
ETHAvalanche Cm/44'/60'/0'/0/0
ETHBobam/44'/60'/0'/0/0
ETHBNB Chainm/44'/60'/0'/0/0
ETHBasem/44'/60'/0'/0/0
ETHCorem/44'/60'/0'/0/0
ETHCronos(EVM)m/44'/60'/0'/0/0
ETHCelom/44'/60'/0'/0/0
ETHConflux(EVM)m/44'/60'/0'/0/0
ETHEndurancem/44'/60'/0'/0/0
ETHEthereumPoWm/44'/60'/0'/0/0
ETHEthereumFairm/44'/60'/0'/0/0
ETHFilecoin EVMm/44'/60'/0'/0/0
ETHFantomm/44'/60'/0'/0/0
ETHFlarem/44'/60'/0'/0/0
ETHGnosism/44'/60'/0'/0/0
ETHGoerlim/44'/60'/0'/0/0
ETHHAQQ Networkm/44'/60'/0'/0/0
ETHKlaytnm/44'/60'/0'/0/0
ETHKCCm/44'/60'/0'/0/0
ETHKava EVMm/44'/60'/0'/0/0
ETHLineam/44'/60'/0'/0/0
ETHMetism/44'/60'/0'/0/0
ETHMoonebeamm/44'/60'/0'/0/0
ETHMoonriverm/44'/60'/0'/0/0
ETHMantlem/44'/60'/0'/0/0
ETHOmega Networkm/44'/60'/0'/0/0
ETHOKTCm/44'/60'/0'/0/0
ETHOptimismm/44'/60'/0'/0/0
ETHopBNBm/44'/60'/0'/0/0
ETHPolygonm/44'/60'/0'/0/0
ETHPolygon zkEVMm/44'/60'/0'/0/0
ETHPulseChainm/44'/60'/0'/0/0
ETHSepoliam/44'/60'/0'/0/0
ETHzkSync Eram/44'/60'/0'/0/0
ETHZetaChianm/44'/60'/0'/0/0
CosmosAtomm/44'/118'/0'/0/0
CosmosAxelarm/44'/118'/0'/0/0
CosmosCronosm/44'/394'/0'/0/0
CosmosOsmosm/44'/118'/0'/0/0
CosmosEvmosm/44'/60'/0'/0/0
CosmosIrism/44'/118'/0'/0/0
CosmosJunom/44'/118'/0'/0/0
CosmosKavam/44'/459'/0'/0/0
CosmosKujiram/44'/118'/0'/0/0
CosmosSecretm/44'/529'/0'/0/0
CosmosSeim/44'/118'/0'/0/0
CosmosStargazem/44'/118'/0'/0/0
CosmosTerram/44'/330'/0'/0/0
AptosAptosm/44'/637'/0'/0/0
EOSEOSm/44'/194'/0'/0/0
SolanaSolanam/44'/501'/0'/0/0
StacksStacksm/44'/5757'/0'/0/0
ETH Layer 2Starknetm/44'/9004'/0'/0/0
SUISUIm/44'/784'/0'/0/0
TRXTRONm/44'/195'/0'/0/0
ETH Layer 2ZKSpacem/44'/60'/0'/0/0
ETH Layer 2zkSyncm/44'/60'/0'/0/0