Skip to content
You are reading Hyperledger Besu development version documentation and some displayed features may not be available in the stable release. You can switch to stable version using the version box at screen bottom.
Last update: October 30, 2020

web3js-eea client library

The web3js-eea library adds a property to your web3 instance by extending web3. Use the library to create and send RLP-encoded transactions using JSON-RPC.


web3js-eea supports JSON-RPC over HTTP only.


Add web3js-eea to project

npm install web3-eea

Initialize EEA client

Initialize your EEA client where:

  • <JSON-RPC HTTP endpoint> is the JSON-RPC HTTP endpoint of your Hyperledger Besu node. Specified by the --rpc-http-host and --rpc-http-port command line options.
  • <chain_id> is the chain ID of your network.


const EEAClient = require("web3-eea");
const web3 = new EEAClient(new Web3("<JSON-RPC HTTP endpoint>"), <chain_id>);
const EEAClient = require("web3-eea");
const web3 = new EEAClient(new Web3("http://localhost:8545"), 2018);

Deploying a contract with sendRawTransaction

To deploy a private contract, you need the contract binary. You can use Solidity to get the contract binary.

Deploying a Contract with sendRawTransaction

const contractOptions = {
  data: `0x123`, // contract binary
  privateFrom: "orionNode1PublicKey",
  privateFor: ["orionNode3PublicKey"],
  privateKey: "besuNode1PrivateKey"
return web3.eea.sendRawTransaction(contractOptions);

web3.eea.sendRawTransaction(contractOptions) returns the transaction hash. To get the private transaction receipt, use web3.eea.getTransactionReceipt(txHash).

web3js-eea methods

For more information about the web3js-eea methods, see the web3js-eea reference documentation.

Questions or feedback? You can discuss issues and obtain free support on Hyperledger Besu chat channel.
For Hyperledger Besu community support, contact the mailing list