Configuring the Fab3 Proxy

In the Ethereum/EVM development world, many clients and wallets use the web3 library to deploy and manage smart contracts in Ethereum networks.

The web3 library invokes the Ethereum JSON RPC API, which must be available through a web3 provider.

The fab3 proxy is a web3 provider, which exposes a set of the Ethereum JSON RPC APIs and facilitates the use of a web3-based client with the EVM chaincode. The fab3 proxy uses the Hyperledger Fabric Go SDK to connect and interact with the Oracle Blockchain Platform evmcc chaincode.

The following steps guide you through setting up the environment to use the web3 library and the fab3 proxy to deploy and interact with smart contracts in Ethereum Virtual Machine (EVM) chaincode.

  • Before you configure the fab3 proxy, you must follow all of the steps to set up the EVM chaincode. See Run Solidity Smart Contracts with EVM on Oracle Blockchain Platform. The EVM chaincode and fab3 package contains the connection profile, including the network.yaml file and artifacts.
  • The following steps apply only to Oracle Blockchain Platform instances running on Hyperledger Fabric v2.x.
  1. On the Developer Tools tab of the service console, open the Application Development pane, and then click Download Fab3 configuration including connection profile. You must be an admin user to download the file.
  2. Extract the files from the package that you downloaded.
  3. Export the admin credentials from the service console.
    1. On the Network tab, click the More Actions button for your organization in the Organizations table.
    2. Click Export Admin Credential.
    3. Click OK to save the credentials archive file.
    4. Extract the downloaded file.
  4. Copy the admin certificate (.pem file) that you extracted in the previous step to the following locations, substituting the actual organization and user IDs in the paths:
    ./artifacts/crypto/peerOrganizations/<organization-id>/users/<user-id>/msp/signcerts/
    ./artifacts/crypto/peerOrganizations/<organization-id>/users/<user-id>/msp/keystore/
  5. Set up the environment variables that are required for the fab3 proxy. For more information about the required environment variables, see Setting up the Fab Proxy at EVM Smart Contracts.
    export FAB3_CONFIG= # Path to the network.yaml in the extracted EVM chaincode and fab3 package
    export FAB3_USER= # User identity being used for the proxy (Matches the users names in the crypto-config directory specified in the config)
    export FAB3_ORG= # Organization of the specified user
    export FAB3_CHANNEL= # Channel to be used for the transactions
    export FAB3_CCID= # ID of the EVM Chaincode deployed in your fabric network
    export FAB3_PORT=5000 # Port the proxy will listen on. If not provided, the default is 5000.
  6. Open a terminal window in the folder where you extracted the fab3 package. In the Hyperledger EVM Smart Contracts documentation, follow the steps in the Building the Fab Proxy section to build the fab proxy and in the Connecting to the Proxy section to install web3 and connect to the proxy.
You can now follow the steps in the Deploying a Contract and Interacting with a Deployed Contract sections of the Hyperledger EVM Smart Contracts documentation to deploy and interact with smart contracts using the web3 library.