Run Ethereum smart contracts on Hyperledger Fabric-X.
fabric-x-evm adds an Ethereum-style JSON-RPC API and a native EVM to Fabric, so you can deploy unmodified Solidity contracts and use the tooling you already know - Hardhat, Foundry, MetaMask - against a permissioned, enterprise blockchain.
By embedding the EVM inside Fabric you get the Ethereum contract ecosystem and developer experience while keeping Fabric's enterprise strengths: fine-grained access control, privacy, deterministic consensus, and high performance. Existing Ethereum assets, skills, and tools carry over with no rewrite β lowering the barrier for organizations that want Ethereum compatibility in a permissioned setting.
- Drop-in EVM - deploy existing Solidity contracts without modification.
- Standard JSON-RPC - point any Ethereum client at
:8545(chain ID4011/0xfab). - Familiar tooling - Hardhat, Foundry, MetaMask, and block explorers just work.
- Fabric trust model - endorsement, consensus, and access control preserved.
- Fabric and Fabric-X - deploy into any existing or new network to add EVM capabilities.
The fastest way to see Fabric-X EVM in action is in the samples repository. It includes a full network, a block explorer, and a token deploy-and-transfer demo. No need to clone or build this repo.
π hyperledger/fabric-x-samples β evm
- Architecture β how the gateway, EVM, and Fabric fit together
- Compatibility β which Ethereum/EVM guarantees hold, and the caveats
- JSON-RPC errors β error codes the gateway returns
This section is for developing against locally built code. If you just want to use the chain, the samples repo above is the easier path.
You'll need Go and Docker (or Podman) for the Fabric-X network.
Build the fxevm binary:
make build # produces bin/fxevmBring up a local Fabric-X network (committer + application namespace):
make init-x # generate crypto material (one-time)
make start-x # start the Fabric-X test networkThen run the gateway from your local build, pointed at that network. The sample
config uses paths relative to integration/, so run it from there:
cd integration && ../bin/fxevm start -c fabx.yamlThe gateway now serves Ethereum JSON-RPC at http://localhost:8545
(chain ID 4011) β point any Ethereum tooling at it. Stop the network with:
make stop-xNote
Rootless Podman: pass DOCKER=podman COMPOSE="podman compose" to any
make target that starts or stops containers.
The gateway is configured via a YAML file passed to the start command with -c:
fxevm -c path/to/config.yaml startSee integration/fabx.yaml for a complete annotated
example. The top-level sections are:
| Section | Description |
|---|---|
logging |
Log format and level spec |
network |
Channel, namespace, chain ID, and protocol (fabric or fabric-x) |
gateway |
Listen address, identity, database, orderers, committer |
endorsers |
One entry per embedded endorser peer |
Any config field can be overridden at runtime without editing the file. The
variable name is GATEWAY_<SECTION>_<FIELD>, uppercased with dots and hyphens
replaced by underscores. For example:
GATEWAY_LOGGING_SPEC=debug fxevm -c config.yaml start
GATEWAY_NETWORK_CHANNEL=mychannel fxevm -c config.yaml start
GATEWAY_GATEWAY_LISTEN=0.0.0.0:9545 fxevm -c config.yaml startmake unit-testsSome integration tests rely on the ethereum/tests corpus, vendored as a git
submodule under testdata/ethereum-tests. Initialize it once before running
those tests:
git submodule update --init --recursiveThe simplest integration tests don't require a Fabric network, but still exercise the basic functionality of creating read/write sets out of EVM transactions, and subsequently reading them.
make test-localGenerate the crypto material once:
make init-xThen start the Fabric-X testcontainer and create the namespace, run the integration tests against it, and stop it again:
make start-x
make test-x
make stop-xThe container does not keep state.
Start the network, run the integration tests, and stop it again:
make start-fablo
make test-fablo
make stop-fabloBecause the gateway speaks standard Ethereum JSON-RPC, any Solidity tutorial works unchanged β just point the tool's network at the gateway instead of a public testnet:
| Setting | Value |
|---|---|
| RPC URL | http://localhost:8545 |
| Chain ID | 4011 |
| Gas | free β no account funding needed |
| Accounts | any key works |
Good starting points, pointed at the URL above:
- Foundry β deploy with
forge create --rpc-url http://localhost:8545 ...or send transactions withcast send --rpc-url http://localhost:8545 .... - Hardhat β add a network entry in
hardhat.config.jswithurl: "http://localhost:8545"andchainId: 4011, then deploy as usual. - MetaMask β add a custom network with the RPC URL and chain ID to interact from the browser.
A few things differ from a public chain β see Compatibility for the details (gas/fee fields are stubbed, access control is Fabric's, etc.). For a complete worked example, see the samples repo.
This repository uses different licenses for different components:
- Go code: All Go source code in this repository is released under LGPL-3.0-or-later (see
LICENSE.LGPL3) - Scripts: All scripts are released under Apache-2.0 (see
LICENSE.Apache2)
SPDX-License-Identifier: Apache-2.0 AND LGPL-3.0-or-later