Skip to content

Go SDK API Overview

The packages of the Go SDK and their main types. The reference pages list every method, result field, wire structure and low-level helper.

Module

ItemValue
Modulegithub.com/phantasma-io/phantasma-sdk-go
Go1.25+
Current public tagv0.18.1

pkg/rpc

APIPurpose
NewRPC(endpoint)Create an RPC client for an explicit endpoint.
NewRPCMainnet() / NewRPCSetMainnet() / NewRPCTestnet()Create clients for public endpoint defaults.
PhantasmaRPC.Call(ctx, method, params...)Low-level JSON-RPC call for methods without typed wrappers.
Typed RPC wrappersAccount, block, transaction, token, series, NFT, archive, auction, contract, organization, VM config, and broadcast methods.
PhantasmaRPC.Fees()The fee planner of this chain. It caches the gas config and prices messages.
PhantasmaRPC.SendTransaction(...)Plans, pre-flights, signs and broadcasts a Carbon message in one call.
PreflightTransaction(...)Asks the chain whether a token creation’s symbol is already taken.
AddressTypePhantasma, AddressTypeCarbonAddress interpretation selectors for wrappers that expose node address-type parameters.

Details: RPC Client.

pkg/rpc/response

APIPurpose
Result structsAccountResult, BalanceResult, TransactionResult, TokenResult, TokenDataResult, TokenSeriesResult, ScriptResult, and related chain models.
PaginationPaginatedResult[T], CursorPaginatedResult[T].
HelpersDecimal formatting, token flag checks, account balance lookup, transaction state helpers, and VM result decoding.

Details: RPC Result Models.

pkg/cryptography

APIPurpose
PhantasmaKeysEd25519 key pair with generation, WIF import/export, address derivation, and signing.
AddressChecked Phantasma address parsing, formatting, and null address helpers.
Ed25519SignatureSignature wrapper and verification.
HashChecked 32-byte hash wrapper and difficulty helper.

Details: VM and Transaction APIs.

pkg/vm/script_builder And pkg/blockchain

APIPurpose
ScriptBuilderVM bytecode builder with generic contract/interop calls and high-level gas/transfer/stake helpers.
TransactionScript transaction with serialization and signing.
TxStateIsSuccess, TxStateIsFaultHelpers for finalized transaction state strings.

Details: VM and Transaction APIs.

pkg/carbon

APIPurpose
Writer, Reader, Serialize, DeserializeCarbon wire-format primitives.
Bytes16, Bytes32, Bytes64, SmallString, IntXChecked Carbon primitive types.
TokenInfo, SeriesInfo, TokenSchemas, TxMsg, SignedTxMsg, WitnessCarbon token, schema, transaction, and signing structures.
Lifecycle buildersCreate token, create series and Phantasma NFT mint builders.
Native buildersTransfers, mints and burns, which need no VM script.
Schemas and metadataPrepareStandardTokenSchemas, TokenSchemasFromJSON, BuildTokenSchemasFromFields, BuildTokenMetadata, BuildTokenSeriesMetadata, BuildSeriesInfo, BuildPhantasmaNFTRom, BuildNFTRom.
NFT addressesGetNFTAddress, UnpackNFTAddress, IsNFTAddress, UnpackNFTInstanceID.
Module callsToken module argument structs, the market module (MarketSellTokenArgs and the rest), the governance module (RegisterNameArgs), and the configuration structures ChainConfig, GasConfig, TokensConfig, MarketConfig.
Fee planningPlanFees, FeePlan, FeePlanOptions, SummarizeFeePlan, TxLimits, ExpiryWithin, BurnedInstances.
SigningTxSigner, KeyPairSigners, SignTxMsg, SignTxMsgWith.
Result parsersCreate token, create series, NFT mint and Phantasma NFT mint result parsers.

Details: Carbon API and Wire Format.

Other Packages

PackageHolds
pkg/vmOpcodes, VMType, and VMObject, which decodes the values of a script result.
pkg/utilConvertDecimals and ConvertDecimalsBack between atoms and decimal text, and the byte forms of big integers.
pkg/encoding/base58Base58 with and without the 4-byte checksum.
pkg/ioThe binary reader and writer of script transactions and event data, and Deserialize[T].
pkg/jsonrpcThe JSON-RPC transport and RPCError.
pkg/domain/eventEvent kinds and the data types of events, such as TokenEventData.
pkg/domainSDKVersion and SDKPayload.
pkg/domain/contract, pkg/domain/token, pkg/domain/stake, pkg/domain/typesModels of contract interfaces, token definitions, stakes and timestamps.
pkg/cryptography/ecdsa, pkg/cryptography/proofOfAddresssecp256k1 and secp256r1 signatures, and the check of a message signed by Phantasma, Ethereum and NEO Legacy keys.

Fees

Under gas model v2 the chain bills every byte a transaction puts in the block, and it escrows every new storage row. Builders carry no prices, so a message is planned before it is signed.