> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therootnetwork.com/llms.txt
> Use this file to discover all available pages before exploring further.

# System

## Calls

### fillBlock

A dispatch that will fill the block weight up to the given ratio.

**Namespace**

```
api.tx.system.fillBlock
```

**Type**

```
function fillBlock(
  ratio: Perbill
)
```

### killPrefix

Kill all storage items with a key that starts with the given prefix.

**NOTE:** We rely on the Root origin to provide us the number of subkeys under the prefix we are removing to accurately calculate the weight of this function.

**Namespace**

```
api.tx.system.killPrefix
```

**Type**

```
function killPrefix(
  prefix: Bytes,
  subkeys: u32
)
```

### killStorage

Kill some items from storage.

**Namespace**

```
api.tx.system.killStorage
```

**Type**

```
function killStorage(
  keys: Vec<Bytes>
)
```

### remark

Make some on-chain remark.

**Namespace**

```
api.tx.system.remark
```

**Type**

```
function remark(
  remark: Bytes
)
```

### remarkWithEvent

Make some on-chain remark and emit event.

**Namespace**

```
api.tx.system.remarkWithEvent
```

**Type**

```
function remarkWithEvent(
  remark: Bytes
)
```

**Usage**

system.remarkWithEvent along with utitity.batch call can be used to track an extrinsic.

```
    const rootWSEndpoint = "wss://porcini.rootnet.app/ws";
    const provider = new WsProvider(rootWSEndpoint);
    const api = await ApiPromise.create({
                                    noInitWarn: true,
                                    provider,
                                    types: {
                                        AccountId: "EthereumAccountId",
                                        AccountId20: "EthereumAccountId",
                                        AccountId32: "EthereumAccountId",
                                        Address: "AccountId",
                                        LookupSource: "AccountId",
                                        Lookup0: "AccountId"
                                        }
                                    });
    // Transfer xrp and system remark
	const calls = [
		api.tx.assets.transfer(assetId, destination, amount),
		api.tx.system.remarkWithEvent('Project id 1234')
	];
	logger.info(
		{
			parameters: [...calls],
		},
		`create a "utility.batch" extrinsic`
	);
	const extrinsic = api.tx.utility.batch(calls);
    // Sign and Send the transaction
    await extrinsic.signAndSend(ALICE, {nonce}, ({ events = [], status }) => {
      if (status.isInBlock) {
        console.log('Successful transfer of ' + randomAmount + ' with hash ' + status.asInBlock.toHex());
      } else {
        console.log('Status of transfer: ' + status.type);
      }

       // This should emit 'system.Remarked' event with the event data hashed.
       // To check the hashed value, can go to https://portal.rootnet.live/?rpc=wss%3A%2F%2Froot.rootnet.live%2Farchive%2Fws#/signing and add the event data
      events.forEach(({ phase, event: { data, method, section } }) => {
        console.log(phase.toString() + ' : ' + section + '.' + method + ' ' + data.toString());
      });
    });

```

### setCode

Set the new runtime code.

**Namespace**

```
api.tx.system.setCode
```

**Type**

```
function setCode(
  code: Bytes
)
```

### setCodeWithoutChecks

Set the new runtime code without doing any checks of the given `code`.

**Namespace**

```
api.tx.system.setCodeWithoutChecks
```

**Type**

```
function setCodeWithoutChecks(
  code: Bytes
)
```

### setHeapPages

Set the number of pages in the WebAssembly environment's heap.

**Namespace**

```
api.tx.system.setHeapPages
```

**Type**

```
function setHeapPages(
  pages: u64
)
```

### setStorage

Set some items of storage.

**Namespace**

```
api.tx.system.setStorage
```

**Type**

```
function setStorage(
  items: Vec<(Bytes,Bytes)>
)
```

## Storage

### account

The full account information for a particular account ID.

**Namespace**

```
api.query.system.account
```

**Type**

```
function account(
  SeedPrimitivesSignatureAccountId20
): FrameSystemAccountInfo
```

### allExtrinsicsLen

Total length (in bytes) for all extrinsics put together, for the current block.

**Namespace**

```
api.query.system.allExtrinsicsLen
```

**Type**

```
function allExtrinsicsLen(

): Option<u32>
```

### blockHash

Map of block numbers to block hashes.

**Namespace**

```
api.query.system.blockHash
```

**Type**

```
function blockHash(
  u32
): H256
```

### blockWeight

The current weight for the block.

**Namespace**

```
api.query.system.blockWeight
```

**Type**

```
function blockWeight(

): FrameSupportDispatchPerDispatchClassWeight
```

### digest

Digest of the current block, also part of the block header.

**Namespace**

```
api.query.system.digest
```

**Type**

```
function digest(

): SpRuntimeDigest
```

### eventCount

The number of events in the `Events<T>` list.

**Namespace**

```
api.query.system.eventCount
```

**Type**

```
function eventCount(

): u32
```

### events

Events deposited for the current block.

