Skip to content

C# RPC Methods

The methods of PhantasmaAPI. Use Public API Inventory when you need the complete list of public classes, methods, fields, and enum values.

Call Model

PhantasmaAPI wraps JSON-RPC calls with async methods. The constructor stores the RPC endpoint URL in Host and uses either the supplied RpcClient or an owned internal client:

public PhantasmaAPI(string host, RpcClient? rpcClient = null, string? apiKey = null)

apiKey is sent as the X-Api-Key header on every request. It is used only when this wrapper creates its own RpcClient.

Most read methods return Task<T?>. Methods that adapt paginated RPC responses return tuples or CursorPaginatedResult<T>. Methods that broadcast transactions return the transaction hash text returned by the node.

RpcClient generates a per-request JSON-RPC id, rejects missing or mismatched response ids, rejects responses that omit result, and enforces RpcClient.DefaultMaxResponseBytes, 16 MiB. The constructor accepts maxResponseBytes when a caller needs a different positive limit.

Result Models

PhantasmaAPI methods decode node responses into models under PhantasmaPhoenix.RPC.Models.

ModelFields and helpers
AccountInfoResultAddress, Name, Stake
AccountResultAddress, Name, Stakes, Stake, Unclaimed, optional Relay, Validator, Storage, Balances, optional Txs
BlockResultHash, PreviousHash, Timestamp, Height, ChainAddress, Protocol, Txs, ValidatorAddress, optional ProducerAddress, Reward, optional Events, optional Oracles
EventResultAddress, Contract, Kind, Name, Data
GasConfigResultGasModelVersion, optional GasConfig of type GasConfigDataResult, BlockRateTarget, ExpiryWindow, optional UnitsPerBlockDataByte, and ToGasConfig()
EstimateTransactionResultWouldAbort, optional AbortReason, GasBillKcalBase, DataRows, DataEscrowAtoms, DataRefundAtoms, RecommendedMaxGas, RecommendedMaxData, and ToFeeQuote()
TransactionResultHash, ChainAddress, Timestamp, BlockHeight, BlockHash, Script, CarbonTxType, CarbonTxData, Payload, optional DebugComment, Events, ExtendedEvents, Result, Fee, State, optional Signatures, Sender, GasPayer, GasTarget, GasPrice, GasLimit, Expiration
ScriptResultEvents, optional Result, optional Error, Results, Oracles, optional State, optional Gas
TokenResulttoken definition fields, optional Script, Series, CarbonId, optional Metadata, optional TokenSchemas, optional External, optional Price, and token-flag helpers
TokenSeriesResultSeriesId, carbonTokenId, carbonSeriesId, OwnerAddress, MaxMint, MintCount, CurrentSupply, MaxSupply, optional BurnedSupply, optional Mode, optional Script, optional Methods, Metadata
TokenDataResultNFT id, series, Carbon identifiers, owner/creator, ROM/RAM, status, infusion, and properties
TokenPropertyResultKey, and Value of type VmValue
VmValueA value decoded from VM storage: Text for a scalar, Items for an array, Fields for a struct

At most one of Text, Items and Fields is set. A scalar whose content the producer could not read carries none of them and arrives as JSON null, so a consumer reading Text has to handle null. That state is real chain data: a shared-ROM NFT property can have no string content, and it is still answered so that its key does not disappear.

On the wire a VmValue is the plain JSON value, which is a string, an array or an object. The shape itself says which of the three it is. Scalars are always Text, because chain numbers are big integers and JSON numbers lose precision above 2^53. Byte values arrive as hex. Reading a scalar stays a string assignment, through the implicit conversion the type declares.

For a contract event, Kind is Custom_V2 and Name is the event name the contract declared. For every other event, Name repeats Kind.

Accounts

MethodRPC methodUse it whenReturn
GetAccountInfoAsync(account)getAccountInfoReading the account name and staking info of one address.Task<AccountInfoResult?>
GetAccountInfosAsync(accounts)getAccountInfosReading the same record for up to 100 addresses in one call.Task<AccountInfoResult[]?>
GetAccountAsync(address)getAccountDeprecated. Reading one account with default address validation.Task<AccountResult?>
GetAccountAsync(address, extended, checkAddressReservedByte, addressType)getAccountDeprecated. Reading one account with explicit address validation and address type.Task<AccountResult?>
GetAccountsAsync(addresses)getAccountsDeprecated. Reading several accounts in one request. The SDK joins the array with commas.Task<AccountResult[]?>
GetAccountsAsync(addresses, extended, checkAddressReservedByte, addressType)getAccountsDeprecated. Reading several accounts with explicit address options.Task<AccountResult[]?>
LookUpNameAsync(name)lookUpNameResolving a registered name to address text.Task<string?>
GetAccountFungibleTokensAsync(...)getAccountFungibleTokensListing fungible balances owned by an account with optional symbol, Carbon token id, cursor, and address checks.Task<CursorPaginatedResult<BalanceResult[]>?>
GetAccountNFTsAsync(...)getAccountNFTsListing NFT instances owned by an account with optional token, series, cursor, and extended-property flags.Task<CursorPaginatedResult<TokenDataResult[]>?>
GetAccountOwnedTokensAsync(...)getAccountOwnedTokensListing NFT token definitions for which the account owns at least one instance.Task<CursorPaginatedResult<TokenResult[]>?>
GetAccountOwnedTokenSeriesAsync(...)getAccountOwnedTokenSeriesListing NFT series for which the account owns at least one instance.Task<CursorPaginatedResult<TokenSeriesResult[]>?>

