1

I'm using a ed-25519 account, and first sign with no submission, and use the 「Signed transaction」to decode, the result(right pic) show the era Period is 0x40...

enter image description here

then I do a real submit, but the extrinsic lifetime shows the era is from #1 to #33. the right pic shows era Period is 0x20...

enter image description here

My question is why the two era in these two scene is different? I need to make sure these two era keep same, in other words, how can I make era of Sign(no submission) be the same as real submit action.

1 Answer 1

2

They are representing the same thing. The left image is merely a more tangible representation.

Era is defined as:

pub enum Era {
    /// The transaction is valid forever. The genesis hash must be present in the signed content.
    Immortal,

    /// Period and phase are encoded:
    /// - The period of validity from the block hash found in the signing material.
    /// - The phase in the period that this transaction's lifetime begins (and, importantly,
    /// implies which block hash is included in the signature material). If the `period` is
    /// greater than 1 << 12, then it will be a factor of the times greater than 1<<12 that
    /// `period` is.
    ///
    /// When used on `FRAME`-based runtimes, `period` cannot exceed `BlockHashCount` parameter
    /// of `system` module.
    Mortal(Period, Phase),
}

So you have 01 2000_0000_0000_0000 0100_0000_0000_0000 (underscores added by me). The 01 implies Mortal; the two numbers are Period and Phase. They are hex dumps in SCALE (Little Endian) format, meaning that the first bytes are the least significant, so these two numbers are just: 32 (Period) and 1 (Phase).

Basically the transaction is valid for Period blocks. The Phase and Period are used along with the current height of the chain when the transaction is included and the chain's recent history of block hashes in order to recover a past block hash which is utilised in the transaction's signed content and must match up for the transaction's signature to check out.

1
  • 1
    My second pic show the Period is 32, while my first pic use Lifetime: 64, this cause signature mis-match. when I change Lifetime to 32, the signature is matched.
    – zqhxuyuan
    Apr 15, 2022 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.