To run Whistleblower locally, follow the steps below:
- Clone the Whistleblower repository.
- 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.
- Build de Whistleblower Dapp
docker buildx bake --load
- 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
- 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.
- Open a separate terminal window
- Navigate to the frontend-console directory:
cd frontend-console
- Build the frontend console application:
yarn
yarn build
- 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"
- 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]}"}]
- Navigate to the
Whistleblower/frontenddirectory and build the frontend application
yarn
yarn start
- To interact with the application, open your web browser and enter
localhost:3000in the address bar.