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
Build the signer
Obtain credits for the signer.
Optionally, set up custom rate limiting so that users cannot exhaust your credits too quickly.
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
To prevent unauthorized usage and credit exhaustion, run the signer on a private network and secure it with an authentication server.
From source (slightly more work, but allows custom rate limiting)
Coming soon...
Obtain Credits
To obtain credits, please review:
Human Network CreditsMake 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.
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:
Last updated