Fully Permissionless - Pocket Network
If you want to add a model to the Pnyx router but you want to stay in the dark, or you just don't want to talk to anybody, this is the way. We won't ask who you are nor keep you from providing services, you will enter the playground as any other humble model and if you prove to be worthy (i.e. good for any given task) the router will automatically assign work to you. To achieve this we use the Pocket Network, a blockchain service.
The Pocket Network is a decentralised API protocol that enables any kind of services (RPC based) to join, no gate keeping, no KYC, just connect and relay. In this document we will show you how to set-up your model and connect it to the network and hence become part of Pnyx.
We will be setting up 3 different modules using this tutorial, following the guide in this example repository :
- Staking Module : The teokenomics-related actions within the Pocket Network, we will setup a supplier entity with POKT tokens in scrow.
- Relayer and Miner Module : The core of the Pocket Network mechanics, we will deploy the modules that check request origin and mine rewards for work done.
- Backend Module : The actual service that you will supply to the network, in this example we will deploy a vLLM Engine backend with a Poncho Side-car.
Requirements
Storage
20 GB of disk space, mostly for vLLM image + model weights. The Miner, Relayer and Poncho are very slim.
Memory
~4 GB RAM
Processing
3 vCPUs + GPU (NVIDIA RTX 20 series or newer for this tutorial)
Tokens
60,000 POKT Tokens for staking
- Docker Compose: You will need to have it installed and make sure it has the nvidia-docker toolkit working correctly.
- A Domain Name: Your service needs to be reachable, so you will need a domain name to point to your RelayMiner deployment.
Staking your Supplier
The first step is creating and staking your supplier in the Pocket Network. The supplier is your identity in the blockchain and it will be the recipient of the payments you receive from traffic.
For this you will first need to install the pocketd binary in your system, you can get it directly in the Pocket Network repository. To install it follow the provided guide here. After that, proceed to create your account:
pocketd keys add my-supplierYou will see a message with a field like: - address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj (not this one exactly...) that will be your supplier address. That's the public key (they all start with pokt1), save it and also save your recovery phrase safely!
The next step is to fund your wallet with 60010 POKT tokens, the extra 10 will be used for fees and node operation (your account cannot be empty). You can buy POKT tokens in many exchanges, which one will depend on your country of residence (you can find a list of exchanges in Coinmarketcap).
Once you have the tokens in your supplier address, you can proceed to stake it in the Pocket Network. To do this, first create a yaml file with the following content:
owner_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
operator_address: pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj
stake_amount: 60000000000upokt
default_rev_share_percent:
pokt19a3t4yunp0dlpfjrp7qwnzwlrzd5fzs2gjaaaj: 100
services:
- service_id: "text-generation"
endpoints:
- publicly_exposed_url: https://relayminer.your.domain.name
rpc_type: JSON_RPC(Replace the address and domain name!)
We are using a service called text-generation which is a generic service for LLM models, since this is a permissionless network, we cannot force you to use any specific model. Save this file as supplier_stake_config.yaml and send the stake command by doing:
pocketd tx supplier stake-supplier \
--config=supplier_stake_config.yaml \
--from=my-supplier \
--gas=auto \
--gas-prices=1upokt \
--gas-adjustment=1.5 \
--node https://sauron-rpc.infra.pocket.network \
--yesAt the end you will receive a txhash you can copy it and search for it in POKTscan, it should take less than 5 minutes to see it successfully processed. Nevertheless it can take up to 30 minutes for your supplier to be detected by the network's applications.
Congratulations, your supplier identity is already in the Pocket Network! Now let's deploy the backend...
Relayer and Miner
Now we need to setup the relayer and the miner. The relayer will respond to the Pocket Network requests, communicating with the backend (vLLM in this case) and answering the end user (Pocket Network Application). The miner will be in constant communication with the relayer, providing the required data (staying in sync with the blockchain) and looking for payable rewards. This configuration still depends on a node, but to keep this simple we will be using the public endpoints instead of creating a local fullnode.
The easiest way to deploy this is following the example repository, there you will find the docker compose and config files in the relay-and-miner section. We will be using those templates and changing some of the values, since we want to use mainnet instead of testnet.
First we must modify the network endpoints in the relay-and-miner/config/miner-config.yaml and relay-and-miner/config/relayer-config.yaml files to make them match:
pocket_node:
query_node_rpc_url: "https://sauron-rpc.infra.pocket.network"
query_node_grpc_url: "sauron-grpc.infra.pocket.network:443"
grpc_insecure: falsedThen, only in the relay-and-miner/config/miner-config.yaml file, we need to modify the known app:
known_applications:
- "pokt1lh9lp8x6ws7qezs87nd0vqv95svt2wwkyw2h0l"Finally we need to add the keys to our supplier (the one we created in the previous module). First proceed to get your unarmored-hey key (this is very sensitive data, make sure not to leave it in plain text in production).
pocketd keys export --unarmored-hex --unsafe my-supplierFinally we need to add the unarmored-hex key the relay-and-miner/config/supplier-keys.yaml file:
keys:
- "the_long_string_that_you_obtained_from_last_command"And thats it, we can start running the relayer and miner by doing:
docker compose up -dAlmost there! Your relayer and miner are already running and communicating with the Pocket Network! Now let's deploy the vLLM and Poncho so we can properly serve the Pocket Network Apps...
Model Backend Configuration
To deploy the vLLM+Poncho bakcjend we will be following the example repository, specifically the docker compose and config files in the backend section.
We only need to create a .env file following the template:
cp backend/.env.sample backend/.envThen edit the following lines:
# Your HuggingFace token, vLLM will use this to download the model if needed
HF_TOKEN=hf_zzzzzzz
# Where you want to keep the models in the host machine, any path will do
MODELS_PATH=/your/host/huggingface_hub/
Finally we can start the vLLM+Poncho backend:
Note: Make sure you have the relayer-and-miner deployment running (we launched it in the last module), since this backend deployment uses the network created in that other docker-compose file.
docker compose up -dAll done! Your vLLM and Poncho should be running and communicating with the relayer and miner!
DONE, Now What??
Congratulations, you have your supplier deployed! Have a beer! 🍺
Now you will need to wait... The Pnyx router works along-side the Pocket-ML-Testbench, it will take approx. 24 hrs to check you and then you will start receiving "liveness" tests, after that (if your model proves to be real) you will be slowly benchmarked. The full process can take up to 4 days.
You can check the state and rewards of your node in POKTscan's operator page by entering the public key of your supplier (the one starting with pokt1...).