The account cursor methods also expose overloads that accept RpcAddressType. Use those overloads when the caller is working with non-default address families or wants reserved-byte validation to be explicit.

GetAccountAsync and GetAccountsAsync are marked obsolete. 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. Use GetAccountInfoAsync with the cursor methods.

The cursor methods accept a pageSize of 1 to 100. The NFT methods accept 1 to 50 when extended is true. The node rejects anything outside the range.

Auctions And Blocks

MethodRPC methodUse it whenReturn
GetAuctionsCountAsync(chainAddressOrName, symbol)getAuctionsCountCounting market auctions for one token on one chain.Task<int>
GetAuctionsAsync(chainAddressOrName, symbol, page, pageSize)getAuctionsReading one auction page. The SDK unwraps PaginatedResult<AuctionResult[]>.Task<(AuctionResult[]? result, uint page, uint total, uint totalPages)>
GetAuctionAsync(chainAddressOrName, symbol, id)getAuctionReading one auction by id.Task<AuctionResult?>
GetBlockHeightAsync(chain)getBlockHeightReading the latest height for a chain.Task<long>
GetBlockTransactionCountByHashAsync(chainAddressOrName, blockHash)getBlockTransactionCountByHashCounting transactions in a block by hash.Task<int>
GetBlockByHashAsync(blockHash)getBlockByHashReading a block by hash.Task<BlockResult?>
GetBlockByHeightAsync(chain, height)getBlockByHeightReading a block by chain and height.Task<BlockResult?>
GetLatestBlockAsync(chain)getLatestBlockReading the most recent block for a chain.Task<BlockResult?>
GetTransactionByBlockHashAndIndexAsync(chainAddressOrName, blockHash, index)getTransactionByBlockHashAndIndexReading one transaction from a known block position.Task<TransactionResult?>

GetBlockHeightAsync, GetBlockTransactionCountByHashAsync, and GetAuctionsCountAsync parse string RPC results into numeric values using InvariantCulture.

Chain, Contracts, And Metadata

MethodRPC methodUse it whenReturn
GetChainsAsync()getChainsListing chains. Current backend behavior is stubbed and returns an empty array.Task<ChainResult[]?>
GetChainAsync(name, extended)getChainReading one chain. Current backend behavior is stubbed and returns a default chain result.Task<ChainResult?>
GetContractAsync(contractName)getContractReading a main-chain contract by name. The SDK passes DomainSettings.RootChainName.Task<ContractResult?>
GetContractByAddressAsync(chainAddressOrName, contractAddress)getContractByAddressReading a contract by chain and address.Task<ContractResult?>
GetContractsAsync()getContractsListing main-chain contracts. The SDK passes DomainSettings.RootChainName.Task<ContractResult[]?>
GetLeaderboardAsync(name)getLeaderboardReading one leaderboard. Current backend behavior is stubbed and returns a default result.Task<LeaderboardResult?>
GetNexusAsync()getNexusReading nexus metadata. Current backend behavior is stubbed and returns a default result.Task<NexusResult?>
GetOrganizationAsync(name, includeMemberCount)getOrganizationReading one organization by name.Task<OrganizationResult?>
GetOrganizationsAsync(pageSize, cursor, includeMemberCount)getOrganizationsListing organizations with cursor pagination.Task<CursorPaginatedResult<OrganizationResult[]>?>
GetOrganizationMembersAsync(name, pageSize, cursor, includeMemberTime)getOrganizationMembersListing organization members with cursor pagination.Task<CursorPaginatedResult<OrganizationMemberResult[]>?>
GetOrganizationMemberAsync(name, address, checkAddressReservedByte, addressType)getOrganizationMemberChecking one address’s membership in an organization.Task<OrganizationMemberResult?>

Tokens And NFTs

