Installation
The Node Framework is currently undergoing testing and will be released soon.
Starting a 2PM Node Using Docker Image We recommend deploying using the 2PM Node Docker image for optimal performance and ease.
Downloading the Image
Pull the latest release version of the image from Docker Hub:
$ docker pull 2pmmpc/2pm-node:latest
Initializing Configuration
The 2PM-node node stores data including configuration files, saved user data, and system operation logs. Before launching the node service, it is necessary to initialize the configuration:
First, create a new directory named 2pm_node
which will serve as the root directory for the node launch:
$ mkdir 2pm_node
Within the node root directory, enter the command:
$ cd 2pm_node
$ docker run -it --rm -v ${PWD}:/app 2pmmpc/2pm-node:latest init
After running the command, new directories such as config
, task
, and data
will be created within the root directory 2pm_node
. The config
folder stores the node's configuration files, the task
folder holds intermediate results of node tasks, and data
stores the data provided by the node.
Modifying Configuration Files
In the config
folder, there will be a pre-generated configuration file config.yaml
. Before the first launch, it is essential to modify certain entries. One of the necessary changes is the address of the Chain Connector, which should be updated to the IP address configured in the previous section. Another is the 2PM Node's own IP address, which is needed for identity registration on the blockchain, allowing other nodes to communicate with this node. Find the public IP address of this node and enter it into the configuration file:
# Blockchain node connection configuration
chain_connector:
# Address of the blockchain connector
host: "127.0.0.1"
# Port of the blockchain connector
port: 4500
# This node's public address, which will be published to the blockchain for other 2PM Node connections
node:
# Name of this node
name: "2pm_node_1"
# Public address of this node
url: "127.0.0.1:6700"
# Zero-knowledge proof service connection configuration
zk:
# Zero-knowledge proof service address
host: ""
# Zero-knowledge proof service port
port: 3400
# Listening address for this node's HTTP service, used for 2PM Task registration
api_port: 6700
After completing the configuration, you are now ready to launch the 2PM Node.
Launching the Node Service
Use the Docker command line to create and start the node container, binding the folder created in the previous step to the container's internal /app
folder. Additionally, the 2PM Node needs to expose port 6700 for external APIs and node-to-node communication:
$ docker run -d --name=2pm_node_1 -v ${PWD}:/app -p 6700:6700 2pmmpc/2pm-node:0.8.3
To monitor the container's execution status and confirm that the node has started successfully, use Docker's logs
command:
$ docker logs -f 2pm_node_1
The 2PM Node also outputs logs to the log
directory within the local data folder, where you can review the node's operational logs.
With the 2PM Node now up and running, before executing any 2PM computation tasks, ensure to place some required data within the data
folder of the 2PM Node, as this data will be needed for the computation tasks:
Alternatively, you can request data for FHE Machine Learning Tasks from 0G Storage Nodes Through Node Data Connector.
Last updated