Connect to a Module
Through ModuleClient
To connect to a miner using the torus-cli
, you can simply use the ModuleClient
class. It would look like this:
keypair
is thekeypair
you’re going to use on your client. Miners only accept connections from clients with a key registered on the Torus network, and on the same subnet (netuid) as them.target_key
is the SS58 Address of the miner you’re going to connect to.
On Your Own
If you don’t want to use python to make your requests, you can implement your own client as you wish, but some particularities needs to be followed:
- Your request should be a json with the fields params, timestamp and target_key.
- You should include X-Key, X-Crypto and X-Signature on the headers.
timestamp
is the ISO timestamp of your request, target_key is the ss58address of the miner that your request is directed at.
params
is the actual data that the miner expects on the endpoint. This json should be signed to create a SR25519 signature that
You’re going to put on the X-Signature header.
X-Crypto
is the type of cryptography of your key (currently only SR25519 is supported) and
X-Key
is the hexstring of your public key.