Skip to content

Interop

Interop calls are the bridge between VM bytecode and native chain functionality. A script uses EXTCALL with a method name such as Runtime.TransferTokens or Data.Get, and the validator handles the real token, NFT, storage, or contract lifecycle operation in native code.

This page lists the interops the node implements and the names it rejects.

Runtime Context And Utility

MethodArgsStatusNotes
Runtime.GasTargetnoneimplementedReturns the gas target address for the current execution.
Runtime.ContextnoneimplementedRequires a real current context; rejects if context is not available yet.
Runtime.PreviousContextnoneimplementedReturns the parent context name.
Runtime.IsTriggernoneimplementedReturns whether the current execution is inside a trigger path.
Runtime.GenerateUIDnoneimplementedReturns an id that is unique within the execution.
Runtime.TimenoneimplementedReturns current block time as VM timestamp.
Runtime.VersionnoneimplementedReturns current VM behavior version.
Runtime.IsWitnessaddressimplementedReturns true if the address signed the transaction.
Runtime.LogmessageimplementedEmits a VM-side log line.
Runtime.NotifyeventKind, address, payloadimplementedRequires a real deployed contract context. The kind must be Custom_V2; any other kind fails with contract events must use Runtime.NotifyV2 (Custom_V2).
Runtime.NotifyV2name, address, payloadimplementedRequires a real deployed contract context. Emits an event with kind Custom_V2 that carries the event name. pha-tomb 2.2.0 and later compile emit to this call.

The node rejects these names:

  • Runtime.TransactionHash
  • Runtime.Validator
  • Runtime.Random
  • Runtime.SetSeed
  • Runtime.IsMinter
  • Runtime.AESEncrypt
  • Runtime.AESDecrypt

Contract Lifecycle

MethodArgsStatusNotes
Runtime.DeployContractfrom, contractName, script, abiimplementedDeploys a standalone custom contract. Requires minimal proof of work. Custom names are lowercase.
Runtime.UpgradeContractfrom, contractName, script, abiimplementedUpgrades an existing deployed contract. Also used later for token-backed contracts after they already exist. Requires minimal proof of work.
Runtime.KillContractfrom, contractNamenot implementedRejected.
Nexus.CreateTokenfrom, script, abiimplementedCreates a new token-backed contract from contract metadata. Requires minimal proof of work.
Nexus.AttachTokenContractfrom, symbol, script, abiimplementedAttaches VM code to an existing token. Requires minimal proof of work.

Important lifecycle rules:

  • Runtime.DeployContract is for standalone custom contracts, not uppercase token symbols.
  • Nexus.CreateToken is the install path for a new token-backed contract.
  • Nexus.AttachTokenContract is the install path for an existing token without VM code.
  • Runtime.UpgradeContract is the later update path for both standalone contracts and already-installed token-backed contracts.
  • Token-backed create and attach flows require a valid token contract shape. In practice, onMint is mandatory.

Fungible Token Operations

MethodArgsStatusNotes
Runtime.GetBalanceaddress, symbolimplementedReturns the current fungible balance.
Runtime.TransferTokenssource, destination, symbol, amountimplementedMain fungible transfer interop.
Runtime.TransferBalancesource, destination, symbolimplementedTransfers the full current balance for that symbol.
Runtime.MintTokenssource, destination, symbol, amountimplementedRuns onMint on a token-backed contract; the mint is applied only when the trigger succeeds.
Runtime.BurnTokensaddress, symbol, amountimplementedBurns a fungible amount.
Runtime.SwapTokens-not implementedRejected.

NFT And Token-Backed Operations

MethodArgsStatusNotes
Runtime.GetOwnershipsaddress, symbolimplementedNFT-only. Returns a deterministic BigInteger[]-style VM object of owned Phantasma NFT IDs.
Runtime.GetOwnershipsBySeriesaddress, symbol, seriesIDimplementedNFT-only. Like GetOwnerships, but limited to a single series.
Runtime.TransferTokensource, destination, symbol, tokenIDimplementedUses runtime-visible Phantasma NFT IDs, not raw Carbon instance IDs.
Runtime.MintTokensource, destination, symbol, rom, ram, seriesIDimplementedUses Phantasma series metadata IDs and preserves VM-facing ROM behavior. Triggers onMint when token-backed contract code exists.
Runtime.BurnTokensource, symbol, tokenIDimplementedNFT burn path.
Runtime.InfuseTokensource, targetSymbol, tokenID, infuseSymbol, valueimplementedSupported infuse path for token-backed NFT operations.
Runtime.ReadTokenROMsymbol, tokenIDimplementedReads runtime-visible ROM.
Runtime.ReadTokenRAMsymbol, tokenIDimplementedReads runtime-visible RAM.
Runtime.ReadTokensymbol, tokenID[, fields]implementedReturns a map-like VM object for requested fields. Defaults to chain,owner,creator,ROM,RAM,tokenID,seriesID,mintID,infusion.
Runtime.ReadInfusionssymbol, tokenIDimplementedRebuilds Phantasma-style infusion view from current Carbon balances.
Runtime.WriteTokenfrom, symbol, tokenID, ramimplementedUpdates NFT RAM by runtime-visible Phantasma NFT ID. Invokes onWrite before the native RAM update when a token-backed trigger exists.

