### Start Frontend Source: https://github.com/kleros/kleros-v2/blob/dev/web/README.md Navigate to the web directory and run the start command to launch the frontend development server. ```bash cd kleros-v2/web yarn start ``` -------------------------------- ### Policy URI Example Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/specifications/policy-format.md Example of the 'uri' property, an IPFS path pointing to the policy JSON file. It must start with '/ipfs/'. ```json "/ipfs/QmRwmJAF8NK1r3fAS8dHofbTKsuhWSd3LruzkjrpNNBprC" ``` -------------------------------- ### Install Dependencies Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/README.md Run this command to install all necessary project dependencies. ```bash yarn install ``` -------------------------------- ### Start Local Graph Node Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Starts the local Graph node indexer. Requires Docker Desktop to be installed and running. The output indicates successful connection to IPFS, Postgres, and Ethereum. ```bash $ yarn workspace @kleros/kleros-v2-subgraph start-local-indexer ... graph-node-graph-node-1 | INFO Successfully connected to IPFS node at: http://ipfs:5001/ graph-node-graph-node-1 | INFO Pool successfully connected to Postgres, pool: main, shard: primary, component: Store ... graph-node-graph-node-1 | INFO Connected to Ethereum, capabilities: archive, traces, network_version: 31337, provider: mainnet-rpc-0 ``` -------------------------------- ### Start Local Frontend Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Starts the Kleros V2 frontend development server, pointing to the local subgraph. Ensure kleros-app is built first if necessary. ```bash $ yarn workspace @kleros/kleros-v2-web start-local ✔ Parse Configuration ✔ Generate outputs ✔ Validating plugins ✔ Resolving contracts ✔ Running plugins ✔ Writing to src/hooks/contracts/generated.ts Server running at http://localhost:1234 ✨ Built in 2.35s ``` -------------------------------- ### Start Local Full Stack Deployment Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Starts the complete local development stack for Kleros V2 using a single command with tmux. ```bash $ yarn local-stack ``` -------------------------------- ### Copy Environment File Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/README.md Copy the example environment file to `.env` to configure deployment settings. ```bash cp .env.example .env ``` -------------------------------- ### Start Local Hardhat Node Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/README.md Starts a local Hardhat network node. Use the `--tags` option to specify which contracts to load. ```bash yarn hardhat node --tags nothing ``` -------------------------------- ### Example Graph Node Docker Run Source: https://github.com/kleros/kleros-v2/blob/dev/services/graph-node/README.md An example of running the Graph Node Docker image with specific host, user, password, database, IPFS, and Ethereum network details. ```sh docker run -it \ -e postgres_host=host.docker.internal:5432 -e postgres_user=graph-node \ -e postgres_pass=oh-hello \ -e postgres_db=graph-node \ -e ipfs=host.docker.internal:5001 \ -e ethereum=mainnet:http://localhost:8545/ \ graphprotocol/graph-node:latest ``` -------------------------------- ### Start Local RPC with Contracts Deployed Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Starts the local RPC server with Kleros V2 contracts deployed. The server will be accessible at http://127.0.0.1:8545/. Wait for deployment to complete. ```bash $ yarn workspace @kleros/kleros-v2-contracts start-local ... Started HTTP and WebSocket JSON-RPC server at http://127.0.0.1:8545/ ``` -------------------------------- ### Install Kleros App Library Source: https://github.com/kleros/kleros-v2/blob/dev/kleros-app/README.md Install the Kleros App library using yarn. This command adds the necessary package to your project dependencies. ```bash yarn install @kleros/kleros-app ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Installs project dependencies using Yarn and updates Git submodules for Foundry libraries. ```bash $ yarn install # Foundry libraries $ git submodule update --init --recursive -j 4 ``` -------------------------------- ### Start Graph Node with Docker Compose Source: https://github.com/kleros/kleros-v2/blob/dev/services/graph-node/README.md Run this command to start IPFS, Postgres, and Graph Node using Docker Compose. This will create persistent data directories. ```sh docker-compose up ``` -------------------------------- ### Policy Rules Example Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/specifications/policy-format.md Example of the 'rules' property, outlining juror guidelines. Use markdown, starting headings from '###', and bullet points for clarity. ```markdown "- All policies of a court also apply to all of its child subcourts.\n- Jurors should cast their vote with a suitable verification.\n\n### Special Cases\nFor cases involving privacy coins..." ``` -------------------------------- ### Policy Purpose Example Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/specifications/policy-format.md Example of the 'purpose' property, detailing the court's function and scope. Use markdown for formatting, starting headings from '###'. ```markdown "The General court exists as the top court in the hierarchy.\n\nAll appeals made in subcourts will make their way to the General Court.\n\n### Example\nA case appealed from the Blockchain court." ``` -------------------------------- ### Example Evidence JSON Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/specifications/evidence-format.md A complete example of an evidence submission object, including all properties. This JSON string is emitted in the Evidence event. ```json { "name": "Evidence", "description": "The respondent failed to deliver the agreed-upon services...", "fileURI": "/ipfs/QmWQV5ZFFhEJiW8Lm7ay2zLxC2XS4wx1b2W7FfdrLMyQQc" } ``` -------------------------------- ### Start Blockscout Docker Compose Stack Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Start the Blockscout Docker Compose stack using the provided hardhat-network.yml configuration. This command runs Blockscout locally, accessible at http://localhost. ```bash docker-compose -f hardhat-network.yml up -d ``` -------------------------------- ### Install Hardhat CLI Auto-completion Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Installs Hardhat CLI auto-completion globally and configures it for the bash shell. Requires restarting the shell or executing 'exec bash' to activate. ```bash $ npm i -g hardhat-shorthand $ hardhat-completion install ✔ Which Shell do you use ? · bash ✔ We will install completion to ~/.bashrc, is it ok ? (y/N) · true $ exec bash ``` -------------------------------- ### Setup AtlasProvider for Kleros App Source: https://github.com/kleros/kleros-v2/blob/dev/kleros-app/README.md Configure and wrap your application with AtlasProvider. Ensure it's nested within WagmiProvider and QueryClientProvider. Set the Atlas backend URI, signup product, IPFS product, and Wagmi configuration. ```typescript import { WagmiProvider } from 'wagmi' import { config } from './config' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { AtlasProvider, SignupProduct, IpfsProduct } from "@kleros/kleros-app"; import { useConfig } from 'wagmi' const queryClient = new QueryClient() function App() { const wagmiConfig = useConfig() return ( ... ) } ``` -------------------------------- ### Simulate Arbitration Activity Source: https://github.com/kleros/kleros-v2/blob/dev/README.md Runs a simulation of arbitration activity on the local Kleros V2 setup. ```bash $ yarn workspace @kleros/kleros-v2-contracts simulate-local ``` -------------------------------- ### Run Test Fixtures with Local Node Source: https://github.com/kleros/kleros-v2/blob/dev/contracts/README.md Starts a local Hardhat node with specific tags and runs tests against it. ```bash yarn hardhat node --tags Arbitration,VeaMock ``` ```bash yarn test --network localhost ``` -------------------------------- ### Implement User Authentication with AtlasProvider Source: https://github.com/kleros/kleros-v2/blob/dev/kleros-app/README.md Use the useAtlasProvider hook to manage user authentication. This example conditionally renders children based on verification status and provides a button to initiate the authorization process. ```typescript import React, { useCallback } from "react"; import { useAccount } from "wagmi"; import { useAtlasProvider } from "@kleros/kleros-app"; import { Button } from "@kleros/ui-components-library"; interface IEnsureAuth { children: React.ReactElement; className?: string; } const EnsureAuth: React.FC = ({ children, className }) => { const { address } = useAccount(); const { isVerified, isSigningIn, authoriseUser } = useAtlasProvider(); const handleClick = useCallback(() => { // authorise a user authoriseUser() .then((res) => { console.log(res)}) .catch((err) => { console.log(err); }); }, [authoriseUser]); return isVerified ? ( children ) : (