Skip to content

Latest commit

 

History

History
87 lines (61 loc) · 2.87 KB

develop.md

File metadata and controls

87 lines (61 loc) · 2.87 KB

How to run Whistleblower locally

To run Whistleblower locally, follow the steps below:

  1. Clone the Whistleblower repository.
  2. Navigate to the Whistleblower/backend-dapp/whistleblower

Note

In order to run the backend DApp, openCV library must be compiled for RISC-V and copied into the backend file system. Since compiling openCV could take several hours, an already compiled version of openCV can be found in the vendor folder. More information about the openCV compilation process and the steps to follow, can be found here.

  1. Build de Whistleblower Dapp
docker buildx bake --load
  1. Run the application starting an environment that includes a local blockchain with the Cartesi smart contracts deployed, as well as a Cartesi L2 node executing the dApp's back-end logic.
docker compose -f ../docker-compose.yml -f ./docker-compose.override.yml up

Allow some time for the infrastructure to be ready. How much will depend on your system, but eventually the container logs will only show the continuous production of empty blocks in the local blockchain, similar to the ones displayed below:

rollups-examples-hardhat-1                      | Mined empty block range #32 to #33
rollups-examples-hardhat-1                      | Mined empty block range #32 to #34
rollups-examples-hardhat-1                      | Mined empty block range #32 to #35
  1. You can shutdown the environment with ctrl+c and then running:
docker compose -f ../docker-compose.yml -f ./docker-compose.override.yml down -v

Note

For further information please check the Cartesi rollups documentation.

How to interact with the Dapp

Frontend console

  1. Open a separate terminal window
  2. Navigate to the frontend-console directory:
cd frontend-console
  1. Build the frontend console application:
yarn
yarn build
  1. Send an input (a jpg or png image) to the current locally deployed dApp
yarn start input send_file --path "/path_to_image"

or

yarn send:image "path_to_image"
  1. Verify the notices generated by the input
yarn start notice list

The response should include a payload key, where the value encompasses the identified license plate number (plate) along with the bounding box's position that contains the plate within the image (box). The response should look like this:

[{"index":0,"input":0,"payload":"{\"plate\": \"AB 123 CD.\", \"box\": [330,355,558,430]}"}]

React frontend

  1. Navigate to the Whistleblower/frontend directory and build the frontend application
yarn
yarn start
  1. To interact with the application, open your web browser and enter localhost:3000 in the address bar.