Skip to content

Unity RPC Methods

The coroutines of PhantasmaAPI. Use Public API Inventory when you need every public runtime symbol.

Coroutine Model

PhantasmaAPI is constructed with an RPC host URL:

public PhantasmaAPI(string host, string apiKey = null);

apiKey is sent as the X-Api-Key header on every RPC request.

RPC methods return IEnumerator and should be executed with StartCoroutine(...). Data is delivered through callbacks. Most methods accept these optional parameters after the success callback:

Action<EPHANTASMA_SDK_ERROR_TYPE, string> errorHandlingCallback = null;
int timeout = WebClient.DefaultTimeout;
int retries = WebClient.DefaultRetries;

WebClient.RPCRequest<T> assigns a generated JSON-RPC id and TryDecodeRpcResponse<T> rejects missing or mismatched response ids, JSON-RPC error objects, missing result, and result values that cannot be decoded into the requested callback type. These failures are delivered through the error callback.

Accounts

Method familyUse it whenCallback
GetAccountInfoReading the account name and staking info of one address. Overloads allow reserved-byte checks and RpcAddressType.Action<AccountInfoResult>
GetAccountInfosReading the same record for up to 100 addresses in one call.Action<AccountInfoResult[]>
GetAccountObsolete. Reading one account by address text. Overloads allow extended, reserved-byte checks, and RpcAddressType.Action<AccountResult>
GetAccountsObsolete. Reading several accounts. The SDK sends a comma-separated address list.Action<AccountResult[]>
LookUpNameResolving a registered name to address text.Action<string>
GetAccountFungibleTokensListing fungible balances owned by an account. Overloads accept symbol, Carbon token id, page size, cursor, address checks, and address type.Action<CursorPaginatedResult<BalanceResult[]>>
GetAccountNFTsListing NFT instances owned by an account. Overloads accept symbol, Carbon token id, Carbon series id, page size, cursor, extended, address checks, and address type.Action<CursorPaginatedResult<TokenDataResult[]>>
GetAccountOwnedTokensListing NFT token definitions for which the account owns at least one instance.Action<CursorPaginatedResult<TokenResult[]>>
GetAccountOwnedTokenSeriesListing NFT series for which the account owns at least one instance.Action<CursorPaginatedResult<TokenSeriesResult[]>>

GetAccountInfo costs the same whatever the address holds. GetAccount and GetAccounts are obsolete, because their response embeds every NFT id the address owns and the node caps each Balances[].Ids list at 10000 entries while Balances[].Amount keeps the true count.

The cursor methods accept a pageSize of 1 to 100. The NFT methods accept 1 to 50 when extended is true.

Auctions And Blocks

MethodUse it whenCallback
GetAuctionsCount(chainAddressOrName, symbol, ...)Counting auctions for a token on one chain.Action<int>
GetAuctions(chainAddressOrName, symbol, page, pageSize, ...)Reading one auction page.Action<AuctionResult[], uint, uint, uint>
GetAuction(chainAddressOrName, symbol, IDtext, ...)Reading one auction by id.Action<AuctionResult>
GetBlockHeight(chainInput, ...)Reading the latest block height for a chain.Action<long>
GetBlockTransactionCountByHash(blockHash, ...)Counting transactions in a main-chain block by hash.Action<int>
GetBlockTransactionCountByHash(chainAddressOrName, blockHash, ...)Counting transactions in a chain-specific block by hash.Action<int>
GetBlockByHash(blockHash, ...)Reading a block by hash.Action<BlockResult>
GetBlockByHeight(chainInput, height, ...)Reading a block by chain and height.Action<BlockResult>
GetLatestBlock(chainInput, ...)Reading the latest block for a chain.Action<BlockResult>
GetTransactionByBlockHashAndIndex(blockHash, index, ...)Reading one transaction by main-chain block hash and index.Action<TransactionResult>
GetTransactionByBlockHashAndIndex(chainAddressOrName, blockHash, index, ...)Reading one transaction by chain, block hash, and index.Action<TransactionResult>

Chain, Contracts, And Metadata

