Skip to content
starskiff

Instance

Lifecycle, parameters, events, and URL getters

Every instance is created by a definition (Instance.simd(parameters?, options?), …) and shares the same lifecycle API.

Parameters

Shared by all Cosmos chain instances (CosmosChainParameters):

ParameterTypeDefaultDescription
chainIdstring"starskiff-1"Chain ID
denomstring"stake"Default denom (bond, mint, gov, fees)
prefixstring"cosmos"Bech32 address prefix
accountsCosmosAccount[][]Genesis accounts
minimumGasPricesstring"0{denom}"app.toml minimum-gas-prices
validatorBalancestring"100000000000"Validator funding (amount only, denom appended)
validatorStakestring"10000000"Validator self-delegation
extraValidatorsnumber0Additional bonded validators
rpcPortnumber26657CometBFT RPC port
grpcPortnumber9090gRPC port
apiPortnumber1317REST API port
p2pPortnumber26656P2P port
grpcWebPortnumber9091gRPC-Web port
pprofPortnumber6060pprof port
relayerHintsCosmosRelayerHintsinstance-specificHermes address-derivation hints
imagestringinstance-specificRun the node from a container image instead of a PATH binary — see the container runtime

EVM chains (CosmosEvmChainParameters) add:

ParameterTypeDefaultDescription
evmPortnumber8545EVM JSON-RPC port
activeStaticPrecompilesstring[]instance-specificevm.params.active_static_precompilesthree-state semantics

Options (second argument)

The call contract is positional and does not inspect object keys: the first argument is always definition parameters, and the second is always lifecycle options. This means a custom parameter named timeout or messageBuffer remains a parameter.

OptionTypeDefaultDescription
messageBuffernumber20Max messages stored in memory
timeoutnumber60000Start/stop timeout in milliseconds
const instance = Instance.simd({ chainId: 'test-1' }, { timeout: 30_000 });

As an uncommon edge case, a parameterless custom definition can still receive lifecycle options. Pass undefined only to leave the parameter position empty:

const custom = Instance.define(() => ({
  name: 'custom',
  host: 'localhost',
  port: 3000,
  async start() {},
  async stop() {},
}));
 
const instance = custom(undefined, { timeout: 30_000 });

Methods

MethodDescription
start()Boot the node; resolves after the first block (EVM chains also wait for JSON-RPC). Returns a stop function.
stop()Kill the process and delete the temp home directory.
restart()Stop then start.
on(event, handler)Listen to events: message, stdout, stderr, listening, exit.
off(event, handler)Remove a listener.

Properties

PropertyTypeDescription
statusstringidle / starting / started / stopping / stopped / restarting
hoststringHost (default localhost)
portnumberRPC port
namestringInstance name
chainId / denom / prefixstringResolved chain config
messagesobject.get() returns buffered output lines, .clear() clears them

URL getters

No more templating http://localhost:${instance.port} by hand:

PropertyDescription
rpcUrlhttp://{host}:{port} — CometBFT RPC
grpcUrlhttp://{host}:{grpcPort} — gRPC
apiUrlhttp://{host}:{apiPort} — REST (Cosmos SDK API)
evmUrlhttp://{host}:{evmPort} — EVM JSON-RPC (EVM instances only)
import { StargateClient } from '@cosmjs/stargate';
 
const client = await StargateClient.connect(instance.rpcUrl);