MethodRPC methodUse it whenReturn
GetTokenAsync(symbol)getTokenReading token metadata by symbol.Task<TokenResult?>
GetTokenAsync(symbol, extended, carbonTokenId)getTokenReading token metadata by symbol or Carbon token id.Task<TokenResult?>
GetTokensAsync()getTokensListing tokens with default server options.Task<TokenResult[]?>
GetTokensAsync(extended, ownerAddress)getTokensListing tokens with extended data and optional owner filter.Task<TokenResult[]?>
GetTokensAsync(extended, ownerAddress, addressType)getTokensListing tokens with owner filter and explicit owner address type.Task<TokenResult[]?>
GetTokenSeriesAsync(symbol, carbonTokenId, pageSize, cursor)getTokenSeriesListing series for a token using cursor pagination.Task<CursorPaginatedResult<TokenSeriesResult[]>?>
GetTokenSeriesByIdAsync(symbol, carbonTokenId, seriesId, carbonSeriesId)getTokenSeriesByIdReading one series by either Phantasma series id or Carbon series id.Task<TokenSeriesResult?>
GetTokenNFTsAsync(carbonTokenId, carbonSeriesId, pageSize, cursor, extended, seriesId)getTokenNFTsListing NFTs for a Carbon token. seriesId is appended last for positional compatibility with older RPC servers.Task<CursorPaginatedResult<TokenDataResult[]>?>
GetTokenBalanceAsync(address, symbol, chain)getTokenBalanceReading one token balance.Task<BalanceResult?>
GetTokenBalanceAsync(address, symbol, chain, checkAddressReservedByte, addressType)getTokenBalanceReading one token balance with explicit address validation and address type.Task<BalanceResult?>
GetTokenDataAsync(symbol, tokenId)getTokenDataDeprecated. Reading token data for one token id. getNFT covers it entirely.Task<TokenDataResult?>
GetNFTAsync(symbol, tokenId, loadProperties)getNFTReading NFT data and optionally loading properties.Task<TokenDataResult?>
GetNFTsAsync(symbol, tokenIds, extended)getNFTsReading several NFT ids. The SDK joins ids with commas.Task<TokenDataResult[]?>

Transactions And Scripts

MethodRPC methodUse it whenReturn
GetAddressTransactionsAsync(address, page, pageSize)getAddressTransactionsReading transaction history for one address. The SDK unwraps PaginatedResult<AccountTransactionsResult>.Task<(AccountTransactionsResult? result, uint page, uint totalPages)>
GetAddressTransactionCountAsync(address, chain)getAddressTransactionCountCounting address transactions on one chain.Task<int>
GetTransactionAsync(txHash)getTransactionReading a transaction by hash.Task<TransactionResult?>
SendRawTransactionAsync(txData)sendRawTransactionBroadcasting a hex-encoded Phantasma transaction.Task<string?>
SendCarbonTransactionAsync(txData)sendCarbonTransactionBroadcasting a hex-encoded Carbon transaction.Task<string?>
InvokeRawScriptAsync(chain, scriptData)invokeRawScriptRunning a hex-encoded VM script without committing state.Task<ScriptResult?>
SignAndSendTransactionAsync(keys, nexus, script, chain, payload, customSignFunction, expiration)sendRawTransactionBuilding a Protocol.Transaction, signing it, broadcasting it, and checking the returned hash against the local hash.Task<string?>
SendTransactionAsync(msg, signers, options, cancellationToken)sendCarbonTransactionPlanning, pre-flighting, signing and broadcasting a Carbon message in one call.Task<string>

SignAndSendTransactionAsync throws if the RPC hash differs from the locally computed transaction hash. It signs the transaction bytes before signatures are attached, serializes with signatures, and broadcasts the hex string. Without expiration the transaction expires TxLimits.DefaultExpiryMs (45 seconds) after it is built; a flow that waits for a person should pass an expiration from TxLimits.ExpiryWithin.

SendTransactionAsync takes one ITxSigner, a list of them, one IKeyPair or an array of them. It plans a message whose maxGas is still zero, and refuses a token creation whose symbol the chain reports as taken.

Fees And Gas Configuration

MethodRPC methodUse it whenReturn
FeesnonePlanning fees against this chain. It is a ChainFeePlanner.ChainFeePlanner
GetGasConfigAsync()getGasConfigReading the on-chain gas configuration and the chain parameters.Task<GasConfigResult?>
EstimateTransactionAsync(txData)estimateTransactionDry-running a serialized envelope against current chain state.Task<EstimateTransactionResult?>
ControlTokenIdAsync()noneReading the gas token’s id, which the pre-flight uses as its control lookup.Task<ulong?>
InfusedAssetsAsync(tokenId, instanceId)severalReading what an NFT holds at its own address, which a burn plan requires.Task<IReadOnlyList<InfusedAsset>>

Storage And Validation

MethodRPC methodUse it whenReturn
GetArchiveAsync(hash)getArchiveReading archive metadata. Current backend behavior is stubbed and returns a default result.Task<ArchiveResult?>
WriteArchiveAsync(hash, blockIndex, blockContent)writeArchiveWriting one archive block. Current backend behavior is stubbed and returns false.Task<bool>
ReadArchiveAsync(hash, blockIndex)readArchiveReading one archive block. Current backend behavior is stubbed and returns an empty string.Task<string?>
IsValidPrivateKey(key)noneChecking the WIF shape used by the SDK helper.bool

IsValidPrivateKey checks for L or K WIF prefixes and length 52. Validate addresses with PhantasmaPhoenix.Cryptography.Address.IsValidAddress(text), which parses the text. Neither helper replaces chain-side validation.