Making Requests to Mishti Network

Once you have credits, you may make a request to the Mishti Network via the Relay node. For the testnet on Holesky, the Relay node can be reached at via HTTP requests to http://159.65.246.91:3031

Requests to the network are of the following format


pub struct RequestToNetwork {
    /// The method of the request
    pub method: Method,
    /// Encoded point to be multiplied
    pub point: Vec<u8>, 
    /// Which epoch this request is from
    pub epoch: u32,
    /// Which request number this is from this user in this epoch. Starts at 1 not 0 to ensure the first request is paid for.
    pub request_per_user: u32,
    /// Signature of the request, from an address with credits. 
    pub signature: Option<ethers_core::types::signature::Signature>,
    /// Extra optional data
    pub extra_data: Option<Vec<u8>>,
}

Method is an enum with the following format

pub enum Method {
    OPRFSecp256k1,
    DecryptBabyJubJub,
    JWTPRFSecp256k1,
}

Here is an example request:

{
  "method": "OPRFSecp256k1",
  "point": [2,58,211,253,26,34,132,83,157,111,80,144,179,1,88,82,243,119,99,104,156,248,158,115,87,30,114,39,90,142,78,236,28],
  "epoch": 123,
  "request_per_user": 69,
  "signature": {
    "r": "0xe3fbde1404800f5ac238b30f2118b69a1cdb604d0b4227056f18f87beb83abf2",
    "s": "0x9132d353ef806f526ef5e48cbee6872a11fcf688c2d92023a384d0f02082466",
    "v": 28
  },
  "extra_data": null
}

How to find the epoch, request_per_user, and signature fields

To make a request to the network you need to know a few things

  • epoch

  • request_per_user signifying how many requests the signer who signed off on the request has made

  • signatureby the user who signed the request who you need to have credits at the address who signed the request.

There are two ways of getting this data:

  1. Spin up a Signer to simplify this on behalf on end users. A Signer keeps track of this state and signs requests on behalf of the end user. This way, users don't need to acquire Mishti credits or keep track of global state. An example of a Signer is provided here.

  2. End users can directly interface by acquiring credits and querying the epoch and their request number via the POST /user-state/ endpoint to find the user

pub struct StateRequest {
    pub user: ethereum_types::Address,
    pub method: Method,
}

Last updated