Skip to content

Go SDK - Examples

For sample code which explains the core concepts of how to use the SDK, see:

Below are additional resources which may be more suited for your individual use case.

The examples folder in the SDK repository has many code snippets you can customize. These examples are part of the SDK’s CI surface.

ExampleDescription
transfer_coinBasic APT transfer between two accounts
orderless_transactionOrderless transfer with a replay-protection nonce
sponsored_transactionFee-payer sponsored transaction
multi_agentMulti-agent transaction with two signers
sending_concurrent_transactionsConcurrent submissions from one account
fungible_assetFungible asset transfer
onchain_multisigOn-chain multisig account flow
offchain_multisigOff-chain multisig signing
script_transactionScript payload construction
alternative_signingCustom / alternative signer
external_signingSign with an external signer

To run one of the example scripts:

  1. Clone the repository.

    Terminal window
    git clone https://github.com/aptos-labs/aptos-go-sdk.git
    cd aptos-go-sdk
  2. Run an example from the repository root. Go downloads module dependencies automatically.

    Terminal window
    go run examples/transfer_coin/main.go

The SDK requires Go 1.25+.

  • Integration tests - Broader flows that use the SDK against a live network.
  • Package tests - *_test.go files next to the implementation.
  • SDK source code - This has in-line comments explaining what each function does.
  • SDK reference docs - These are another way to view the in-line documentation with built-in search.