MethodBackend statusCallback
GetChainsStubbed chain query; returns an empty array.Action<ChainResult[]>
GetContract(contractName, ...)Reads main-chain contract metadata by name.Action<ContractResult>
GetContractsLists main-chain contracts.Action<ContractResult[]>
GetLeaderboard(name, ...)Stubbed leaderboard query; returns a default result.Action<LeaderboardResult>
GetNexusStubbed nexus query; returns a default result.Action<NexusResult>
GetOrganization(name, includeMemberCount, ...)Reads one organization by name.Action<OrganizationResult>
GetOrganizations(pageSize, cursor, includeMemberCount, ...)Lists organizations with cursor pagination.Action<CursorPaginatedResult<OrganizationResult[]>>
GetOrganizationMembers(name, pageSize, cursor, includeMemberTime, ...)Lists organization members with cursor pagination.Action<CursorPaginatedResult<OrganizationMemberResult[]>>
GetOrganizationMember(name, address, checkAddressReservedByte, addressType, ...)Checks one address’s membership in an organization.Action<OrganizationMemberResult>

Tokens And NFTs

Method familyUse it whenCallback
GetTokenReading token metadata by symbol or by symbol plus Carbon token id options.Action<TokenResult>
GetTokensListing token metadata. Overloads allow extended, owner address, and RpcAddressType.Action<TokenResult[]>
GetTokenSeriesListing token series with cursor pagination.Action<CursorPaginatedResult<TokenSeriesResult[]>>
GetTokenSeriesByIdReading one series by Phantasma series id or Carbon series id.Action<TokenSeriesResult>
GetTokenNFTsListing NFTs for a Carbon token and optional series filters.Action<CursorPaginatedResult<TokenDataResult[]>>
GetTokenDataDeprecated. Reading token data by symbol and id. GetNFT covers it entirely.Action<TokenDataResult>
GetNFTReading one NFT and optionally loading properties.Action<TokenDataResult>
GetNFTsReading several NFT ids.Action<TokenDataResult[]>
GetTokenBalanceReading one token balance. Overloads allow address checks and RpcAddressType.Action<BalanceResult>

Transactions And Scripts

MethodUse it whenCallback
GetAddressTransactions(addressText, page, pageSize, ...)Reading transaction history for an address.Action<AccountTransactionsResult, uint, uint>
GetAddressTransactionCount(addressText, chainInput, ...)Counting transactions for an address on one chain.Action<int>
SendRawTransaction(txData, txHash, ...)Broadcasting a hex-encoded Phantasma transaction and checking the expected Hash.Action<string, string, Hash>
SendCarbonTransaction(txData, ...)Broadcasting a hex-encoded Carbon transaction.Action<string, string>
InvokeRawScript(chainInput, scriptData, ...)Running a hex-encoded VM script without committing state.Action<ScriptResult>
GetTransaction(hashText, ...)Reading a transaction by hash.Action<TransactionResult>
SignAndSendTransaction(keys, nexus, script, chain, payload, ...)Building, signing, serializing, and broadcasting a Phantasma VM transaction.Action<string, string>
SignAndSendCarbonTransaction(keys, txMsg, ...)Planning the fee, signing and broadcasting a Carbon TxMsg.Action<string, string>
SignAndSendCarbonTransaction(keys[], txMsg, options, ..., preflight)The same with several witnesses, fee-plan options and an optional pre-flight.Action<string, string>
PlanCarbonTransaction(keys[], txMsg, options, ...)Pricing a Carbon message without signing it.Action<FeePlan>

The SignAndSendTransaction overloads accept string or byte-array payloads. The byte-array overload also accepts customSignFunction. Without expiration the transaction expires TxLimits.DefaultExpiryMs (45 seconds) after it is built, the same lifetime a Carbon message gets; a flow that waits for a person should pass an expiration from TxLimits.ExpiryWithin.

Fees And Gas Configuration

MethodUse it whenCallback
GetGasConfig(...)Reading the on-chain gas configuration and the chain parameters.Action<GasConfigResult>
EstimateTransaction(txData, ...)Dry-running a serialized envelope against current chain state.Action<EstimateTransactionResult>

GetGasConfig changes only through a governance resolution, so the result is safe to cache. EstimateTransaction answers a standard RPC error on a node with the estimate service switched off.

Storage And Validation

MethodBackend statusCallback
GetArchive(hashText, ...)Stubbed archive query; returns a default result.Action<ArchiveResult>
WriteArchive(hashText, blockIndex, blockContent, ...)Stubbed archive write; returns false.Action<Boolean>
ReadArchive(hashText, blockIndex, ...)Stubbed archive read; returns an empty string.Action<string>
IsValidPrivateKey(key)Local WIF shape check.bool

IsValidPrivateKey checks for L or K WIF prefixes and length 52. Validate addresses with PhantasmaPhoenix.Cryptography.Address.IsValidAddress(text), which parses the text. Chain-side validation is still authoritative.