Awesome
Integration
Integrates prosopo repositories in a development environment
- protocol
- provider
- contract
- procaptcha
- procaptcha-react
- client-example
- demo-nft-marketplace
- dapp-example
Prerequisites
- ability to run bash scripts
- docker (tested on v20.10.8 / v20.10.11/ v20.10.14, used 4CPUs, 6GB of memory, 2GB of swap)
- docker compose v2+
Usage
git clone git@github.com:prosopo-io/integration.git
Development Environment Set Up
The following instructions explain how to set up a developer environment in which changes can be made to the various JavaScript packages.
Pull Submodules
Start by pulling submodules. Run the following command from the root of the integration repository.
git submodule update --init --recursive --force --checkout
Set up Containers
Setup your integration containers by running the following command from the root of the integration repository.
docker compose --file docker-compose.development.yml up -d
This does the following:
- Pulls and starts a substrate node container containing pre-deployed protocol, dapp-example, and demo-nft-marketplace contracts.
- Pulls and starts up a mongodb container.
Install node modules
Install the node modules and build the workspace by running the following command from the root of the integration repository.
npm i && npm run build
Set up a Provider
Providers are the nodes in the network that supply CATPCHA. Run the following command from the root of the integration repository to register a Provider and a Dapp in the Protocol contract and start the Provider API.
npm run setup && npm run start
You can simply run npm run start
on subsequent runs.
Command Details
Command | Description |
---|---|
npm run setup | Registers the Provider and a Dapp in the Protocol contract |
npm run start | Starts the provider API |
Debugging and Testing a Frontend App
You can now start one of the frontend demos to begin receiving CAPTCHA challenges in the browser. See the READMEs in each of the demos for information on how to run them.
- demo-nft-marketplace (full marketplace)
- client-example (minimal implementation)
Running Tests
Stop your development environment, if it is running.
docker compose --file docker-compose.development.yml down
Set up the test environment and run the tests by running the following command from the root of the integration repository.
npm run test
This will create a test docker environment, register a test Provider, and create a test env
file before running the tests in provider.