NOTE: The item is unbound and should therefore never be read on chain. It could otherwise inflate the PoV size of a block.

Events have a large in-memory size. Box the events to not go out-of-memory just in case someone still reads them from within the runtime.

**Namespace**

```
api.query.system.events
```

**Type**

```
function events(

): Vec<FrameSystemEventRecord>
```

### eventTopics

Mapping between a topic (represented by T::Hash) and a vector of indexes of events in the `<Events<T>>` list.

All topic vectors have deterministic storage locations depending on the topic. This allows light-clients to leverage the changes trie storage tracking mechanism and in case of changes fetch the list of events of interest.

The value has the type `(T::BlockNumber, EventIndex)` because if we used only just the `EventIndex` then in case if the topic has the same contents on the next block no notification will be triggered thus the event might be lost.

**Namespace**

```
api.query.system.eventTopics
```

**Type**

```
function eventTopics(
  H256
): Vec<(u32,u32)>
```

### executionPhase

The execution phase of the block.

**Namespace**

```
api.query.system.executionPhase
```

**Type**

```
function executionPhase(

): Option<FrameSystemPhase>
```

### extrinsicCount

Total extrinsics count for the current block.

**Namespace**

```
api.query.system.extrinsicCount
```

**Type**

```
function extrinsicCount(

): Option<u32>
```

### extrinsicData

