Skip to main content
12 votes

Is a transaction an extrinsic?

Yes, in Substrate, transactions can generally be thought of as any piece of data that's intended for the transaction pool (and consequently, could potentially be included in a block). But there are ...
Sacha Lansky's user avatar
  • 2,640
11 votes

How to call extrinsic functions externally from rust?

If your making a rust program then using subtx crate might be your best bet: https://github.com/paritytech/subxt For example here is how to call the api: let api = ClientBuilder::new() ....
Squirrel's user avatar
  • 3,849
10 votes

Generating an extrinsic call for a custom pallet

The problem is the way you encode the call data. Since your call_data in main is a vector, when you encode it into the temporary byte vector in encode_extrinsic, SCALE first appends the length of the ...
kukabi's user avatar
  • 543
10 votes

How to call extrinsic functions externally from rust?

The easiest way to do this is with JavaScript and using the Polkadot JS APIs. An example for batching transactions can be found here: // construct a list of transactions we want to batch const txs = [ ...
Shawn Tabrizi's user avatar
  • 16k
9 votes
Accepted

What are the Steps for Encoding an Extrinsic in Substrate?

More generally, if you were to SCALE encode a signed transaction, you'd follow these steps: Combine the call, extra and additional data and SCALE encode it: call data: the pallet index, call index ...
Sacha Lansky's user avatar
  • 2,640
9 votes
Accepted

Using Scheduler Pallet to schedule Contract pallet call

Alright, so I had a chat with Kian about this and he gave me some tips for how to approach this. First, we need to distinguish between Runtime Calls and Pallet Calls. The Runtime calls are those that ...
HCastano's user avatar
  • 1,071
8 votes

Why unsigned extrinsics?

That is correct - with a signed transaction there is validation to check the nonce, make sure the user has enough to pay for the fee, and check if the signature is valid. With an unsigned transaction ...
Bruno's user avatar
  • 8,355
7 votes

How to decode extrinsic at json-RPC call's data(byte code)

You can use @polkadot-js and do something like this: const wsProvider = new WsProvider('wss://rpc.polkadot.io'); const api = await ApiPromise.create({ provider: wsProvider }); const exampleBlockNumber ...
Bruno's user avatar
  • 8,355
7 votes
Accepted

How to decode extrinsic at json-RPC call's data(byte code)

As mentioned in the wiki page https://wiki.polkadot.network/docs/build-node-interaction, some return values (like extrinsics) are SCALE encoded and you need to decode them by using the metadata. You ...
dominique's user avatar
  • 1,683
7 votes
Accepted

Do all extrinsic fees have to be paid when using utility.batch?

Saying that "fees are not paid" is not a fully accurate statement of what is happening for things like council.vote. What is actually happening is that at the beginning of the transaction, ...
Shawn Tabrizi's user avatar
  • 16k
7 votes
Accepted

What is the difference between the extrinsics utility.batch() and utility.batchAll()?

utility.batchAll() does not commit if one of the calls in the batch fails. The whole transaction will rollback and fail if any of the calls failed. utility.batch() commits each successful call ...
Bruno's user avatar
  • 8,355
7 votes
Accepted

With subxt how can I subscribe to watch extrinsics?

The logic in subxt will map through in a similar way. The EventRecord struct contains a Phase enum where ApplyExtrinsic(u32) refers to the index of the extrinsic in the block. So the way to map it is -...
Jaco's user avatar
  • 5,865
7 votes
Accepted

Calculating actual weights for extrinsics

First, the transaction_payment pallet does this for you with compute_actual_fee from the post_dispatch and configuring it in your runtime with the ChargeTransactionPayment signed extension via ...
Daan van der Plas's user avatar
7 votes
Accepted

Is it possible to submit an extrinsic using rpc?

Yes, with the RPC request author_submitExtrinsic https://polkadot.js.org/docs/substrate/rpc/#submitextrinsicextrinsic-extrinsic-hash You have to get the balance_transfer extrinsic signed and you can ...
Alex Bean's user avatar
  • 5,722
6 votes

How can I get a deeper / lower level insight into how my transaction is processed with sidecar?

Sidecar provides the following experimental trace related endpoints : /experimental/blocks/{blockId}/traces/operations?actions=false /experimental/blocks/head/traces/operations?actions=false /...
dominique's user avatar
  • 1,683
