Guide for Client User

The Client User Guide offers a comprehensive, step-by-step overview of the Client User's role in the Privasea AI Network Testnet.

Remark: Ensure you have completed the prerequisites outlined here.

Minimum System Requirements

  • OS: Debian/Ubuntu (Recommended)
  • Storage: 100GB available storage
  • Memory: 8GB RAM
  • Processor: A processor with 6 cores, x86 architecture.
  • Port: Exposed TCP port 8181, make sure it's not occupied

Step 1: Pull docker image

First pull the docker image using the following command:

$ docker pull privasea/node-client:v0.0.1

Step 2: Start the Privasea Client

Start the Privasea Client using the following command:

$  docker run -it -e KEYSTORE_PASSWORD=123456  -v /home/jason/node/cli-config:/app/config privasea/node-client:v0.0.1 task --keystore UTC--2023-12-31T13-28-31.089020288Z--96d75ec76f90da3d667dffeeb0e7474f6738798f

The user needs to customize the specified section in the above command:

  • KEYSTORE_PASSWORD=123456: Replace with the password of the keystore file
  • /home/jason/node/cli-config: Replace this part with the path to store the keystore file on the host machine.
  • /app/config: This is the mapping directory in the container, do not change this.
  • UTC--2023-12-31T13-28-31.089020288Z--96d75ec76f90da3d667dffeeb0e7474f6738798f: Replace this part with the file name of the keystore file (not the full path).

Step 3: Submit a Task Through Privasea Client

Upon successfully launching the client, users can submit privacy-preserving machine learning requests through the Privasea client.

Select a model

At first step, user need to select a build-in model to begin with. Check here for model instruction.

UTC--2023-12-27T11-48-14.749415000Z--3657ea851e06c61a58a14cced55b93f1f7eebde5
t=2024-01-02T15:04:48+0100 lvl=info msg="Starting task..." dir=.
t=2024-01-02T15:04:48+0100 lvl=info msg="py work dir is"   dir=./fhe_client
t=2024-01-02T15:04:48+0100 lvl=info msg=[user-pubkey]      pubkey=04d220bd3f9ea34c06551e23dbf551d4c7939489858f3a570ef14315886d08d8028288dd65924c0a059d6251143187d58d080dd629e8160331322da31a8f734e2d
please you choose client model, can you choose 1, 2, 3, 4
>

Enter the model id of the task to be created, such as 1, and then press Enter:

> 1
please input you vector, if you want default vector, please input enter
>

Enter the feature vector

After selecting the model, users are required to input a feature vector for this model. We provide test dataset for each model here for your convenience. Select one x vector from the table and copy it.

Input Feature Vector

Then, paste the feature vector of the model test data in the command:

> [1.247e+01 1.860e+01 8.109e+01 4.819e+02 9.965e-02 1.058e-01 8.005e-02 3.821e-02 1.925e-01 6.373e-02 3.961e-01 1.044e+00 2.497e+00 3.029e+01 6.953e-03 1.911e-02 2.701e-02 1.037e-02 1.782e-02 3.586e-03 1.497e+01 2.464e+01 9.605e+01 6.779e+02 1.426e-01 2.378e-01 2.671e-01 1.015e-01 3.014e-01 8.750e-02]

Encrypt the vector in local side

After entering, the program will encrypt the feature vector and generate a task package:

