FAQ

Here you can find answers on frequently asked question, some hints and "how-tos" that might help you deal with common routines.

How can I get some HMT tokens in testnet?
How to generate ES256 key pair?

In order to generate ES256 key pair you first need to generate private key:

openssl ecparam -name prime256v1 -genkey -noout -out jwt-private.pem

You can choose any path and name instead of jwt-private.pem . When you have private key - you can use it to generate public key:

openssl ec -in jwt-private.pem -pubout -out jwt-public.pem
How to generate PGP key pair?

In order to generate PGP keys you can use gpg wizard:

gpg --full-generate-key

When going through the process:

  • choose RSA and RSA or ECC (recommended) key type to be able to encrypt/decrypt messages

  • choose 0 expiration (key does not expire) so there will be no need to rotate keys

  • remember/write your passphrase somewhere, because you will need it

Once you have your keys generated, export them to text files:

To export public key
gpg --export --armor email.of.the.key@example.com > public_key.asc
To export private key
gpg --export-secret-keys --armor email.of.the.key@example.com > private_key.asc
How can I pass captcha verification for API calls on local environment?

For local/developer environment hCaptcha test keys are used. You can find a response token that corresponds to environment sitekey and use it in API requests.

How to clear the DNS cache on my PC?

MacOS:

sudo killall -HUP mDNSResponder

Linux:

sudo systemctl restart systemd-resolved

Windows:

ipconfig /flushdns
How can I pass KYC for workers w/o setting up KYC provider?

In order to synthetically pass KYC you will need to connect to Reputation Oracle database and insert an item like on example below to kycs table:

{
  "id": <user-id-to-approve-kyc>, // unique kyc record id
  "created_at": "YYYY-MM-DD HH:MM:SS.000000 +00:00",
  "updated_at": "YYYY-MM-DD HH:MM:SS.000000 +00:00",
  "session_id": <kyc-sesion-id>, // unique
  "status": "approved",
  "message": null,
  "user_id": <user-id-to-approve-kyc>,
  "country": null,
  "url": <kyc-verification-url> // unique
}
How can I set up KV Store values for oracle?

You can use this sample Node.js script to set up oracle's KV Store:

/* eslint-disable no-console */
import { ChainId, KVStoreClient, KVStoreKeys, KVStoreUtils, Role } from '@human-protocol/sdk';
import { Wallet, JsonRpcProvider } from 'ethers';

const rpcUrl = 'https://rpc-amoy.polygon.technology';
const chainId = ChainId.POLYGON_AMOY;
const address = 'oracle_address';
const privateKey = 'oracle_private_key';

async function setupOracleKV() {
  const provider = new JsonRpcProvider(rpcUrl);
  const signer = new Wallet(privateKey, provider);
  const kvStoreClient = await KVStoreClient.build(signer);

  // Pick oracle role from pre-defined values
  const role = Role.ExchangeOracle;
  // Fee percentage: valid integer from 0
  const fee = 1;
  // Full Oracle URL
  const url = 'http://exchange-oracle:5000';
  // Webhook url as per standard
  const webhookUrl = `${url}/webhook`;
  // Job types supported by oracle
  const jobTypes = 'image_points,image_boxes,image_boxes_from_points,image_skeletons_from_boxes,image_polygons';

  await kvStoreClient.setBulk(
    [
      KVStoreKeys.role,
      KVStoreKeys.fee,
      KVStoreKeys.url,
      KVStoreKeys.webhookUrl,
      KVStoreKeys.jobTypes,
    ],
    [
      role,
      `${fee}`,
      url,
      webhookUrl,
      jobTypes,
    ],
  );

  // Publicly accessible url where PGP public key is stored
  const pgpPublicKeyUrl = 'http://minio:9000/exchange-oracle/pgp-public-key';
  await kvStoreClient.setFileUrlAndHash(
    pgpPublicKeyUrl,
    KVStoreKeys.publicKey
  );

  /**
   * These keys are valid only for Exchange Oracle
   * in case it requires extra registration step
   */
  await kvStoreClient.setBulk([
    KVStoreKeys.registrationNeeded,
    KVStoreKeys.registrationInstructions,
  ], [
    'true',
    'http://how-to-register.url'
  ]);

  const result = await KVStoreUtils.getKVStoreData(
    chainId,
    address
  );
  console.log('Oracle KV:', result);
}

(async () => {
  try {
    await setupOracleKV();
    process.exit(0);
  } catch (error) {
    console.log('Failed to set up oracle KV', error);
    process.exit(1);
  }
})();

or write a similar on Python using Python SDK

Last updated

Was this helpful?