2PM.Network
WebsiteXDiscordLinkedinGithub
  • Overview
    • What is 2PM.Network
    • Architecture
    • FAQ
    • Official Social Channels
  • 2PM Data VSIES Service
    • What is Data VSIES and why is it important
    • [V] Data Validation (ZK)
    • [SI] Data Standardization and Index
    • [E] Data Encryption Client (FHE)
    • [S] Data Storage and Access
    • Data VSIES SDK
  • Node Framework
    • Modular Architecture
    • Federated Learning
      • Horizontal Federated Learning Task
      • Logistic Regression Task
      • On-chain Secure Aggregation
      • Typical Scenarios
    • FHE Machine Learning
      • Built-in Models
      • Deep Learning
      • Typical Scenarios
    • Task Submission
    • Running a 2PM Node
      • Installation
      • Chain Connector Configuration
      • Data Preparation
      • Joining a Subnet
  • Security and Verification
    • Node Staking and Slash Mechanism
    • Running Verification Client
      • EigenLayer
      • Mind Network
    • Restaking and Delegation
  • Model Inference
    • 2PM Node Inference API
    • Posting Request to a Subnet Model
    • Getting Inference Results on Chain
      • Oracle Adapters
  • Monetization and Incentives
    • AI Model IP Assets
    • Distribution Algorithm
  • 2PM DAO
    • Build Subnets
      • Establishing New Subnets
      • General Requirements
      • Data Schema Definition
      • Model Selection
      • Task Implementation
    • $DMP Token
  • Deployed Smart Contracts
    • Subnets on Testnets
    • Local Deployment Guideline
  • Ecosystem
    • Partners
    • Use Cases
      • Private Personalized Recommendation
Powered by GitBook
On this page
  • Downloading the Image
  • Initializing Configuration
  • Modifying the Configuration File
  1. Node Framework
  2. Running a 2PM Node

Chain Connector Configuration

The Chain Connector serves as a middleware linking the 2PM Node with blockchain systems. It abstracts the blockchain interface, enabling the 2PM Node to support a variety of different blockchain systems. Additionally, the Chain Connector is responsible for key management and signing tasks required by the blockchain system, ensuring the secure usage of these keys.

Downloading the Image

Copy and execute the following command to pull the Docker image:

$ docker pull 2pmmpc/2pm-chain-connector:latest

Initializing Configuration

Before launching the Connector, it is necessary to first initialize its configuration:

Start by creating a new folder named 2pm_chain_connector, which will serve as the root directory for launching the node:

$ mkdir 2pm_chain_connector

Navigate into the node's root directory and enter the following command:

$ cd 2pm_chain_connector
$ docker run -it --rm -v ${PWD}:/app 2pmmpc/2pm-chain-connector:latest init

After executing this command, a new folder named config will be created within the root directory 2pm_chain_connector. This config folder is used to store the node’s configuration files.

Modifying the Configuration File

Below is an example of a configuration file that needs to be updated according to your specific blockchain and smart contract requirements:

{
  "log": {
    "level": "debug"
  },
  "impl": "chain",
  "host": "0.0.0.0",
  "port": 4500,
  "evm": {
    "nodeAddress": "YOUR_PUBLIC_KEY",
    "privateKey": "YOUR_PRIVATE_KEY",
    "provider": "ws://localhost:8545",
    "gasPrice": "CHAIN_GAS_PRICE",
    "gasLimit": "CHAIN_GAS_LIMIT",
    "chainParam": {
      "chainId": "CHAIN_ID",
      "name": ""
    },
    "identity": {
      "contractAddress": "REPLACE_WITH_REAL_ADDRESS"
    },
    "hfl": {
      "contractAddress": "REPLACE_WITH_REAL_ADDRESS"
    },
    "datahub": {
      "contractAddress": "REPLACE_WITH_REAL_ADDRESS"
    },
    "hlr": {
      "contractAddress": "REPLACE_WITH_REAL_ADDRESS",
      "verifiers": {
        "3": "REPLACE_WITH_REAL_ADDRESS"
      }
    }
  }
}

Next, you will need to update the following configurations in the evm section of your file:

  • evm.nodeAddress and evm.privateKey: These are used to configure your blockchain wallet address and private key. You can generate these using any EVM-compatible wallet, such as MetaMask.

This wallet account will also be the one you need to use to stake $2PM before joining any subnets, and to receive rewards after performing computing tasks.

  • evm.provider: This should be set to your blockchain node's WebSocket URL.

  • evm.identity, evm.hfl, evm.datahub, and evm.hlr: These entries correspond to configurations for the IdentityContract, HFLContract, DataHub, and HLR smart contracts respectively. Each contractAddress field represents the address of the corresponding smart contract. In the evm.hlr.verifiers section, you configure addresses for zero-knowledge proof verifiers specific to different input lengths, for instance, evm.hlr.verifiers.3 refers to the address for the smart contract PlonkVerifier3.

Each subnet has corresponding contracts deployed, and you will need to look up these contracts in the subnet information section (deployed smart contracts) to find them.

PreviousInstallationNextData Preparation

Last updated 10 months ago