Extrinsics

The following sections contain Extrinsics methods are part of the default Substrate runtime. On the api, these are exposed via api.tx.<module>.<method>.

(NOTE: These were generated from a static/snapshot view of a recent Substrate master node. Some items may not be available in older nodes, or in any customized implementations.)


authorship

setUncles(new_uncles: Vec<Header>)

  • summary: Provide a set of uncles.

babe

setPendingSecondarySlotsChange(change: Option<bool>)

  • summary: Sets a pending change to enable / disable secondary slot assignment. The pending change will be set at the end of the current epoch and will be enacted at current_epoch + 2.

balances

forceTransfer(source: Address, dest: Address, value: Compact<Balance>)

  • summary: Exactly as transfer, except the origin must be root and the source account may be specified.

setBalance(who: Address, new_free: Compact<Balance>, new_reserved: Compact<Balance>)

  • summary: Set the balances of a given account. This will alter FreeBalance and ReservedBalance in storage. it will also decrease the total issuance of the system (TotalIssuance). If the new free or reserved balance is below the existential deposit, it will reset the account nonce (system::AccountNonce). The dispatch origin for this call is root. # - Independent of the arguments. - Contains a limited number of reads and writes. #

transfer(dest: Address, value: Compact<Balance>)

  • summary: Transfer some liquid free balance to another account. transfer will set the FreeBalance of the sender and receiver. It will decrease the total issuance of the system by the TransferFee. If the sender's account is below the existential deposit as a result of the transfer, the account will be reaped. The dispatch origin for this call must be Signed by the transactor. # - Dependent on arguments but not critical, given proper implementations for input config types. See related functions below. - It contains a limited number of reads and writes internally and no complex computation. Related functions: - ensure_can_withdraw is always called internally but has a bounded complexity. - Transferring balances to accounts that did not exist before will cause T::OnNewAccount::on_new_account to be called. - Removing enough funds from an account will trigger T::DustRemoval::on_unbalanced and T::OnFreeBalanceZero::on_free_balance_zero. #

contracts

call(dest: Address, value: Compact<BalanceOf>, gas_limit: Compact<Gas>, data: Bytes)

  • summary: Makes a call to an account, optionally transferring some balance. * If the account is a smart-contract account, the associated code will be executed and any value will be transferred. * If the account is a regular account, any value will be transferred. * If no account exists and the call value is not less than existential_deposit, a regular account will be created and any value will be transferred.

claimSurcharge(dest: AccountId, aux_sender: Option<AccountId>)

  • summary: Allows block producers to claim a small reward for evicting a contract. If a block producer fails to do so, a regular users will be allowed to claim the reward. If contract is not evicted as a result of this call, no actions are taken and the sender is not eligible for the reward.

create(endowment: Compact<BalanceOf>, gas_limit: Compact<Gas>, code_hash: CodeHash, data: Bytes)

  • summary: Creates a new contract from the codehash generated by put_code, optionally transferring some balance. Creation is executed as follows: - The destination address is computed based on the sender and hash of the code. - The smart-contract account is created at the computed address. - The ctor_code is executed in the context of the newly-created account. Buffer returned after the execution is saved as the code of the account. That code will be invoked upon any call received by this account. - The contract is initialized.

putCode(gas_limit: Compact<Gas>, code: Bytes)

  • summary: Stores the given binary Wasm code into the chain's storage and returns its codehash. You can instantiate contracts only with stored code.

updateSchedule(schedule: Schedule)

  • summary: Updates the schedule for metering contracts. The schedule must have a greater version than the stored schedule.

council

execute(proposal: Proposal)

  • summary: Dispatch a proposal from a member using the Member origin. Origin must be a member of the collective.

propose(threshold: Compact<MemberCount>, proposal: Proposal)

  • summary: # - Bounded storage reads and writes. - Argument threshold has bearing on weight. #

setMembers(new_members: Vec<AccountId>)

  • summary: Set the collective's membership manually to new_members. Be nice to the chain and provide it pre-sorted. Requires root origin.

vote(proposal: Hash, index: Compact<ProposalIndex>, approve: bool)

  • summary: # - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. #

democracy

cancelQueued(when: Compact<BlockNumber>, which: Compact<u32>, what: Compact<ReferendumIndex>)

  • summary: Cancel a proposal queued for enactment.

cancelReferendum(ref_index: Compact<ReferendumIndex>)

  • summary: Remove a referendum.

delegate(to: AccountId, conviction: Conviction)

  • summary: Delegate vote. # - One extra DB entry. #

