# Signer on behalf of users

If you have a dapp, we suggest that you sponsor requests on behalf of your users using the Signer.

To use the Signer you will want to&#x20;

1. Build the signer
2. Obtain credits for the signer.&#x20;
3. Optionally, set up custom rate limiting so that users cannot exhaust your credits too quickly.
4. Send user requests to the signer to be sponsored

### Build the signer

#### Using docker (easy, but no rate limit)

If you do not want to add a custom rate limit, you can fetch the signer as a Docker image `mishtinetwork/signer`

Please, provide the team your docker hub email address or username so we can give you access to the docker image.

To run the Signer enter the following commands:

```
sudo docker run -d --name signer -p {SIGNER_PORT_FROM_ENV}:{SIGNER_PORT_FROM_ENV} --env-file .env mishtinetwork/signer
```

with the following .env file

```
SIGNER_ENV=prod
MISHTI_RPC_URL=<MISHTI_RELAY_NODE_MAINNET_ALPHA_URL>
MISHTI_SIGNER_PRIVATE_KEY=<YOUR_WHITELISTED_PRIVATE_KEY ex: 0x4a54...>
SIGNER_PORT=<DESIRED_PORT_DEFAULT_IS_3030>
ALLOWED_METHODS=<ADD_HERE_THE_ALLOWED_METHODS>
# If you want to enable rate limiting, default is true
RATE_LIMIT_ENABLED=true
# This is the maximum number of requests allowed in the time interval, default is 100
RATE_LIMIT_NUM_REQUESTS=100
# in seconds, default is 1 day
RATE_LIMIT_TIME_INTERVAL=86400
```

{% hint style="info" %}

* **MISHTI\_RELAY\_NODE\_MAINNET\_ALPHA\_URL:** `http://44.217.242.218:8081`
* **MISHTI\_SIGNER\_PRIVATE\_KEY:** Use this private key to obtain credits or get whitelisted.
  {% endhint %}

{% hint style="info" %}
The `ALLOWED_METHODS` environment variable specifies which request methods the signer service allows. Set it as a comma-separated list of method names.&#x20;

**Permitted Methods:**

* OPRFSecp256k1
* OPRFBabyJubJub
* JWTPRFSecp256k1 (Not for external integrators)

&#x20;Eg:

`ALLOWED_METHODS=OPRFSecp256k1,OPRFBabyJubJub`&#x20;

Only the methods listed in `ALLOWED_METHODS` will be processed. Others will be rejected. Update this variable to manage which operations the signer will accept.
{% endhint %}

{% hint style="warning" %}
To prevent unauthorized usage and credit exhaustion, run the signer on a private network and secure it with an authentication server.
{% endhint %}

#### From source (slightly more work, but allows custom rate limiting)

*Coming soon...*

### Obtain Credits

To obtain credits, please review:

{% content-ref url="/pages/H8fEr2XVgcgU5ws25cJZ" %}
[Human Network Credits](/for-developers/human-network-credits.md)
{% endcontent-ref %}

### Make Requests to the Signer

Then from our mishtiwasm, you'll be able to form the correct requests to send to your Signer.

mishtiwasm can be fetched by running:

```
npm i @holonym-foundation/mishtiwasm
```

Here is an example of a frontend code for generating keys from input data using mishtiwasm and the signer.&#x20;

```
import initMishtiwasm, { request_from_signer } from '@holonym-foundation/mishtiwasm';

async function runRequest() {
  await initMishtiwasm();

  request_from_signer("usr:123", "OPRFBabyJubJub", "http://127.0.0.1:3000")
     .then(result => {
        console.log(`Request succeeded:`, result);
     })
     .catch(err => {
        console.error(`Request failed:`, err);
     })
     .finally(() => {
        console.log("Request completed");
     });
}

runRequest();
```

Please refer to this GitHub repository to run an example program:

{% embed url="<https://github.com/AnmolBansalDEV/mishtiwasm-play>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.network.human.tech/for-developers/making-requests-to-human-network/signer-on-behalf-of-users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