Extrinsics data for the current block (maps an extrinsic's index to its data).

**Namespace**

```
api.query.system.extrinsicData
```

**Type**

```
function extrinsicData(
  u32
): Bytes
```

### lastRuntimeUpgrade

Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened.

**Namespace**

```
api.query.system.lastRuntimeUpgrade
```

**Type**

```
function lastRuntimeUpgrade(

): Option<FrameSystemLastRuntimeUpgradeInfo>
```

### number

The current block number being processed. Set by `execute_block`.

**Namespace**

```
api.query.system.number
```

**Type**

```
function number(

): u32
```

### parentHash

Hash of the previous block.

**Namespace**

```
api.query.system.parentHash
```

**Type**

```
function parentHash(

): H256
```

### upgradedToTripleRefCount

True if we have upgraded so that AccountInfo contains three types of `RefCount`. False (default) if not.

**Namespace**

```
api.query.system.upgradedToTripleRefCount
```

**Type**

```
function upgradedToTripleRefCount(

): bool
```

### upgradedToU32RefCount

True if we have upgraded so that `type RefCount` is `u32`. False (default) if not.

**Namespace**

```
api.query.system.upgradedToU32RefCount
```

**Type**

```
function upgradedToU32RefCount(

): bool
```

## Events

### CodeUpdated

`:code` was updated.

**Namespace**

```
api.events.system.CodeUpdated
```

**Type**

```
type CodeUpdated = {

}
```

### ExtrinsicFailed

An extrinsic failed.

**Namespace**

```
api.events.system.ExtrinsicFailed
```

**Type**

```
type ExtrinsicFailed = {
  dispatch_error: SpRuntimeDispatchError,
  dispatch_info: FrameSupportDispatchDispatchInfo
}
```

### ExtrinsicSuccess

An extrinsic completed successfully.

**Namespace**

```
api.events.system.ExtrinsicSuccess
```

**Type**

```
type ExtrinsicSuccess = {
  dispatch_info: FrameSupportDispatchDispatchInfo
}
```

### KilledAccount

An account was reaped.

**Namespace**

```
api.events.system.KilledAccount
```

**Type**

```
type KilledAccount = {
  account: SeedPrimitivesSignatureAccountId20
}
```

### NewAccount

A new account was created.

**Namespace**

```
api.events.system.NewAccount
```

**Type**

```
type NewAccount = {
  account: SeedPrimitivesSignatureAccountId20
}
```

### Remarked

On on-chain remark happened.

**Namespace**

```
api.events.system.Remarked
```

**Type**

```
type Remarked = {
  sender: SeedPrimitivesSignatureAccountId20,
  hash: H256
}
```

## Errors

### CallFiltered

The origin filter prevent the call to be dispatched.

**Namespace**

```
api.errors.system.CallFiltered
```

### FailedToExtractRuntimeVersion

Failed to extract the runtime version from the new runtime.

Either calling `Core_version` or decoding `RuntimeVersion` failed.

**Namespace**

```
api.errors.system.FailedToExtractRuntimeVersion
```

### InvalidSpecName

The name of specification does not match between the current runtime and the new runtime.

**Namespace**

```
api.errors.system.InvalidSpecName
```

### NonDefaultComposite

Suicide called when the account has non-default composite data.

**Namespace**

```
api.errors.system.NonDefaultComposite
```

### NonZeroRefCount

There is a non-zero reference count preventing the account from being purged.

**Namespace**

```
api.errors.system.NonZeroRefCount
```

### SpecVersionNeedsToIncrease

The specification version is not allowed to decrease between the current runtime and the new runtime.

**Namespace**

```
api.errors.system.SpecVersionNeedsToIncrease
```

## Constants

### blockHashCount

Maximum number of block number to block hash mappings to keep (oldest pruned first).

**Namespace**

```
api.consts.system.blockHashCount
```

**Type**

```
type blockHashCount = u32
```

### blockLength

The maximum length of a block (in bytes).

**Namespace**

```
api.consts.system.blockLength
```

**Type**

```
type blockLength = FrameSystemLimitsBlockLength
```

### blockWeights

Block & extrinsics weights: base values and limits.

**Namespace**

```
api.consts.system.blockWeights
```

**Type**

```
type blockWeights = FrameSystemLimitsBlockWeights
```

### dbWeight

The weight of runtime database operations the runtime can invoke.

**Namespace**

```
api.consts.system.dbWeight
```

**Type**

```
type dbWeight = SpWeightsRuntimeDbWeight
```

### ss58Prefix

The designated SS58 prefix of this chain.

This replaces the "ss58Format" property declared in the chain spec. Reason is that the runtime should know about the prefix in order to make use of it as an identifier of the chain.

**Namespace**

```
api.consts.system.ss58Prefix
```

**Type**

```
type ss58Prefix = u16
```

### version

Get the chain's current version.

**Namespace**

```
api.consts.system.version
```

**Type**

```
type version = SpVersionRuntimeVersion
```

## JSON-RPC Methods

### `accountNextIndex`

Retrieves the next accountIndex as available on the node

**Interface**

```
api.rpc.system.accountNextIndex(accountId: AccountId): Index
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_accountNextIndex", "params":[accountId: AccountId] }
```

### `addLogFilter`

Adds the supplied directives to the current log filter

<Info> This method is only active with appropriate flags </Info>

**Interface**

```
api.rpc.system.addLogFilter(directives: Text): Null
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_addLogFilter", "params":[directives: Text] }
```

### `addReservedPeer`

Adds a reserved peer

<Info> This method is only active with appropriate flags </Info>

**Interface**

```
api.rpc.system.addReservedPeer(peer: Text): Text
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_addReservedPeer", "params":[peer: Text] }
```

### `chain`

Retrieves the chain

**Interface**

```
api.rpc.system.chain(): Text
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_chain", "params":[] }
```

### `chainType`

Retrieves the chain type

**Interface**

```
api.rpc.system.chainType(): ChainType
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_chainType", "params":[] }
```

### `dryRun`

Dry run an extrinsic at a given block

<Info> This method is only active with appropriate flags </Info>

**Interface**

```
api.rpc.system.dryRun(extrinsic: Bytes, at?: BlockHash): ApplyExtrinsicResult
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_dryRun", "params":[extrinsic: Bytes, at?: BlockHash] }
```

### `health`

Return health status of the node

**Interface**

```
api.rpc.system.health(): Health
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_health", "params":[] }
```

### `localListenAddresses`

The addresses include a trailing /p2p/ with the local PeerId, and are thus suitable to be passed to addReservedPeer or as a bootnode address for example

**Interface**

```
api.rpc.system.localListenAddresses(): Vec<Text>
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_localListenAddresses", "params":[] }
```

### `localPeerId`

Returns the base58-encoded PeerId of the node

**Interface**

```
api.rpc.system.localPeerId(): Text
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_localPeerId", "params":[] }
```

### `name`

Retrieves the node name

**Interface**

```
api.rpc.system.name(): Text
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_name", "params":[] }
```

### `nodeRoles`

Returns the roles the node is running as

**Interface**

```
api.rpc.system.nodeRoles(): Vec<NodeRole>
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_nodeRoles", "params":[] }
```

### `peers`

Returns the currently connected peers

<Info> This method is only active with appropriate flags </Info>

**Interface**

```
api.rpc.system.peers(): Vec<PeerInfo>
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_peers", "params":[] }
```

### `properties`

Get a custom set of properties as a JSON object, defined in the chain spec

**Interface**

```
api.rpc.system.properties(): ChainProperties
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_properties", "params":[] }
```

### `removeReservedPeer`

Remove a reserved peer

<Info> This method is only active with appropriate flags </Info>

**Interface**

```
api.rpc.system.removeReservedPeer(peerId: Text): Text
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_removeReservedPeer", "params":[peerId: Text] }
```

### `reservedPeers`

Returns the list of reserved peers

**Interface**

```
api.rpc.system.reservedPeers(): Vec<Text>
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_reservedPeers", "params":[] }
```

### `resetLogFilter`

Resets the log filter to Substrate defaults

<Info> This method is only active with appropriate flags </Info>

**Interface**

```
api.rpc.system.resetLogFilter(): Null
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_resetLogFilter", "params":[] }
```

### `syncState`

Returns the state of the syncing of the node

**Interface**

```
api.rpc.system.syncState(): SyncState
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_syncState", "params":[] }
```

### `version`

Retrieves the version of the node

**Interface**

```
api.rpc.system.version(): Text
```

**JSON**

```
{ "id":1, "jsonrpc":"2.0", "method":"system_version", "params":[] }
```