emergencyCancel(ref_index: ReferendumIndex)

  • summary: Schedule an emergency cancellation of a referendum. Cannot happen twice to the same referendum.

externalPropose(proposal: Proposal)

  • summary: Schedule a referendum to be tabled once it is legal to schedule an external referendum.

externalProposeDefault(proposal: Proposal)

  • summary: Schedule a negative-turnout-bias referendum to be tabled next once it is legal to schedule an external referendum. Unlike external_propose, blacklisting has no effect on this and it may replace a pre-scheduled external_propose call.

externalProposeMajority(proposal: Proposal)

  • summary: Schedule a majority-carries referendum to be tabled next once it is legal to schedule an external referendum. Unlike external_propose, blacklisting has no effect on this and it may replace a pre-scheduled external_propose call.

fastTrack(proposal_hash: Hash, voting_period: BlockNumber, delay: BlockNumber)

  • summary: Schedule the currently externally-proposed majority-carries referendum to be tabled immediately. If there is no externally-proposed referendum currently, or if there is one but it is not a majority-carries referendum then it fails. - proposal_hash: The hash of the current external proposal. - voting_period: The period that is allowed for voting on this proposal. - delay: The number of block after voting has ended in approval and this should be enacted. Increased to EmergencyVotingPeriod if too low.

propose(proposal: Proposal, value: Compact<BalanceOf>)

  • summary: Propose a sensitive action to be taken. # - O(1). - Two DB changes, one DB entry. #

proxyVote(ref_index: Compact<ReferendumIndex>, vote: Vote)

  • summary: Vote in a referendum on behalf of a stash. If vote.is_aye(), the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # - O(1). - One DB change, one DB entry. #

removeProxy(proxy: AccountId)

  • summary: Clear the proxy. Called by the stash. # - One DB clear. #

resignProxy()

  • summary: Clear the proxy. Called by the proxy. # - One DB clear. #

second(proposal: Compact<PropIndex>)

  • summary: Propose a sensitive action to be taken. # - O(1). - One DB entry. #

setProxy(proxy: AccountId)

  • summary: Specify a proxy. Called by the stash. # - One extra DB entry. #

undelegate()

  • summary: Undelegate vote. # - O(1). #

vetoExternal(proposal_hash: Hash)

  • summary: Veto and blacklist the external proposal hash.

vote(ref_index: Compact<ReferendumIndex>, vote: Vote)

  • summary: Vote in a referendum. If vote.is_aye(), the vote is to enact the proposal; otherwise it is a vote to keep the status quo. # - O(1). - One DB change, one DB entry. #

elections

presentWinner(candidate: Address, total: Compact<BalanceOf>, index: Compact<VoteIndex>)

  • summary: Claim that signed is one of the top Self::carry_count() + current_vote().1 candidates. Only works if the block_number >= current_vote().0 and < current_vote().0 + presentation_duration() signed should have at least # - O(voters) compute. - One DB change. #

proxySetApprovals(votes: Vec<bool>, index: Compact<VoteIndex>, hint: SetIndex)

  • summary: Set candidate approvals from a proxy. Approval slots stay valid as long as candidates in those slots are registered. # - Same as set_approvals with one additional storage read. #

reapInactiveVoter(reporter_index: Compact<u32>, who: Address, who_index: Compact<u32>, assumed_vote_index: Compact<VoteIndex>)

  • summary: Remove a voter. For it not to be a bond-consuming no-op, all approved candidate indices must now be either unregistered or registered to a candidate that registered the slot after the voter gave their last approval set. Both indices must be provided as explained in [voter_at] function. May be called by anyone. Returns the voter deposit to signed. # - O(1). - Two fewer DB entries, one DB change. #

removeMember(who: Address)

  • summary: Remove a particular member from the set. This is effective immediately. Note: A tally should happen instantly (if not already in a presentation period) to fill the seat if removal means that the desired members are not met.

retractVoter(index: Compact<u32>)

  • summary: Remove a voter. All votes are cancelled and the voter deposit is returned. The index must be provided as explained in [voter_at] function. Also removes the lock on the balance of the voter. See [do_set_approvals()]. # - O(1). - Two fewer DB entries, one DB change. #

