System
Calls
fillBlock
A dispatch that will fill the block weight up to the given ratio.
Namespace
api.tx.system.fillBlockType
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.killPrefixType
function killPrefix(
prefix: Bytes,
subkeys: u32
)killStorage
Kill some items from storage.
Namespace
api.tx.system.killStorageType
function killStorage(
keys: Vec<Bytes>
)remark
Make some on-chain remark.
Namespace
api.tx.system.remarkType
function remark(
remark: Bytes
)remarkWithEvent
Make some on-chain remark and emit event.
Namespace
api.tx.system.remarkWithEventType
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.setCodeType
function setCode(
code: Bytes
)setCodeWithoutChecks
Set the new runtime code without doing any checks of the given code.
Namespace
api.tx.system.setCodeWithoutChecksType
function setCodeWithoutChecks(
code: Bytes
)setHeapPages
Set the number of pages in the WebAssembly environment's heap.
Namespace
api.tx.system.setHeapPagesType
function setHeapPages(
pages: u64
)setStorage
Set some items of storage.
Namespace
api.tx.system.setStorageType
function setStorage(
items: Vec<(Bytes,Bytes)>
)Storage
account
The full account information for a particular account ID.
Namespace
api.query.system.accountType
function account(
SeedPrimitivesSignatureAccountId20
): FrameSystemAccountInfoallExtrinsicsLen
Total length (in bytes) for all extrinsics put together, for the current block.
Namespace
api.query.system.allExtrinsicsLenType
function allExtrinsicsLen(
): Option<u32>blockHash
Map of block numbers to block hashes.
Namespace
api.query.system.blockHashType
function blockHash(
u32
): H256blockWeight
The current weight for the block.
Namespace
api.query.system.blockWeightType
function blockWeight(
): FrameSupportDispatchPerDispatchClassWeightdigest
Digest of the current block, also part of the block header.
Namespace
api.query.system.digestType
function digest(
): SpRuntimeDigesteventCount
The number of events in the Events<T> list.
Namespace
api.query.system.eventCountType
function eventCount(
): u32events
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.eventsType
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.eventTopicsType
function eventTopics(
H256
): Vec<(u32,u32)>executionPhase
The execution phase of the block.
Namespace
api.query.system.executionPhaseType
function executionPhase(
): Option<FrameSystemPhase>extrinsicCount
Total extrinsics count for the current block.
Namespace
api.query.system.extrinsicCountType
function extrinsicCount(
): Option<u32>extrinsicData
Extrinsics data for the current block (maps an extrinsic's index to its data).
Namespace
api.query.system.extrinsicDataType
function extrinsicData(
u32
): ByteslastRuntimeUpgrade
Stores the spec_version and spec_name of when the last runtime upgrade happened.
Namespace
api.query.system.lastRuntimeUpgradeType
function lastRuntimeUpgrade(
): Option<FrameSystemLastRuntimeUpgradeInfo>number
The current block number being processed. Set by execute_block.
Namespace
api.query.system.numberType
function number(
): u32parentHash
Hash of the previous block.
Namespace
api.query.system.parentHashType
function parentHash(
): H256upgradedToTripleRefCount
True if we have upgraded so that AccountInfo contains three types of RefCount. False (default) if not.
Namespace
api.query.system.upgradedToTripleRefCountType
function upgradedToTripleRefCount(
): boolupgradedToU32RefCount
True if we have upgraded so that type RefCount is u32. False (default) if not.
Namespace
api.query.system.upgradedToU32RefCountType
function upgradedToU32RefCount(
): boolEvents
CodeUpdated
:code was updated.
Namespace
api.events.system.CodeUpdatedType
type CodeUpdated = {
}ExtrinsicFailed
An extrinsic failed.
Namespace
api.events.system.ExtrinsicFailedType
type ExtrinsicFailed = {
dispatch_error: SpRuntimeDispatchError,
dispatch_info: FrameSupportDispatchDispatchInfo
}ExtrinsicSuccess
An extrinsic completed successfully.
Namespace
api.events.system.ExtrinsicSuccessType
type ExtrinsicSuccess = {
dispatch_info: FrameSupportDispatchDispatchInfo
}KilledAccount
An account was reaped.
Namespace
api.events.system.KilledAccountType
type KilledAccount = {
account: SeedPrimitivesSignatureAccountId20
}NewAccount
A new account was created.
Namespace
api.events.system.NewAccountType
type NewAccount = {
account: SeedPrimitivesSignatureAccountId20
}Remarked
On on-chain remark happened.
Namespace
api.events.system.RemarkedType
type Remarked = {
sender: SeedPrimitivesSignatureAccountId20,
hash: H256
}Errors
CallFiltered
The origin filter prevent the call to be dispatched.
Namespace
api.errors.system.CallFilteredFailedToExtractRuntimeVersion
Failed to extract the runtime version from the new runtime.
Either calling Core_version or decoding RuntimeVersion failed.
Namespace
api.errors.system.FailedToExtractRuntimeVersionInvalidSpecName
The name of specification does not match between the current runtime and the new runtime.
Namespace
api.errors.system.InvalidSpecNameNonDefaultComposite
Suicide called when the account has non-default composite data.
Namespace
api.errors.system.NonDefaultCompositeNonZeroRefCount
There is a non-zero reference count preventing the account from being purged.
Namespace
api.errors.system.NonZeroRefCountSpecVersionNeedsToIncrease
The specification version is not allowed to decrease between the current runtime and the new runtime.
Namespace
api.errors.system.SpecVersionNeedsToIncreaseConstants
blockHashCount
Maximum number of block number to block hash mappings to keep (oldest pruned first).
Namespace
api.consts.system.blockHashCountType
type blockHashCount = u32blockLength
The maximum length of a block (in bytes).
Namespace
api.consts.system.blockLengthType
type blockLength = FrameSystemLimitsBlockLengthblockWeights
Block & extrinsics weights: base values and limits.
Namespace
api.consts.system.blockWeightsType
type blockWeights = FrameSystemLimitsBlockWeightsdbWeight
The weight of runtime database operations the runtime can invoke.
Namespace
api.consts.system.dbWeightType
type dbWeight = SpWeightsRuntimeDbWeightss58Prefix
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.ss58PrefixType
type ss58Prefix = u16version
Get the chain's current version.
Namespace
api.consts.system.versionType
type version = SpVersionRuntimeVersionJSON-RPC Methods
accountNextIndex
Retrieves the next accountIndex as available on the node
Interface
api.rpc.system.accountNextIndex(accountId: AccountId): IndexJSON
{ "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
Interface
api.rpc.system.addLogFilter(directives: Text): NullJSON
{ "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
Interface
api.rpc.system.addReservedPeer(peer: Text): TextJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_addReservedPeer", "params":[peer: Text] }chain
Retrieves the chain
Interface
api.rpc.system.chain(): TextJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_chain", "params":[] }chainType
Retrieves the chain type
Interface
api.rpc.system.chainType(): ChainTypeJSON
{ "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
Interface
api.rpc.system.dryRun(extrinsic: Bytes, at?: BlockHash): ApplyExtrinsicResultJSON
{ "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(): HealthJSON
{ "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(): TextJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_localPeerId", "params":[] }name
Retrieves the node name
Interface
api.rpc.system.name(): TextJSON
{ "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
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(): ChainPropertiesJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_properties", "params":[] }removeReservedPeer
Remove a reserved peer
INFO
This method is only active with appropriate flags
Interface
api.rpc.system.removeReservedPeer(peerId: Text): TextJSON
{ "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
Interface
api.rpc.system.resetLogFilter(): NullJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_resetLogFilter", "params":[] }syncState
Returns the state of the syncing of the node
Interface
api.rpc.system.syncState(): SyncStateJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_syncState", "params":[] }version
Retrieves the version of the node
Interface
api.rpc.system.version(): TextJSON
{ "id":1, "jsonrpc":"2.0", "method":"system_version", "params":[] }