6 votes

Getting extrinsic data with the transaction hash

I'm facing the same kind of question I think. The problem is that it doesn't really matter if your extrinsic is executed correctly or not, if the transaction submitted is correct (the structure and ...
andresvsm's user avatar
  • 1,114
6 votes
Accepted

fee economics around remark

Every extrinsic has an ExtrinsicBaseWeight which is defined in FRAME System. So even if a benchmark for a particular extrinsic says 0, there will still be the ExtrinsicBaseWeight included on top of it....
Shawn Tabrizi's user avatar
  • 16k
6 votes
Accepted

What format is the block timestamp?

Substrate are time stamped by a number of milliseconds since 1 January 1970 UTC. This convention is widely adopted by many modern programming environments. Here is a simple example in JS with the ...
Shawn Tabrizi's user avatar
  • 16k
6 votes
Accepted

To get the extrinsic data from the extrinsic Hash

There are a couple ways you could work with that. If you have the extrinsic hash and the block number than you could something like this: const exampleBlockNumber = 7200920 const blockHash = await api....
Bruno's user avatar
  • 8,355
6 votes
Accepted

Why could we find the same transaction hash in 3 different blocks?

In substrate what uniquely identifies an extrinsic is the block# + its index in that block, not the call hash. So in this case, the call you are referring to would be identified by 10219793-2, for ...
Alejandro Martínez's user avatar
6 votes
Accepted

How to annotate extrinsic as non transactional?

Pasting context from #10806 itself, very well documented, please check. Annotation for safe without storage layer Now that the default behavior of extrinsics will be to spawn at least one ...
Alejandro Martínez's user avatar
6 votes

Sign a transaction offline for Westend testnet and verification of the transaction

For context all the information to answer this question is in this github issue: https://github.com/paritytech/txwrapper-core/issues/296 Given the address you are using to conduct the transaction, ...
Tarik Gul's user avatar
  • 1,116
6 votes
Accepted

Any purpose to add #[transactional] attribute to an extrinsic?

I think that's a history code. All the calls are transactional by default in the latest Substrate version.
AurevoirXavier's user avatar
  • 10.4k
5 votes
Accepted

Where do the transaction fees go to?

The transaction-fee pallet handles calculating and transferring the transaction fees. It supports a configurable output by implementing the OnUnbalanced trait. For Polkadot and Kusama, 80% of the ...
Shawn Tabrizi's user avatar
  • 16k
5 votes
Accepted

Do changes revert when an Extrinsic errors?

Update: All storage changes are now reverted when an error from a call is returned. This makes writing code much easier. Original answer: Currently you need to make sure to never return an error after ...
Oliver Tale-Yazdi's user avatar
5 votes
Accepted

Correlate events with extrinsics in a utility.batch call in Polkadot

The utility.batch call emits events which allow you to organize which extrinsic events are coming from each extrinsic. Between each call, you should see an Event::ItemCompleted after an extrinsic as ...
Shawn Tabrizi's user avatar
  • 16k
5 votes
Accepted

how can I purge all pending extrinsics in the transaction pool

author_removeExtrinsic support remove extrinsic by value You can also either write a script to calculate the hash, or just read it from polkadot apps under Network -> Node info page
Bryan Chen's user avatar
5 votes

Do all extrinsic fees have to be paid when using utility.batch?

Yes you will also need to pay for these transactions inside utility.batch or utility.batchAll. However, you also don't pay for each transaction separately, you pay for all of them directly together. ...
bkchr's user avatar
  • 11.2k
5 votes
Accepted

When to use `compact` on extrinsic arguments?

You should use #[pallet::compact] wherever the type allows it, and you want to take advantage of compact encoding to reduce the amount of bytes that is needed to call an extrinsic. https://docs....
Shawn Tabrizi's user avatar
  • 16k
5 votes

Getting extrinsic data with the transaction hash

The Substrate author_ RPC namespace has 2 submission mechanisms - author_submitExtrinsic - this only returns the hash, doesn't guarantee inclusion author_submitAndWatchExtrinsic - this is a ...
Jaco's user avatar
  • 5,865

Only top scored, non community-wiki answers of a minimum length are eligible