setApprovals(votes: Vec<bool>, index: Compact<VoteIndex>, hint: SetIndex)

  • summary: Set candidate approvals. Approval slots stay valid as long as candidates in those slots are registered. Locks the total balance of caller indefinitely. Only [retract_voter] or [reap_inactive_voter] can unlock the balance. hint argument is interpreted differently based on: - if origin is setting approvals for the first time: The index will be checked for being a valid hole in the voter list. - if the hint is correctly pointing to a hole, no fee is deducted from origin. - Otherwise, the call will succeed but the index is ignored and simply a push to the last chunk with free space happens. If the new push causes a new chunk to be created, a fee indicated by [VotingFee] is deducted. - if origin is already a voter: the index must be valid and point to the correct position of the origin in the current voters list. Note that any trailing false votes in votes is ignored; In approval voting, not voting for a candidate and voting false, are equal. # - O(1). - Two extra DB entries, one DB change. - Argument votes is limited in length to number of candidates. #

setDesiredSeats(count: Compact<u32>)

  • summary: Set the desired member count; if lower than the current count, then seats will not be up election when they expire. If more, then a new vote will be started if one is not already in progress.

setPresentationDuration(count: Compact<BlockNumber>)

  • summary: Set the presentation duration. If there is currently a vote being presented for, will invoke finalize_vote.

setTermDuration(count: Compact<BlockNumber>)

  • summary: Set the presentation duration. If there is current a vote being presented for, will invoke finalize_vote.

submitCandidacy(slot: Compact<u32>)

  • summary: Submit oneself for candidacy. Account must have enough transferrable funds in it to pay the bond. NOTE: if origin has already assigned approvals via [set_approvals], it will NOT have any usable funds to pass candidacy bond and must first retract. Note that setting approvals will lock the entire balance of the voter until retraction or being reported. # - Independent of input. - Three DB changes. #

finalityTracker

finalHint(hint: Compact<BlockNumber>)

  • summary: Hint that the author of this block thinks the best finalized block is the given number.

grandpa

reportMisbehavior(_report: Bytes)

  • summary: Report some misbehavior.

imOnline

heartbeat(heartbeat: Heartbeat, signature: Signature)


session

setKeys(keys: Keys, proof: Bytes)

  • summary: Sets the session key(s) of the function caller to key. Allows an account to set its session key prior to becoming a validator. This doesn't take effect until the next session. The dispatch origin of this function must be signed. # - O(log n) in number of accounts. - One extra DB entry. #

staking

bond(controller: Address, value: Compact<BalanceOf>, payee: RewardDestination)

  • summary: Take the origin account as a stash and lock up value of its balance. controller will be the account that controls it. value must be more than the minimum_balance specified by T::Currency. The dispatch origin for this call must be Signed by the stash account. # - Independent of the arguments. Moderate complexity. - O(1). - Three extra DB entries. NOTE: Two of the storage writes (Self::bonded, Self::payee) are never cleaned unless the origin falls below existential deposit and gets removed as dust. #

bondExtra(max_additional: Compact<BalanceOf>)

  • summary: Add some extra amount that have appeared in the stash free_balance into the balance up for staking. Use this if there are additional funds in your stash account that you wish to bond. Unlike [bond] or [unbond] this function does not impose any limitation on the amount that can be added. The dispatch origin for this call must be Signed by the stash, not the controller. # - Independent of the arguments. Insignificant complexity. - O(1). - One DB entry. #

chill()

  • summary: Declare no desire to either validate or nominate. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - Independent of the arguments. Insignificant complexity. - Contains one read. - Writes are limited to the origin account key. #

forceNewEra()

  • summary: Force there to be a new era at the end of the next session. After this, it will be reset to normal (non-forced) behaviour. # - No arguments. #

forceNoEras()

  • summary: Force there to be no new eras indefinitely. # - No arguments. #

nominate(targets: Vec<Address>)

  • summary: Declare the desire to nominate targets for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - The transaction's complexity is proportional to the size of targets, which is capped at MAX_NOMINATIONS. - Both the reads and writes follow a similar pattern. #

setController(controller: Address)

  • summary: (Re-)set the controller of a stash. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the stash, not the controller. # - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the origin account key. #

setInvulnerables(validators: Vec<AccountId>)

  • summary: Set the validators who cannot be slashed (if any).

setPayee(payee: RewardDestination)

  • summary: (Re-)set the payment target for a controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the origin account key. #

setValidatorCount(new: Compact<u32>)

  • summary: The ideal number of validators.

