diff --git a/Cargo.lock b/Cargo.lock
index 3b19d96af0..8b4b6ebd2c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2149,12 +2149,24 @@ dependencies = [
"instant",
]
+[[package]]
+name = "fc-api"
+version = "1.0.0-dev"
+dependencies = [
+ "async-trait",
+ "fp-storage",
+ "parity-scale-codec",
+ "sp-core",
+ "sp-runtime",
+]
+
[[package]]
name = "fc-cli"
version = "1.0.0-dev"
dependencies = [
"clap",
"ethereum-types",
+ "fc-api",
"fc-db",
"fp-rpc",
"fp-storage",
@@ -2196,6 +2208,7 @@ version = "2.0.0-dev"
dependencies = [
"async-trait",
"ethereum",
+ "fc-api",
"fc-storage",
"fp-consensus",
"fp-rpc",
@@ -2264,6 +2277,7 @@ dependencies = [
"ethereum",
"ethereum-types",
"evm",
+ "fc-api",
"fc-db",
"fc-mapping-sync",
"fc-rpc-core",
@@ -2843,6 +2857,7 @@ version = "0.0.0"
dependencies = [
"async-trait",
"clap",
+ "fc-api",
"fc-cli",
"fc-consensus",
"fc-db",
diff --git a/Cargo.toml b/Cargo.toml
index 9cdd1b7c4a..7564feb83c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,6 +16,7 @@ members = [
"frame/evm/precompile/bls12377",
"frame/evm/precompile/dispatch",
"frame/evm/precompile/curve25519",
+ "client/api",
"client/consensus",
"client/rpc-core",
"client/rpc",
@@ -134,6 +135,7 @@ substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/
substrate-test-runtime-client = { version = "2.0.0", git = "https://github.com/paritytech/substrate", branch = "master" }
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "master" }
# Frontier Client
+fc-api = { version = "1.0.0-dev", path = "client/api" }
fc-cli = { version = "1.0.0-dev", path = "client/cli", default-features = false }
fc-consensus = { version = "2.0.0-dev", path = "client/consensus" }
fc-db = { version = "2.0.0-dev", path = "client/db", default-features = false }
diff --git a/client/api/Cargo.toml b/client/api/Cargo.toml
new file mode 100644
index 0000000000..0a70e8db39
--- /dev/null
+++ b/client/api/Cargo.toml
@@ -0,0 +1,20 @@
+[package]
+name = "fc-api"
+version = "1.0.0-dev"
+license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
+description = "Frontier client interfaces"
+authors = { workspace = true }
+edition = { workspace = true }
+repository = { workspace = true }
+
+[package.metadata.docs.rs]
+targets = ["x86_64-unknown-linux-gnu"]
+
+[dependencies]
+async-trait = { workspace = true }
+scale-codec = { package = "parity-scale-codec", workspace = true }
+# Substrate
+sp-core = { workspace = true, features = ["default"] }
+sp-runtime = { workspace = true, features = ["default"] }
+# Frontier
+fp-storage = { workspace = true, features = ["default"] }
diff --git a/client/api/src/backend.rs b/client/api/src/backend.rs
new file mode 100644
index 0000000000..7ad26b95a8
--- /dev/null
+++ b/client/api/src/backend.rs
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
+// This file is part of Frontier.
+//
+// Copyright (c) 2023 Parity Technologies (UK) Ltd.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+use scale_codec::{Decode, Encode};
+// Substrate
+use sp_core::{H160, H256};
+use sp_runtime::traits::Block as BlockT;
+// Frontier
+use fp_storage::EthereumStorageSchema;
+
+#[derive(Clone, Debug, Eq, PartialEq, Encode, Decode)]
+pub struct TransactionMetadata {
+ pub substrate_block_hash: Block::Hash,
+ pub ethereum_block_hash: H256,
+ pub ethereum_index: u32,
+}
+
+/// The frontier backend interface.
+#[async_trait::async_trait]
+pub trait Backend: Send + Sync {
+ /// Get the substrate hash with the given ethereum block hash.
+ async fn block_hash(
+ &self,
+ ethereum_block_hash: &H256,
+ ) -> Result