0

Inside the Frontier repo, I found this template folder: https://github.com/paritytech/frontier/tree/master/template

and its Readme says: This template is maintained in the Frontier project repository, and can be used to generate a stand-alone template for use in an independent project via the included template generation script.... This is Option 1. That is to manually run that script.

But then further down that Readme, it says To build the chain, execute the following commands from the project root:... this is Option 2. That is to build it via cargo build --release

Also I am aware of @JoshOrndorff's tutorial about how to add Frontier into a Substrate Node Template: https://github.com/PureStake/substrate-node-template/commits/frontier-workshop-2021, but that is a few months old. This is Option 3: that is to add Frontier code to the latest Substrate Node Template...

I am very confused by those options.

After fixing the Frontier with the correct Substrate version I need, how can I build a demo for running Ethereum smart contracts?

1 Answer 1

1

[Solved] here are the steps to take:

Go into the Frontier repo

Fix the Substrate version to what you need: like polkadot-v0.9.24

Open this file repo/template/runtime/src/lib.rs

Change your default chainId from 42 to something else, for example 1942. Because 42 is also the Kovan's chainId. I have no idea why the chainId was set to 42.

Then build it and run it:

cargo build --release
./target/release/frontier-template-node --dev

That runs a chain based on Substrate Node Template.

The hidden port is actually 9933, so here is the correct URL to connect your MetaMask, Hardhat, Remix to the running chain.

      url: "http://127.0.0.1:9933",
      chainId: 42,

Setup your Polkadot UI

Open Polkadot UI in your browser at https://polkadot.js.org/apps/#?rpc=ws://127.0.0.1:9944

Copy the polkadot UI setting at https://github.com/paritytech/frontier/tree/master/template

Go to Polkadot UI > Settings > Developer tab: Paste the copied setting

To clarify when to use the Frontier's template folder:

  • If you have another repo that uses Frontier as a dependency, then use Option 1 above with Josh's video.
  • If you want to run Ethereum smart contracts inside a substrate based chain with minimum effort, use Option 2 above and my steps above.

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.