### Quickstart Development Setup Source: https://github.com/prosopo/captcha/blob/main/dev/scripts/README.md Clone the repository, install dependencies, build all packages, start Docker containers, copy environment files, and run the setup script. ```bash git clone https://github.com/prosopo/captcha cd captcha npm i npm run build:all docker compose --file docker/docker-compose.development.yml up -d cp demos/client-example-server/env.development demos/client-example-server/.env.development cp demos/client-example/env.development demos/client-example/.env.development cp dev/scripts/env.development .env.development cp dev/scripts/env.development dev/scripts/.env.development cp dev/scripts/env.development packages/cli/.env.development cp dev/scripts/env.development packages/procaptcha-bundle/.env.development npm run setup:all ``` -------------------------------- ### Run All Setup Commands Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md A single command to execute all prerequisite setup steps, including dependency installation, environment variable setup, building packages, and starting services. ```bash npm install cp demos/client-example-server/env.development demos/client-example-server/.env.development cp demos/client-example/env.development demos/client-example/.env.development cp dev/scripts/env.development dev/scripts/.env.development cp dev/scripts/env.development packages/cli/.env.development cp dev/scripts/env.development packages/procaptcha-bundle/.env.development npm run build:all npm run start:all ``` -------------------------------- ### Install Dependencies and Start Server (Production) Source: https://github.com/prosopo/captcha/blob/main/demos/client-example-server/README.md Use these commands to install npm dependencies and start the server in a production environment. Ensure your .env.production file is correctly configured with your site and secret keys. ```bash cp demos/client-example-server/env.production demos/client-example-server/.env.production && \ npm i && \ npm run start:server ``` -------------------------------- ### Install Dependencies and Start Server (Development) Source: https://github.com/prosopo/captcha/blob/main/demos/client-example-server/README.md Commands to set up the development environment, including copying environment files, starting Docker containers, installing dependencies, building the project, and starting the server. The server will be accessible at localhost:9228 by default. ```bash cp demos/client-example-server/env.development demos/client-example-server/.env.development && \ cp dev/scripts/env.development dev/scripts/.env.development && \ docker compose --file ./docker/docker-compose.development.yml up -d && \ npm i && \ npm run build:all && \ npm run setup:all && \ npm run start:server ``` -------------------------------- ### Build and Start E2E Bundle Test Services Source: https://github.com/prosopo/captcha/blob/main/for-devs.md Builds the client example server, starts the main server and provider admin services, bundles the procaptcha package, and starts the bundle service for End-to-End testing. ```bash npm run -w @prosopo/client-example-server build ; NODE_ENV=test npm run start:server NODE_ENV=test npm run start:provider:admin NODE_ENV="development" npm -w @prosopo/procaptcha-bundle run bundle NODE_ENV=test npm run start:bundle ``` -------------------------------- ### Setup Provider and Register Dapp Source: https://github.com/prosopo/captcha/blob/main/dev/scripts/README.md Registers a Provider and a Dapp in the Protocol contract and starts the Provider API. Requires the Protocol contract to exist on the substrate node. ```bash npm run setup && npm run start:provider ``` -------------------------------- ### Deploy Protocol Contracts and Setup Source: https://github.com/prosopo/captcha/blob/main/dev/scripts/README.md Deploys the Procaptcha protocol contract and runs the setup script. Updates .env files with new contract addresses. Use `npm run setup:all` to run both commands. ```bash npm run deploy_protocol npm run setup ``` -------------------------------- ### Build and Deploy Prosopo Procaptcha Bundle Locally Source: https://github.com/prosopo/captcha/blob/main/demos/client-bundle-example/README.md Run these commands from the root of the captcha repository to set up certificates, configure the environment, start Docker, install dependencies, build, and bundle the Procaptcha client. ```bash ./setup-certs.sh && \ ./install_cert.sh && \ cp dev/scripts/env.development dev/scripts/.env.development && \ cp dev/scripts/env.development packages/procaptcha-bundle/.env.development && \ docker compose --file ./docker/docker-compose.development.yml up -d && \ npm i && \ npm run build:all && \ npm run setup:all && \ NODE_ENV=development npm -w @prosopo/procaptcha-bundle run bundle NODE_ENV=development npm -w @prosopo/procaptcha-bundle run serve NODE_ENV=development npm run start:all ``` -------------------------------- ### Build and Run Cypress for Client Example Bundle Demo Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Builds the JavaScript bundle for the client example and then opens Cypress to test it. This is for testing the bundle in a static HTML page. ```bash NODE_ENV=development npm -w @prosopo/procaptcha-bundle run bundle npm -w @prosopo/cypress-shared run cypress:open:client-example-bundle ``` -------------------------------- ### Install @prosopo/server Package Source: https://context7.com/prosopo/captcha/llms.txt Install the necessary @prosopo/server, @prosopo/keyring, and @prosopo/types packages using npm. ```bash npm install @prosopo/server @prosopo/keyring @prosopo/types --save ``` -------------------------------- ### Install @prosopo/server Source: https://github.com/prosopo/captcha/blob/main/packages/server/README.md Install the @prosopo/server package using npm. ```bash npm install @prosopo/server --save ``` -------------------------------- ### Provider CLI Commands for Registration and Management Source: https://context7.com/prosopo/captcha/llms.txt A collection of bash commands for installing the Prosopo CLI, registering and managing a self-hosted provider, funding it with stake, loading datasets, starting the API server, and viewing provider details. ```bash # Install the CLI npm install @prosopo/cli ``` ```bash # Register your provider in the network npx provider provider_register \ --url https://your-provider.example.com \ --fee 0 \ --payee Dapp ``` ```bash # Fund your provider with stake npx provider provider_update \ --value 1000 \ --address YOUR_PROVIDER_ADDRESS ``` ```bash # Load a CAPTCHA dataset npx provider provider_set_data_set \ --file /path/to/captcha-dataset.json ``` ```bash # Start the provider API server npx provider start ``` ```bash # View provider details npx provider provider_details \ --address PROVIDER_ADDRESS ``` ```bash # List all registered providers npx provider provider_accounts ``` ```bash # Deregister your provider npx provider provider_deregister ``` ```bash # Export dataset from provider database npx provider provider_dataset ``` ```bash # View CLI version npx provider version ``` -------------------------------- ### Setup Protocol Contract via CLI Source: https://github.com/prosopo/captcha/blob/main/dev/scripts/README.md Initializes and sets up the Protocol contract. ```bash npm run setup ``` -------------------------------- ### Open Cypress for Client Example React Demo Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Launches the Cypress test runner for the client example React demo. Ensure both the server and client are running before executing. ```bash npm -w @prosopo/cypress-shared run cypress:open:client-example ``` -------------------------------- ### Start Local Playground Services Source: https://github.com/prosopo/captcha/blob/main/for-devs.md Starts the necessary services for the local playground, including the bundle service, provider admin service (for verification), and the bundle itself. Also includes steps to build and serve the bundle. ```bash # demo npm run start:bundle # server (if you need verification) NODE_ENV=test npm run start:provider:admin # bundle turbo run build --filter @prosopo/procaptcha-bundle...; NODE_ENV=development npm -w @prosopo/procaptcha-bundle run bundle; npm -w @prosopo/procaptcha-bundle run serve # visit http://localhost:9232/pow-explicit.html ``` -------------------------------- ### Start Docker Compose Development Environment Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Use this command to set up and start the necessary Docker containers for the development environment. ```bash docker compose --file ./docker/docker-compose.development.yml up -d ``` -------------------------------- ### Start All Local Services Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Launches all local services required for development and testing. ```bash npm run start:all ``` -------------------------------- ### Run Development Servers Source: https://github.com/prosopo/captcha/blob/main/dev/scripts/README.md Start the server, provider, and demo applications in separate terminals. ```bash npm run start:server ``` ```bash npm run start:provider ``` ```bash npm run start:demo ``` -------------------------------- ### Start Provider API Source: https://github.com/prosopo/captcha/blob/main/packages/cli/README.md Start the Provider API to begin serving CAPTCHA challenges to users on the Prosopo Network. ```bash npx provider start ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Installs all necessary npm packages for the project from the root workspace directory. ```bash npm install ``` -------------------------------- ### Install Node Modules Source: https://github.com/prosopo/captcha/blob/main/dev/scripts/README.md Installs all project dependencies from package.json. ```bash npm i ``` -------------------------------- ### Install Vite Plugin Watch Workspace Source: https://github.com/prosopo/captcha/blob/main/dev/vite-plugin-watch-workspace/README.md Install the plugin using npm. This command adds the necessary package to your project's dependencies. ```bash npm install @prosopo/vite-plugin-watch-workspace ``` -------------------------------- ### Example Usage Flow Source: https://github.com/prosopo/captcha/blob/main/packages/server/README.md Demonstrates the typical flow of obtaining a ProsopoServer instance and then using it to protect a function with a Procaptcha payload. ```typescript const payload = getPayloadFromRequest() // your request payload getProsopoServer().then((server) => { protectedFunction(server, payload).then(() => { // ... }) }) ``` -------------------------------- ### Install Procaptcha React Component Source: https://context7.com/prosopo/captcha/llms.txt Installs the official Procaptcha React wrapper component using npm. This is the first step to integrating Procaptcha into a React application. ```bash npm install @prosopo/procaptcha-react --save ``` -------------------------------- ### Provider Selection Example with Weights Source: https://github.com/prosopo/captcha/blob/main/packages/load-balancer/README.md Illustrates how provider weights influence traffic distribution. Higher weights result in a larger percentage of traffic being directed to that provider. ```json { "provider1": { "address": "...", "url": "https://provider1.example.com", "datasetId": "...", "weight": 1 }, "provider2": { "address": "...", "url": "https://provider2.example.com", "datasetId": "...", "weight": 3 } } ``` -------------------------------- ### Use React Component Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Example of how to use a React component with props. ```tsx () ``` -------------------------------- ### Start Provider Admin Service for Unit Tests Source: https://github.com/prosopo/captcha/blob/main/for-devs.md Launches the Provider:admin service, which is a prerequisite for running provider unit tests. Ensure this service is running before executing unit tests. ```bash NODE_ENV=test npm run start:provider:admin ``` -------------------------------- ### Configure Netplan for IPv6 Source: https://github.com/prosopo/captcha/blob/main/docker/ipv6.md Example netplan configuration for enabling IPv6 on a VPS. Replace dummy IPs and MAC addresses with your machine's actual details. Consult your VPS provider for IPv6 availability. ```yaml network: version: 2 renderer: networkd ethernets: ens18: match: macaddress: 00:...:77 addresses: - 1.2.3.4/24 - 2a02:::::::1/64 gateway6: fe80::1 routes: - to: 0.0.0.0/0 via: 1.2.3.1 on-link: true nameservers: search: [ invalid ] addresses: - 1.2.3.51 - 1.2.3.52 - 2a02:::::::1:53 - 2a02:::::::2:53 ``` -------------------------------- ### Register Provider Source: https://github.com/prosopo/captcha/blob/main/packages/cli/README.md Register your Provider with the Prosopo Network. This command requires your public URL, a fee (set to 0 for initial setup), and your payee address. ```bash npx provider provider_register --url https://YOUR_URL --fee 0 --payee Dapp ``` -------------------------------- ### Use Vue Component Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Example of how to use a Vue component within a template. ```html ``` -------------------------------- ### Get All Dapps CLI Source: https://github.com/prosopo/captcha/blob/main/dev/flux/README.md Retrieves a list of all dapps currently running on the Flux network. ```bash # get all dapps npx flux getDapps ``` -------------------------------- ### Get Specific Dapp Details CLI Source: https://github.com/prosopo/captcha/blob/main/dev/flux/README.md Fetches the complete details for a specific dapp running on the Flux network. ```bash # get details of a specific dapp npx flux getDapp ``` -------------------------------- ### Run E2E Cypress Client Bundle Tests Source: https://github.com/prosopo/captcha/blob/main/for-devs.md Launches the Cypress test runner for the client bundle example. This command is used to execute End-to-End tests for the captcha bundle. ```bash NODE_ENV=test npm -w @prosopo/cypress-shared run cypress:open:client-bundle-example ``` -------------------------------- ### Start Docker DB Service for Testing Source: https://github.com/prosopo/captcha/blob/main/for-devs.md Launches the necessary database services using Docker Compose for testing purposes. This command ensures the database is running in detached mode and recreates containers if needed. ```bash docker compose --file ./docker/docker-compose.test.yml up -d --remove-orphans --force-recreate --always-recreate-deps ``` -------------------------------- ### Procaptcha Component Usage with Configuration Source: https://github.com/prosopo/captcha/blob/main/packages/procaptcha-react/README.md Example of using the Procaptcha component with a configuration object. The configuration includes site key, dappName, network details, and solution threshold. ```tsx const config: ProcaptchaClientConfigInput = { account: { address: process.env.PROSOPO_SITE_KEY || undefined, }, web2: 'true', dappName: 'client-example', defaultEnvironment: 'rococo', networks: { rococo: { endpoint: 'wss://rococo-contracts-rpc.polkadot.io:443', contract: { address: '5HiVWQhJrysNcFNEWf2crArKht16zrhro3FcekVWocyQjx5u', name: 'prosopo', }, }, }, solutionThreshold: 80, } ``` -------------------------------- ### Set Up Development Environment Variables Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Copies development environment configuration files to their respective locations for various components. ```bash cp demos/client-example-server/env.development demos/client-example-server/.env.development ``` ```bash cp demos/client-example/env.development demos/client-example/.env.development ``` ```bash cp dev/scripts/env.development dev/scripts/.env.development ``` ```bash cp dev/scripts/env.development packages/cli/.env.development ``` ```bash cp dev/scripts/env.development packages/procaptcha-bundle/.env.development ``` -------------------------------- ### Populate DB with Initial Data Source: https://github.com/prosopo/captcha/blob/main/for-devs.md Initializes the database with essential data such as domains and site keys. This command should be executed once per container lifetime. ```bash NODE_ENV="test" npm run setup ``` -------------------------------- ### Get Images CLI command Source: https://github.com/prosopo/captcha/blob/main/packages/datasets-fs/README.md Fetches all images listed in a data JSON file using GET requests. It reports any errors encountered, such as 404 or non-OK status codes. ```bash npm run -w @prosopo/datasets-fs build && node packages/datasets-fs/dist/cli.js get --data ~/bench/test/flat/data2.json ``` -------------------------------- ### Initialize ProsopoServer Source: https://github.com/prosopo/captcha/blob/main/packages/server/README.md Instantiate the ProsopoServer class with a keypair and configuration. Ensure you have Procaptcha API keys and necessary environment variables set. ```typescript import { ApiParams, ProcaptchaResponse } from '@prosopo/types' import { ProsopoServer } from '@prosopo/server' async function getProsopoServer() { const config = getProsopoConfig() const pairType = (process.env.PAIR_TYPE as KeypairType) || ('sr25519' as KeypairType) const ss58Format = parseInt(process.env.SS58_FORMAT || '') || 42 const pair = await getPair(pairType, ss58Format, process.env.PROSOPO_SITE_PRIVATE_KEY) const prosopoServer = new ProsopoServer(pair, config) } ``` -------------------------------- ### Initialize Procaptcha and Web3 Source: https://github.com/prosopo/captcha/blob/main/demos/client-bundle-example/src/image-explicit-web3.html Initializes the CAPTCHA system and enables web3 access. It then fetches web3 accounts and logs the rendering process for the selected account. ```javascript document.addEventListener('DOMContentLoaded', async function() { window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info'); await web3Enable("Procaptcha Demo"); await getWeb3Accounts(); // Get the selected account from the dropdown const account = document.getElementById('account-select') ? document.getElementById('account-select').value : null; window.updateCaptchaStatus(`Rendering the CAPTCHA for account ${account}`, 'info'); window.updateCaptchaStatus(`Rendering the CAPTCHA for account ${account}`, ``` -------------------------------- ### Get Provider Details Source: https://github.com/prosopo/captcha/blob/main/packages/cli/README.md Retrieve detailed information about a specific Provider on the network using their address. ```bash npx provider provider_details --address PROVIDER_ADDRESS ``` -------------------------------- ### Initialize Vue App with createApp() Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Initialize a Vue application using createApp. The application is mounted to a specified root HTML element. ```typescript import {createApp} from "vue"; import App from "/app.vue"; const rootHtmlElement = document.querySelector("#root"); createApp(App) .mount(rootHtmlElement); ``` -------------------------------- ### Get App Logs CLI Source: https://github.com/prosopo/captcha/blob/main/dev/flux/README.md Retrieves the logs for a specified app across all its running nodes. ```bash # get logs of the app npx flux logs ``` -------------------------------- ### Get Dapp Node IPs CLI Source: https://github.com/prosopo/captcha/blob/main/dev/flux/README.md Retrieves only the IP addresses of the nodes that are running a specified dapp. ```bash # get details of a specific dapp and show only the nodes npx flux getDapp --nodes ``` -------------------------------- ### Initialize React App with createRoot() Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Use createRoot to initialize a React application. Ensure the root HTML element exists in your DOM. ```tsx import React from "react"; import ReactDOM from "react-dom/client"; import App from "./app.tsx"; const rootHtmlElement = document.querySelector("#root"); ReactDOM.createRoot(rootHtmlElement) .render( ); ``` -------------------------------- ### Run Redis Benchmark Source: https://github.com/prosopo/captcha/blob/main/docker/redis/readme.md Execute the redis-benchmark tool with authentication to measure performance. ```bash # docker composer up docker exec -it redis-benchmark -a {pass} ``` -------------------------------- ### React Class Component Lifecycle Methods Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Implement componentDidMount for initial setup and componentDidUpdate for updates in React class components. ```typescript import React from "react"; class App extends React.Component { public override componentDidMount(): void { // called once after the initial render } public override componentDidUpdate(): void { // called after every UI re-render (second and next renders) } } ``` -------------------------------- ### Prosopo CLI Help Output Source: https://github.com/prosopo/captcha/blob/main/packages/cli/README.md Displays the full usage information and available commands for the Prosopo CLI. This includes global options and specific commands for Provider and Dapp management. ```bash Usage: cli.js [global options] [options] Commands: cli.js provider_register Register a Provider cli.js provider_update Update a Provider cli.js provider_deregister Deregister a Provider cli.js provider_set_data_set Add a dataset as a Provider cli.js dapp_register Register a Dapp cli.js dapp_update Register a Dapp cli.js provider_accounts List all provider accounts cli.js dapp_accounts List all dapp accounts cli.js provider_details List details of a single Provider cli.js provider_dataset Exports a dataset from the provider database cli.js dapp_details List details of a single Dapp cli.js calculate_captcha_solutions Calculate captcha solutions cli.js batch_commit Batch commit user solutions to contract cli.js version Return the version of the software Options: --help Show help [boolean] --version Show version number [boolean] --api [boolean] [default: false] ``` -------------------------------- ### Build All Project Packages Source: https://github.com/prosopo/captcha/blob/main/demos/cypress-shared/README.md Compiles and builds all packages within the project. ```bash npm run build:all ``` -------------------------------- ### Get Logs for a Specific Dapp Source: https://github.com/prosopo/captcha/blob/main/dev/flux/README.md Retrieves logs for a specified application. This command is useful for debugging and monitoring application behavior on the Flux network. ```bash npx flux getLogs ``` -------------------------------- ### Conditional Typing with Branded Types Source: https://github.com/prosopo/captcha/blob/main/dev/ts-brand/README.md Use branded types with conditional typing to create type-safe checks. This example demonstrates checking if a type is `ABranded`. ```typescript type IsA = T extends ABranded ? true : false type x = IsA // true type y = IsA // false ``` -------------------------------- ### Get Provider Container ID Source: https://github.com/prosopo/captcha/blob/main/packages/cli/README.md Retrieve the Container ID of the running Prosopo Provider container. This ID is required to execute commands within the container. ```bash $ PROVIDER_CONTAINER = docker ps -q -f name=docker-provider ``` -------------------------------- ### Initialize and Render CAPTCHA Source: https://github.com/prosopo/captcha/blob/main/demos/client-bundle-example/src/pow-explicit-web3.html Initializes the web3 environment, fetches user accounts, and then explicitly renders the Procaptcha widget. It passes the selected account to the rendering function. ```javascript document.addEventListener('DOMContentLoaded', async function() { window.updateCaptchaStatus('Initializing CAPTCHA with explicit render call', 'info'); await web3Enable("Procaptcha Demo"); await getWeb3Accounts(); const account = document.getElementById('account-select') ? document.getElementById('account-select').value : null; window.updateCaptchaStatus(`Rendering the CAPTCHA for account ${account}`, 'info'); const widgetId = render(document.getElementById('procaptcha-container') ``` -------------------------------- ### Initialize Svelte App with mount() Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Mount a Svelte application to a target HTML element. This is used for imperative component mounting. ```typescript import {mount} from "svelte"; import App from "./app.svelte"; const rootHtmlElement = document.querySelector("#root"); mount(App, { target: rootHtmlElement, }); ``` -------------------------------- ### React Class Component DOM Manipulation with useRef Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Use `useRef` in a class-based React component to get a reference to a DOM element and manipulate it, such as focusing it on click. ```typescript jsx import React, {useRef} from 'react'; class App extends React.Component { private readonly elementRef: React.RefObject; constructor(properties) { super(properties); this.elementRef = React.createRef(); } public override render(): React.ReactNode { return
; } public focus(): void { this.elementRef.current.focus(); } } ``` -------------------------------- ### Unbranding Instances Source: https://github.com/prosopo/captcha/blob/main/dev/ts-brand/README.md Remove a brand from a branded instance to get back the original instance type. This is useful when you no longer need the compile-time type safety provided by the brand. ```typescript const dogUnbranded = unbrand(dog) // of type Dog ``` -------------------------------- ### Initialize Angular App with bootstrapApplication() Source: https://github.com/prosopo/captcha/blob/main/integration/frameworks-cheat-sheet.md Bootstrap an Angular application using bootstrapApplication. This is the standalone API for bootstrapping. ```typescript import { bootstrapApplication } from '@angular/platform-browser'; import { AppComponent } from './app/app.component'; bootstrapApplication(AppComponent); ``` -------------------------------- ### Get Brand from Branded Value Source: https://github.com/prosopo/captcha/blob/main/dev/ts-brand/README.md Retrieve the brand associated with a branded value. If no brand is set, an empty string is returned. Note that this returns the brand as a type, not a runtime variable. ```typescript const b = getBrand(dog) // b is of type 'Dog' ``` ```typescript const b = getBrand(someValue) // b is of type '' - i.e. no brand ``` -------------------------------- ### Run Integration Tests (Standard Mode) Source: https://github.com/prosopo/captcha/blob/main/packages/provider/src/tests/integration/README.md Execute integration tests in standard mode, which includes running Redis containers. Use this for local development and testing. ```bash npm run test:integration ``` -------------------------------- ### POST /v1/prosopo/provider/client/solution Source: https://context7.com/prosopo/captcha/llms.txt Submit the user's solution for CAPTCHA verification. Requires Prosopo-Site-Key and Prosopo-User headers. ```APIDOC ## POST /v1/prosopo/provider/client/solution ### Description Submit the user's solution for verification. ### Method POST ### Endpoint /v1/prosopo/provider/client/solution ### Headers - **Prosopo-Site-Key** (string) - Required - Your site's unique key. - **Prosopo-User** (string) - Required - The user's account address. ### Parameters #### Request Body - **solutions** (array) - Required - Array of captcha solutions. Each object should contain: - **captchaId** (string) - The ID of the captcha. - **captchaContentId** (string) - The content ID of the captcha. - **salt** (string) - The salt used for hashing. - **solution** (string) - The user's solution. - **requestHash** (string) - Required - The hash of the request, obtained from the challenge response. - **userAccount** (string) - Required - The user's account address. - **timestamp** (string) - Required - The timestamp from the challenge response. - **providerSignature** (string) - Required - The provider's signature from the challenge response. - **userSignature** (string) - Required - The user's signature of the timestamp. ### Request Example ```typescript import type { CaptchaSolution } from '@prosopo/types'; async function submitSolution( solutions: CaptchaSolution[], requestHash: string, userAccount: string, timestamp: string, providerSignature: string, userSignature: string ) { const response = await providerApi.submitCaptchaSolution( solutions, requestHash, userAccount, timestamp, providerSignature, userSignature ); return response; } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the request, e.g., 'ok'. - **captchas** (array) - An array of captcha verification results. - **captchaId** (string) - The ID of the captcha. - **proof** (array) - Proof of the solution. - **verified** (boolean) - Indicates if the solution was verified. #### Response Example ```json { "status": "ok", "captchas": [{ "captchaId": "abc123", "proof": [["proof1"], ["proof2"]] }], "verified": true } ``` ``` -------------------------------- ### Get Labels CLI command Source: https://github.com/prosopo/captcha/blob/main/packages/datasets-fs/README.md Extracts all unique labels from a given data JSON file. Use --data to specify the input file and --output for the labels file. ```bash npm run -w @prosopo/datasets-fs build && node packages/datasets-fs/dist/cli.js labels --data ~/bench/test/flat/data2.json ``` -------------------------------- ### Get Logs from a Specific Node by IP Source: https://github.com/prosopo/captcha/blob/main/dev/flux/README.md Fetches logs for a specific dapp running on a particular node, identified by its IP address and port. Ensure the IP and port are correctly formatted. ```bash # get logs of a specific dapp at a specific ip npx flux getLogs --ip ``` -------------------------------- ### Environment Variables for Production Source: https://github.com/prosopo/captcha/blob/main/demos/client-example-server/README.md Configure your Prosopo API credentials by replacing the placeholders in the .env.production file. Obtain your keys from the Prosopo portal. ```typescript PROSOPO_SITE_KEY= PROSOPO_SITE_PRIVATE_KEY= ```