1

I'm trying to get a better understanding of Frontier, and thus I'm reimplementing the frontier node template over the generic substrate node template. Unfortunately I'm pretty much stuck at step 1.

Here's the change I did to the runtime (it's pretty much just replacing the MultiSignature with EthereumSignature. This, of course, forces the AccountId to resolve into AccountId20:

diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs
index ff9ac66..319eb70 100644
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -6,6 +6,7 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

+use fp_account::EthereumSignature;
use pallet_grandpa::{
        fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList,
};
@@ -18,7 +19,7 @@ use sp_runtime::{
                AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, One, Verify,
        },
        transaction_validity::{TransactionSource, TransactionValidity},
-       ApplyExtrinsicResult, MultiSignature,
+       ApplyExtrinsicResult,
};
use sp_std::prelude::*;
#[cfg(feature = "std")]
@@ -54,7 +55,7 @@ pub use pallet_template;
pub type BlockNumber = u32;

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
-pub type Signature = MultiSignature;
+pub type Signature = EthereumSignature;

/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.

For any extrinsic I try to submit with polkadot{.js} I get the following error now:

-32602: invalid length 48, expected a (both 0x-prefixed or not) hex string or byte array containing 20 bytes at line 1 column 50

Which seems to tell me that polkadot{.js} cannot handle the EthereumSignature on its own.

Can I convince it to use the EthereumSignature or I'm stuck with other means of calling into the RPC? I'm pretty sure Moonbeam uses the similar signer and it works with polkadot{.js} somehow.

0

1 Answer 1

2

There is an answer in Unified accounts with AURA.

But that question's title is too specific.

So, I try to answer this again.

I think you need this to make PolkadotJS adapt for your chain.

https://github.com/polkadot-js/apps/pull/8396

1
  • 1
    Thanks! Getting isEthereum got me half way. The other issue was that I had to specify {"AccountId": "EthereumAccountId"} as an extra type or face an createType(AccountId):: Invalid AccountId provided, expected 32 bytes, found 20 error (and you can't just do that because isEthereum overrides isDevelopment for some strange reason)
    – Farcaller
    Mar 25, 2023 at 19:24

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