Runtime.ReadToken and the other NFT interops identify an NFT by its public Phantasma NFT id. The internal instance id is a storage detail.

Runtime.WriteToken follows the same runtime-visible NFT ID rule. It replaces RAM bytes, accepts empty RAM to clear the RAM flag, does not change owner, ROM, or token supply, and rolls back the RAM update plus trigger storage writes if onWrite fails. Native token symbols and dangerous symbols are rejected. Without an onWrite trigger, the token owner must sign the transaction, or the token’s own contract must make the call.

Token Metadata And Discovery

MethodArgsStatusNotes
Runtime.TokenExistssymbolimplementedReturns false for unknown symbols instead of hard failing.
Runtime.GetTokenDecimalssymbolimplementedReads token decimals from current token metadata.
Runtime.GetTokenFlagssymbolimplementedReads current token flags.
Runtime.GetTokenOwnersymbolimplementedReturns the current token owner address object.

Runtime.GetTokenSupply and Runtime.GetAvailableTokenSymbols appear in older documentation but are not part of the current Carbon VM interop surface; calls to them are rejected.

NFT Series

MethodArgsStatusNotes
Nexus.CreateTokenSeriesfrom, symbol, seriesID, maxSupply, mode, script, abiimplementedUses Phantasma metadata _i for series identity and validates the caller before running onSeries.

Important notes:

  • series creation is separate from token creation or token attach
  • same-token token-backed series flows preserve both token identity and outer user witness where required
  • series metadata persists canonical Phantasma fields for later runtime use

Contract Storage

These are the storage primitives contract authors rely on most.

MethodArgsStatusNotes
Data.GetcontractName, field, vmTypeimplementedReads a contract scalar field and returns a typed default when missing.
Data.Setfield, valueimplementedWrites into the current deployed contract context only.
Data.DeletefieldimplementedDeletes a scalar field from the current deployed contract context.
Map.HascontractName, field, key, keyTypeimplementedChecks whether a map-style entry exists. The current implementation consumes the extra type argument for compatibility even though the existence check itself is key-based.
Map.GetcontractName, field, key, vmTypeimplementedReads a map entry and returns a typed default when missing.
Map.Setfield, key, valueimplementedUpdates table storage and keeps canonical entry counts.
Map.Removefield, keyimplementedRemoves an entry and updates count.
Map.CountcontractName, fieldimplementedReturns current entry count.
Map.ClearfieldimplementedDeletes all entries and resets count.
Map.KeyscontractName, fieldimplementedReturns a byte-array vector of current keys.
List.GetcontractName, field, index, vmTypeimplementedReads by zero-based index.
List.Addfield, valueimplementedAppends at the current tail index.
List.Replacefield, index, valueimplementedReplaces an existing list entry.
List.RemoveAtfield, indeximplementedUses compact swap-with-last semantics.
List.CountcontractName, fieldimplementedReturns current list length.
List.ClearfieldimplementedDeletes list entries and resets count.

Storage behavior notes:

  • write methods operate on the current deployed contract context, not an arbitrary named contract
  • read methods can target another contract by name
  • the node keeps an entry count per map and list field, and rejects storage whose count and entries disagree

Account And Constructor Helpers

MethodArgsStatusNotes
Account.NameaddressimplementedResolves a name through governance lookup.
Address()addressLikeimplementedBuilds or normalizes an address object.
Hash()hashLikeimplementedBuilds a hash object.
Timestamp()timestampLikeimplementedBuilds a timestamp value.

The node rejects these names:

  • Account.LastActivity
  • Account.Transactions
  • ABI()

Organization, Oracle, And Task Namespaces

The node rejects these names:

  • Organization.AddMember
  • Organization.RemoveMember
  • Organization.Kill
  • Oracle.Read
  • Oracle.Price
  • Oracle.Quote
  • Task.Start
  • Task.Stop
  • Task.Get
  • Task.Current
  • Nexus.GetGovernanceValue
  • Nexus.BeginInit
  • Nexus.EndInit
  • Nexus.MigrateToken
  • Nexus.CreateChain
  • Nexus.CreatePlatform
  • Nexus.CreateOrganization
  • Nexus.SetPlatformTokenHash

Developer Guidance

If you are writing new contracts today:

  • use Runtime.DeployContract and Runtime.UpgradeContract for standalone contracts
  • use Nexus.CreateToken, Nexus.AttachTokenContract, and later Runtime.UpgradeContract for token-backed contracts
  • rely on Data.*, Map.*, and List.* for persistent state
  • rely on Runtime.MintTokens, Runtime.TransferTokens, Runtime.MintToken, Runtime.TransferToken, Runtime.ReadToken, Runtime.WriteToken, and Nexus.CreateTokenSeries for current token and NFT flows
  • do not build contracts or examples around names the node rejects