fheClientWorkDir:  ./fhe_client
./fhe_client
exec: python3 ./fhe_client/go_itf/client_fhe_pkg/generate_client_fhe_pkg.py 20240102150539071484 [1.247e+01 1.860e+01 8.109e+01 4.819e+02 9.965e-02 1.058e-01 8.005e-02 3.821e-02 1.925e-01 6.373e-02 3.961e-01 1.044e+00 2.497e+00 3.029e+01 6.953e-03 1.911e-02 2.701e-02 1.037e-02 1.782e-02 3.586e-03 1.497e+01 2.464e+01 9.605e+01 6.779e+02 1.426e-01 2.378e-01 2.671e-01 1.015e-01 3.014e-01 8.75
exec script finished!
1
/app/fhe_client/FHEModelDev/XGBClassifier/key
Evaluation keys size: 159.58 MB
version: 1.0.5
write version: 1.0.5
write model_id:1
write task info ok!
pkg_dir = /app/fhe_client/client_pkg_20240102150539071484
client_pkg_file: ./fhe_client/client_pkg_20240102150539071484.tar.gz
encrypted_input_txt: ./fhe_client/client_pkg_20240102150539071484/encrypted_input.txt
t=2024-01-02T15:05:55+0100 lvl=info msg="get node success" nodeId=0xe674b632a9780110af23e4906779105998198479 nodePk=045bc68345062bfeb1fa799e7d3258aec3b36a1b5b0287449a547189087b524559e09ff0f3da1413de55c66ec5c9cf6653afbf541524ab4099bdafe319e73eee20
file uploaded to https://testnet.s3.filebase.com/client_pkg_20240102150539071484.tar.gz
please input you task reward

Submit task execution through transaction

After packaging the task, it will be submitted to a Privanetix node through a transaction. Users need to decide how many test tokens they want to pay to the node as a reward. The minimum amount is 20, and users can input any integer greater than 20 and smaller than their balance. Once the user press Enter, the transaction will be sent to the BSC testnet.

Wait the result of task execution

After submission, the client will continuously check its status in real-time, as depicted below. Please note that this process may take some time, so we recommend being patient.

t=2024-01-02T15:06:56+0100 lvl=info msg="[upload IPFS success]" "ipfs path"=https://testnet.s3.filebase.com/client_pkg_20240102150539071484.tar.gz taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98
t=2024-01-02T15:06:56+0100 lvl=info msg="commitTask "           nodeAddrStr=0xe674b632a9780110af23e4906779105998198479 taskIdStr=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 taskContract=0xe83796b91a4c821E8E0a661c09C86A4e17fCE357 rewardAmount=20 stakeContract=0xab8dC28A610EC863b1574d3927eD005340aEbB08
t=2024-01-02T15:06:57+0100 lvl=info msg=EstimateGasLondon       maxPriorityFeePerGas=10,000,000,000 maxFeePerGas=10,000,000,000 baseFee=0
t=2024-01-02T15:06:57+0100 lvl=info msg="sendTx opt"            nonce=14 gasFeeCap=10,000,000,000 gasTipCap=10,000,000,000 to=0xe83796b91a4c821E8E0a661c09C86A4e17fCE357 gasLimit=46338
t=2024-01-02T15:07:00+0100 lvl=info msg="Tx is Pending, please wait..." tx=0xd78f57f48820c462471b0356d6177b76e18ae835afd2074aa001b7fef44a94e7
t=2024-01-02T15:07:05+0100 lvl=info msg="Tx receipt status is success"  hash=0xd78f57f48820c462471b0356d6177b76e18ae835afd2074aa001b7fef44a94e7
t=2024-01-02T15:07:05+0100 lvl=info msg="approve success, will commitTask"
t=2024-01-02T15:07:06+0100 lvl=info msg=EstimateGasLondon                  maxPriorityFeePerGas=10,000,000,000 maxFeePerGas=10,000,000,000 baseFee=0
t=2024-01-02T15:07:06+0100 lvl=info msg="sendTx opt"                       nonce=15 gasFeeCap=10,000,000,000 gasTipCap=10,000,000,000 to=0xab8dC28A610EC863b1574d3927eD005340aEbB08 gasLimit=146,441
t=2024-01-02T15:07:09+0100 lvl=info msg="Tx is Pending, please wait..."    tx=0x9b1245a75a10d1f0dc566133d112947adef6e48cdeafd9ea0a1b06bba3c67690
t=2024-01-02T15:07:14+0100 lvl=info msg="Tx receipt status is success"     hash=0x9b1245a75a10d1f0dc566133d112947adef6e48cdeafd9ea0a1b06bba3c67690
t=2024-01-02T15:07:14+0100 lvl=info msg="[commitTask to contract success]...."
t=2024-01-02T15:07:14+0100 lvl=info msg="[commitTask to backend success]............."
t=2024-01-02T15:07:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:08:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:09:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:10:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:11:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:12:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:13:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:14:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:15:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil
t=2024-01-02T15:16:14+0100 lvl=info msg="[query task] [task is pending]"       taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 err=nil

Step 4: Get the Result of Task Execution

When the client displays the provided information, it indicates the completion of the task, and the computed result is received in ciphertext domain. The client will decrypt the result using the key stored locally.

Downloaded file, 125984 bytes
t=2024-01-02T15:17:15+0100 lvl=info msg="[query task] [task decrypt success, will write to file]" taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 fileName=./fhe_result_20240102151632342791.tar.gz data=125,968
./fhe_client
exec: python3 ./fhe_client/go_itf/client_fhe_pkg/decrypt_prediction_result.py ./fhe_client ./fhe_result_20240102151632342791.tar.gz
exec script finished!
decrypted_prediction_result: [0.12789139 0.87210861]
decrypt prediction pkg success!
t=2024-01-02T15:17:20+0100 lvl=info msg="[query task] [task result]"           taskId=d8ed8a12656c6ada5943dbf69e62457991c6d84b1e4e389bf81fdfd14db34c98 encrypted=./fhe_result_20240102151632342791/encrypted_prediction.txt

The decrypted_prediction_result: [0.12789139 0.87210861] represents the final plaintext outcome of the task, in this model, indicating the likelihood of associated tags. Users can compare this result with the actual output Y in the test dataset.

Output Tag

results matching ""

    No results matching ""