fabric-x-evm makes Hyperledger Fabric-x (and Fabric) compatible with the
Ethereum ecosystem by providing an Ethereum-style JSON-RPC API and native
support for EVM smart contracts within Fabric’s permissioned environment. This
integration combines the rich Ethereum tooling and contract ecosystem with
Fabric’s robust endorsement and consensus model.
By embedding an Ethereum Virtual Machine (EVM) inside Fabric, developers can
deploy and execute existing Ethereum smart contracts without modification,
while benefiting from Fabric’s enterprise-grade features including fine-grained
access control, privacy, and deterministic consensus. The solution preserves
Fabric’s transaction flow, trust guarantees, and high performance while
enabling seamless use of the Ethereum development toolchain—including Solidity,
Hardhat, Foundry, and MetaMask.
This approach broadens Fabric’s appeal and lowers the barrier for organizations
that want to leverage existing Ethereum assets, developer expertise, and
tooling in a permissioned, enterprise blockchain setting.
The 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-local
Fabric-X
Generate the crypto material once:
make init-x
Then 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-x
The container does not keep state.
Fabric 3
To run the integration tests against a Fabric 3 network, get the fabric
samples. This downloads the binaries, test network and docker images.
Install dependencies and compile the ERC-20 smart contract
The smart contracts are already provided in the solidity/ directory. Install
the OpenZeppelin dependencies and compile:
cd solidity/OzepERC20
npm install
cd ../..
solc --bin --abi --storage-layout --overwrite --evm-version paris \
-o bin/GLDToken \
--base-path solidity/OzepERC20 \
--include-path solidity/OzepERC20/node_modules \
solidity/OzepERC20/GLDToken.sol
Generate a wallet
Copy the address and private key, they will be the deployer / admin wallet for
the contract.
cast wallet new
Configure Metamask
Follow instructions
here
to add a custom network with RPC URL http://localhost:8545 and chain id 31337.
[!IMPORTANT]
If you have used the wallet before and start with a clean network, reset the
nonce of the wallet by going to Settings -> Advanced -> Clear activity tab
data.
Start Fabric
make start-3
Running the application
Start the application:
cd gateway
go run .
Export environment variables
In another terminal, export the addresses and keys.
fabric-x-evm
fabric-x-evm makes Hyperledger Fabric-x (and Fabric) compatible with the Ethereum ecosystem by providing an Ethereum-style JSON-RPC API and native support for EVM smart contracts within Fabric’s permissioned environment. This integration combines the rich Ethereum tooling and contract ecosystem with Fabric’s robust endorsement and consensus model.
By embedding an Ethereum Virtual Machine (EVM) inside Fabric, developers can deploy and execute existing Ethereum smart contracts without modification, while benefiting from Fabric’s enterprise-grade features including fine-grained access control, privacy, and deterministic consensus. The solution preserves Fabric’s transaction flow, trust guarantees, and high performance while enabling seamless use of the Ethereum development toolchain—including Solidity, Hardhat, Foundry, and MetaMask.
This approach broadens Fabric’s appeal and lowers the barrier for organizations that want to leverage existing Ethereum assets, developer expertise, and tooling in a permissioned, enterprise blockchain setting.
Design
Here
Unit tests
Integration tests
Local
The 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.
Fabric-X
Generate the crypto material once:
Then start the Fabric-X testcontainer and create the namespace, run the integration tests against it, and stop it again:
The container does not keep state.
Fabric 3
To run the integration tests against a Fabric 3 network, get the fabric samples. This downloads the binaries, test network and docker images.
Start the network and create the namespace, run the integration tests against it, and stop it again:
Interacting with the system
Follow this guide to deploy a smart contract and interact with it.
Prerequisites
brew install solidity)Preparation
Install dependencies and compile the ERC-20 smart contract
The smart contracts are already provided in the
solidity/directory. Install the OpenZeppelin dependencies and compile:Generate a wallet
Copy the address and private key, they will be the deployer / admin wallet for the contract.
Configure Metamask
Follow instructions here to add a custom network with RPC URL http://localhost:8545 and chain id 31337.
Start Fabric
Running the application
Start the application:
Export environment variables
In another terminal, export the addresses and keys.
Deploy the smart contract and remember the address:
Transfer 100 tokens to the metamask wallet:
Go to your browser and verify that you can see the tokens. Copy the address of the admin and send some Gold back.
License
This repository uses different licenses for different components:
LICENSE.LGPL3)LICENSE.Apache2)SPDX License Expression