unbond(value: Compact<BalanceOf>)

  • summary: Schedule a portion of the stash to be unlocked ready for transfer out after the bond period ends. If this leaves an amount actively bonded less than T::Currency::minimum_balance(), then it is increased to the full amount. Once the unlock period is done, you can call withdraw_unbonded to actually move the funds out of management ready for transfer. No more than a limited number of unlocking chunks (see MAX_UNLOCKING_CHUNKS) can co-exists at the same time. In that case, [Call::withdraw_unbonded] need to be called first to remove some of the chunks (if possible). The dispatch origin for this call must be Signed by the controller, not the stash. See also [Call::withdraw_unbonded]. # - Independent of the arguments. Limited but potentially exploitable complexity. - Contains a limited number of reads. - Each call (requires the remainder of the bonded balance to be above minimum_balance) will cause a new entry to be inserted into a vector (Ledger.unlocking) kept in storage. The only way to clean the aforementioned storage item is also user-controlled via withdraw_unbonded. - One DB entry.

validate(prefs: ValidatorPrefs)

  • summary: Declare the desire to validate for the origin controller. Effects will be felt at the beginning of the next era. The dispatch origin for this call must be Signed by the controller, not the stash. # - Independent of the arguments. Insignificant complexity. - Contains a limited number of reads. - Writes are limited to the origin account key. #

withdrawUnbonded()

  • summary: Remove any unlocked chunks from the unlocking queue from our management. This essentially frees up that balance to be used by the stash account to do whatever it wants. The dispatch origin for this call must be Signed by the controller, not the stash. See also [Call::unbond]. # - Could be dependent on the origin argument and how much unlocking chunks exist. It implies consolidate_unlocked which loops over Ledger.unlocking, which is indirectly user-controlled. See [unbond] for more detail. - Contains a limited number of reads, yet the size of which could be large based on ledger. - Writes are limited to the origin account key. #

sudo

setKey(new: Address)

  • summary: Authenticates the current sudo key and sets the given AccountId (new) as the new sudo key. The dispatch origin for this call must be Signed. # - O(1). - Limited storage reads. - One DB change. #

sudo(proposal: Proposal)

  • summary: Authenticates the sudo key and dispatches a function call with Root origin. The dispatch origin for this call must be Signed. # - O(1). - Limited storage reads. - No DB writes. #

system

fillBlock()

  • summary: A big dispatch that will disallow any other transaction to be included.

killStorage(keys: Vec<Key>)

  • summary: Kill some items from storage.

remark(_remark: Bytes)

  • summary: Make some on-chain remark.

setCode(new: Bytes)

  • summary: Set the new code.

setHeapPages(pages: u64)

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

setStorage(items: Vec<KeyValue>)

  • summary: Set some items of storage.

technicalCommittee

execute(proposal: Proposal)

  • summary: Dispatch a proposal from a member using the Member origin. Origin must be a member of the collective.

propose(threshold: Compact<MemberCount>, proposal: Proposal)

  • summary: # - Bounded storage reads and writes. - Argument threshold has bearing on weight. #

setMembers(new_members: Vec<AccountId>)

  • summary: Set the collective's membership manually to new_members. Be nice to the chain and provide it pre-sorted. Requires root origin.

vote(proposal: Hash, index: Compact<ProposalIndex>, approve: bool)

  • summary: # - Bounded storage read and writes. - Will be slightly heavier if the proposal is approved / disapproved after the vote. #

technicalMembership

addMember(who: AccountId)

  • summary: Add a member who to the set. May only be called from AddOrigin or root.

removeMember(who: AccountId)

  • summary: Remove a member who from the set. May only be called from RemoveOrigin or root.

resetMembers(members: Vec<AccountId>)

  • summary: Change the membership to a new set, disregarding the existing membership. Be nice and pass members pre-sorted. May only be called from ResetOrigin or root.

swapMember(remove: AccountId, add: AccountId)

  • summary: Swap out one member remove for another add. May only be called from SwapOrigin or root.

timestamp

set(now: Compact<Moment>)

  • summary: Set the current time. This call should be invoked exactly once per block. It will panic at the finalization phase, if this call hasn't been invoked by that time. The timestamp should be greater than the previous one by the amount specified by MinimumPeriod. The dispatch origin for this call must be Inherent.

treasury

approveProposal(proposal_id: Compact<ProposalIndex>)

  • summary: Approve a proposal. At a later time, the proposal will be allocated to the beneficiary and the original deposit will be returned. # - O(1). - Limited storage reads. - One DB change. #

proposeSpend(value: Compact<BalanceOf>, beneficiary: Address)

  • summary: Put forward a suggestion for spending. A deposit proportional to the value is reserved and slashed if the proposal is rejected. It is returned once the proposal is awarded. # - O(1). - Limited storage reads. - One DB change, one extra DB entry. #

rejectProposal(proposal_id: Compact<ProposalIndex>)

  • summary: Reject a proposed spend. The original deposit will be slashed. # - O(1). - Limited storage reads. - One DB clear. #