### Quickstart: Run a Local Gitlawb Node Source: https://github.com/gitlawb/node/blob/main/README.md Instructions to set up and run a local Gitlawb Node using Docker Compose. This includes cloning the repository, configuring environment variables, and starting the services. ```bash git clone https://github.com/Gitlawb/node.git cd node cp .env.example .env docker compose up -d ``` -------------------------------- ### Set Up PostgreSQL for Local Development Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Use Docker Compose to start a PostgreSQL database instance for the gitlawb node. This is the fastest way to get the database running for development. ```sh docker compose up postgres -d ``` -------------------------------- ### Install Gitlawb CLI using Installer Script Source: https://github.com/gitlawb/node/blob/main/README.md Installs the Gitlawb CLI by downloading and executing an installation script from the official Gitlawb website. ```bash curl -fsSL https://gitlawb.com/install.sh | sh ``` -------------------------------- ### Check Gitlawb CLI Setup Source: https://github.com/gitlawb/node/blob/main/README.md Runs a doctor command for the Gitlawb CLI to verify the installation and check for any potential setup issues. ```bash gl doctor ``` -------------------------------- ### Install gitlawb CLI Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Installs the gitlawb command-line interface. You can either download the script or build from source. ```bash curl -fsSL https://gitlawb.com/install.sh | sh # or build from source: ``` ```bash cargo install --path crates/gl ``` -------------------------------- ### Example of Setting POSTGRES_PASSWORD Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Illustrates setting the `POSTGRES_PASSWORD` environment variable. It is crucial to change the default 'changeme' before exposing the service publicly. ```sh export POSTGRES_PASSWORD=your_secure_password ``` -------------------------------- ### Configure Development Environment Variables Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Copy the example environment file and edit it to set necessary variables for the development environment. The `DATABASE_URL` is the minimum required variable. ```sh cp .env.example .env # edit .env ``` -------------------------------- ### Check Docker Version Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Displays the installed version of the Docker command-line interface. ```sh docker --version ``` -------------------------------- ### Build Gitlawb CLI from Source Source: https://github.com/gitlawb/node/blob/main/README.md Builds the Gitlawb CLI and git-remote-gitlawb from source using Cargo. This is an alternative to using the installer script. ```bash cargo build --release -p gl -p git-remote-gitlawb -p gitlawb-node ``` -------------------------------- ### Run Local gitlawb Node Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Start a local gitlawb node. This requires a running PostgreSQL instance. For local development, it's recommended to use the provided `docker-compose.yml`. ```sh cargo run -p gitlawb-node ``` -------------------------------- ### Install Script Bash Syntax Check Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Checks the syntax of the `install.sh` script without executing it. This command requires `bash` to be available in the environment. ```sh bash -n install.sh ``` -------------------------------- ### Run Node with Docker Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Runs the gitlawb node as a Docker container. Configure necessary environment variables for database, public URL, and blockchain interaction. Strict mode can be enabled to ensure the node only starts if registered and active. ```bash docker run -d \ --name gitlawb-node \ -p 7545:7545 \ -p 7546:7546/udp \ -v gitlawb-data:/data \ -e DATABASE_URL=postgresql://user:pass@host/gitlawb \ -e GITLAWB_PUBLIC_URL=https://my-node.example.com \ -e GITLAWB_OPERATOR_PRIVATE_KEY=$GITLAWB_OPERATOR_PRIVATE_KEY \ -e GITLAWB_CONTRACT_NODE_STAKING=$GITLAWB_CONTRACT_NODE_STAKING \ -e GITLAWB_CHAIN_RPC_URL=$GITLAWB_CHAIN_RPC_URL \ -e GITLAWB_OPERATOR_STRICT_MODE=true \ ghcr.io/gitlawb/node:latest ``` -------------------------------- ### Get Last Commit Log Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Displays the log of the most recent commit in a concise, one-line format. ```sh git log -1 --oneline ``` -------------------------------- ### Example of Setting GITLAWB_NODE Environment Variable Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Demonstrates how to set the `GITLAWB_NODE` environment variable to specify the node endpoint for `git-remote-gitlawb` commands. This is useful for public network operations. ```sh export GITLAWB_NODE=https://node.gitlawb.com ``` -------------------------------- ### Validate Docker Compose Configuration Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Parses and validates the syntax of the Docker Compose configuration file without starting the services. ```sh docker compose config ``` -------------------------------- ### Stop Local Gitlawb Node Source: https://github.com/gitlawb/node/blob/main/README.md Command to stop and remove the services started by Docker Compose for the local Gitlawb Node. ```bash docker compose down ``` -------------------------------- ### Get Upstream Branch Name Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Retrieves the symbolic full name of the upstream branch for the current branch. ```sh git rev-parse --abbrev-ref --symbolic-full-name '@{u}' ``` -------------------------------- ### Example of Disabling Seed Peers Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Shows how to disable the automatic merging of bootstrap peers from `bootstrap-peers.json` by setting the `GITLAWB_BOOTSTRAP_DISABLE_SEEDS` environment variable to true. This is useful for isolated networks. ```sh export GITLAWB_BOOTSTRAP_DISABLE_SEEDS=true ``` -------------------------------- ### Request Node Unstake Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Initiates the unstaking process for your gitlawb node, starting a 7-day cooldown period. Your node continues to earn rewards during this period if it keeps heartbeating. ```bash # Step 1: request unstake (starts 7-day timer) gl node unstake-request ``` -------------------------------- ### Create Repository Source: https://github.com/gitlawb/node/blob/main/README.md Command to create a new repository with a description and node association. ```bash gl repo create my-repo --description "My first Gitlawb repo" --node http://localhost:7545 ``` -------------------------------- ### Clone and Build gitlawb Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Clone the repository, navigate into the directory, and build all components using Cargo. Run the workspace test suite to ensure everything is functioning correctly. ```sh git clone https://github.com/Gitlawb/node cd node cargo build cargo test --workspace ``` -------------------------------- ### Run Gitlawb Node from source Source: https://github.com/gitlawb/node/blob/main/README.md Launches the Gitlawb Node application from source. Ensure the DATABASE_URL environment variable is correctly set to your PostgreSQL instance. ```bash DATABASE_URL=postgresql://gitlawb:changeme@localhost:5432/gitlawb \ cargo run -p gitlawb-node --release ``` -------------------------------- ### Display Gitlawb CLI Help Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Shows the help message for the `gl` command-line interface tool, useful for understanding its capabilities and usage. ```sh cargo run -q -p gl -- --help ``` -------------------------------- ### Check GL Version Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Retrieves and displays the version of the `gl` binary. ```sh target/release/gl --version ``` -------------------------------- ### Build and Run gitlawb CLI Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Compile the gitlawb command-line interface (CLI) tool and display its help message to understand available commands and options. ```sh cargo run -p gl -- --help ``` -------------------------------- ### Add Gitlawb Binaries to PATH Source: https://github.com/gitlawb/node/blob/main/README.md Instructions to add the compiled Gitlawb binaries to the system's PATH environment variable, making them accessible from any terminal location. ```txt target/release/gl target/release/git-remote-gitlawb target/release/gitlawb-node ``` -------------------------------- ### Create and Show Identity Source: https://github.com/gitlawb/node/blob/main/README.md Commands to create a new identity and display the current one. ```bash gl identity new gl identity show ``` -------------------------------- ### Display Gitlawb Node CLI Help Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Shows the help message for the `gitlawb-node` command-line interface tool, useful for understanding its capabilities and usage. ```sh cargo run -q -p gitlawb-node -- --help ``` -------------------------------- ### Run Node from Source Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Executes the gitlawb node directly from source using Cargo. Requires specific environment variables for on-chain PoS mode and optional settings for strict mode and heartbeat interval. ```bash cargo run -p gitlawb-node --release ``` -------------------------------- ### Build Release Binaries Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Compiles the `gitlawb-node`, `gl`, and `git-remote-gitlawb` components in release mode. ```sh cargo build --release -p gitlawb-node -p gl -p git-remote-gitlawb ``` -------------------------------- ### Build macOS menu bar app Source: https://github.com/gitlawb/node/blob/main/README.md Builds the native Swift/AppKit menu bar application for macOS. This script compiles the application and prepares it for distribution. ```bash ./scripts/build-macos-app.sh ``` -------------------------------- ### Recommended Node Operator Settings Source: https://github.com/gitlawb/node/blob/main/README.md Recommended environment variables for node operators to ensure strict mode and control heartbeat intervals. ```env GITLAWB_OPERATOR_STRICT_MODE=true GITLAWB_HEARTBEAT_INTERVAL_HOURS=20 ``` -------------------------------- ### Optional Node Staking Configuration Source: https://github.com/gitlawb/node/blob/main/README.md Environment variables required to enable and configure optional node staking on the Base L2 network. ```env GITLAWB_CONTRACT_NODE_STAKING=0x... GITLAWB_OPERATOR_PRIVATE_KEY=0x... GITLAWB_CHAIN_RPC_URL=https://mainnet.base.org ``` -------------------------------- ### Enable Signed Peer Writes Source: https://github.com/gitlawb/node/blob/main/README.md Environment variable to enforce signed writes from peers. Set to true to require signed requests. ```bash GITLAWB_REQUIRE_SIGNED_PEER_WRITES=true ``` -------------------------------- ### Build Docker Image for PR Smoke Test Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Builds the Docker image for `gitlawb-node`. This is recommended as a smoke test for pull requests. ```sh docker build ``` -------------------------------- ### Register Node Source: https://github.com/gitlawb/node/blob/main/README.md Command to register your local Gitlawb node with a specific address. ```bash gl register --node http://localhost:7545 ``` -------------------------------- ### Clone Repository using Git Remote Helper Source: https://github.com/gitlawb/node/blob/main/README.md Set the GITLAWB_NODE environment variable and clone a repository using the gitlawb:// protocol. ```bash export GITLAWB_NODE=http://localhost:7545 git clone gitlawb://did:key:z6Mk.../my-repo ``` -------------------------------- ### Build Docker Image for Audit Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Builds the Docker image for `gitlawb-node` tagged specifically for the OSS audit. ```sh docker build -t gitlawb-node:oss-audit . ``` -------------------------------- ### Check Node Version Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Retrieves and displays the version of the `gitlawb-node` binary. ```sh target/release/gitlawb-node --version ``` -------------------------------- ### Minimum Persistent Node Configuration Source: https://github.com/gitlawb/node/blob/main/README.md The essential environment variable for setting up a persistent Gitlawb node with a PostgreSQL database. ```env DATABASE_URL=postgresql://gitlawb:changeme@localhost:5432/gitlawb ``` -------------------------------- ### Register Node On-Chain Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Registers your node on the blockchain, staking $GITLAWB and linking your node DID to your operator wallet. Ensure environment variables for private key, token, contract address, and RPC URL are set. ```bash export GITLAWB_OPERATOR_PRIVATE_KEY=0xYOUR_KEY export GITLAWB_TOKEN=0x5F980Dcfc4c0fa3911554cf5ab288ed0eb13DBa3 export GITLAWB_CONTRACT_NODE_STAKING=0xNODE_STAKING_ADDR export GITLAWB_CHAIN_RPC_URL=https://mainnet.base.org gl node register \ --stake 10000 \ --http-url https://my-node.example.com ``` -------------------------------- ### List Git Remotes Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Displays the remote repositories configured for the current Git repository. ```sh git remote -v ``` -------------------------------- ### Gitlawb Node Architecture Diagram Source: https://github.com/gitlawb/node/blob/main/README.md A visual representation of the Gitlawb node's architecture, showing the interaction between the CLI, node, database, Git repos, and p2p network. ```txt ┌──────────────────────────┐ │ gl CLI / git / AI agents │ └────────────┬─────────────┘ │ signed HTTP writes / git smart-HTTP ↓ ┌──────────────────────────┐ │ gitlawb-node │ │ Axum API + git routes │ └────────────┬─────────────┘ │ ┌────────┴────────┐ ↓ ↓ Postgres Bare git repos metadata local disk / optional S3 │ │ └────────┬────────┘ ↓ libp2p peers gossip + discovery + sync ↓ optional IPFS / Arweave / Base PoS ``` -------------------------------- ### Weekly Fee Distribution Logic Source: https://github.com/gitlawb/node/blob/main/docs/ECONOMICS.md Illustrates the permissionless distribution of protocol fees. The function can be called by anyone after a 7-day waiting period since the last distribution. ```Solidity distribute() — permissionless, enforced ≥ 7 days since last call ├── 1% → msg.sender (keeper reward) ├── 75% → GitlawbNodeStaking (operator PoS rewards) └── 24% → GitlawbStaking (user tier-weighted rewards) ``` -------------------------------- ### Run All Workspace Tests Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Execute all tests across all crates within the gitlawb workspace to ensure code integrity and functionality. ```sh cargo test --workspace ``` -------------------------------- ### Format and Lint Code Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Apply code formatting and run the clippy linter to check for common mistakes and style issues. CI will reject submissions that fail these checks. ```sh cargo fmt --all cargo clippy --workspace --all-targets -- -D warnings ``` -------------------------------- ### Peer Write Routes Source: https://github.com/gitlawb/node/blob/main/README.md These routes are used for peer-to-peer communication and synchronization within the Gitlawb network. They support staged rollouts and can be configured to require signed requests. ```APIDOC ## Peer Write Routes ### Description Endpoints for managing peer interactions and network synchronization. These routes can be configured to enforce signed writes for enhanced security. ### Endpoints - **POST /api/v1/peers/announce**: Announce the presence and details of a peer to the network. - **POST /api/v1/sync/notify**: Notify other peers about synchronization events or data updates. - **POST /api/v1/sync/trigger**: Trigger a synchronization process with other peers. ``` -------------------------------- ### Gitlawb Network Vision Source: https://github.com/gitlawb/node/blob/main/README.md Outlines the long-term vision for Gitlawb, focusing on decentralized GitHub, signed workflows, replication, and CDN-style delivery. ```txt Decentralized GitHub + signed agent-native workflows + resilient repo replication + CDN-style app/code delivery ``` -------------------------------- ### Check Code Formatting Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Ensures all code in the workspace adheres to the project's formatting standards. This command checks for violations without applying them. ```sh cargo fmt --all -- --check ``` -------------------------------- ### Check Node Version in Docker Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Verifies the version of the `gitlawb-node` binary within a Docker container. This is part of a recommended PR smoke test. ```sh gitlawb-node --version ``` -------------------------------- ### Verify Local Node Health and Stats Source: https://github.com/gitlawb/node/blob/main/README.md Commands to check the health and statistics of the locally running Gitlawb Node. Assumes the node is accessible at http://localhost:7545. ```bash curl http://localhost:7545/health curl http://localhost:7545/api/v1/stats ``` -------------------------------- ### Create gitlawb Identity Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Generates a new Ed25519 DID keypair for your node. This DID is distinct from your Ethereum wallet. ```bash gl identity new gl identity show # → did:key:z6Mk... ``` -------------------------------- ### Check Code Linting Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Runs the clippy linter on the entire workspace, with all targets, and flags warnings as errors. This helps enforce code quality and style guidelines. ```sh cargo clippy --workspace --all-targets -- -D warnings ``` -------------------------------- ### Show Current Git Branch Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Outputs the name of the current branch being worked on. ```sh git branch --show-current ``` -------------------------------- ### Common Public Read Routes Source: https://github.com/gitlawb/node/blob/main/README.md These routes are available for public read access to the Gitlawb node. They provide information about the node's health, statistics, contracts, repositories, and peer network. ```APIDOC ## Common Public Read Routes ### Description Provides access to read-only information from the Gitlawb node. ### Endpoints - **GET /health**: Check the health status of the node. - **GET /**: Root endpoint, likely for basic node information. - **GET /api/v1/stats**: Retrieve statistics about the node. - **GET /api/v1/contracts**: List available contracts. - **GET /api/v1/repos**: List all repositories. - **GET /api/v1/repos/{owner}/{repo}**: Get details for a specific repository. - **GET /api/v1/repos/{owner}/{repo}/tree**: View the directory tree of a repository. - **GET /api/v1/repos/{owner}/{repo}/blob/{path}**: Retrieve the content of a file within a repository. - **GET /api/v1/repos/{owner}/{repo}/issues**: List issues for a repository. - **GET /api/v1/repos/{owner}/{repo}/pulls**: List pull requests for a repository. - **GET /api/v1/peers**: List connected peers. - **GET /{owner}/{repo}/info/refs**: Git smart-HTTP endpoint to get references for a repository. - **POST /{owner}/{repo}/git-upload-pack**: Git smart-HTTP endpoint for uploading pack data. ``` -------------------------------- ### User Staking Reward Formula Source: https://github.com/gitlawb/node/blob/main/docs/ECONOMICS.md Calculates the weekly reward for a user staker, considering their stake amount and assigned tier multiplier. The total weighted stake across all users determines the individual share. ```Solidity userReward_i = userShare × (myStake × myMultiplier / totalWeightedStake) ``` -------------------------------- ### Complete Node Unstake Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Completes the unstaking process after the 7-day cooldown period. This action returns your staked $GITLAWB and any pending rewards. ```bash # ... wait 7 days ... # Step 2: complete — returns stake + any pending rewards gl node unstake ``` -------------------------------- ### Run Tests for a Specific Crate Source: https://github.com/gitlawb/node/blob/main/CONTRIBUTING.md Execute tests for individual crates within the gitlawb workspace, such as `gitlawb-core` or `gitlawb-node`, for more targeted testing. ```sh cargo test -p gitlawb-core cargo test -p gitlawb-node ``` -------------------------------- ### Check Git Status Source: https://github.com/gitlawb/node/blob/main/docs/OSS-READINESS-AUDIT.md Verifies the current Git status of the repository, including branch information and short status. ```sh git status --short --branch ``` -------------------------------- ### Node Operator Reward Formula Source: https://github.com/gitlawb/node/blob/main/docs/ECONOMICS.md Calculates the weekly reward for an individual node operator based on their stake and active participation. Nodes must maintain a heartbeat within 3 days to be eligible. ```Solidity nodeReward_i = nodeShare × (myStake / totalActiveStake) if heartbeat within 3 days nodeReward_i = 0 otherwise ``` -------------------------------- ### Signed Write Routes Source: https://github.com/gitlawb/node/blob/main/README.md These routes require signed requests to perform write operations on the Gitlawb node. This ensures data integrity and authenticity. ```APIDOC ## Signed Write Routes ### Description These endpoints allow for modifying data on the Gitlawb node and require requests to be signed with the appropriate DID key. ### Endpoints - **POST /api/v1/repos**: Create a new repository. - **POST /api/register**: Register an identity or entity with the node. - **POST /api/v1/repos/{owner}/{repo}/fork**: Fork an existing repository. - **POST /api/v1/repos/{owner}/{repo}/issues**: Create a new issue for a repository. - **POST /api/v1/repos/{owner}/{repo}/pulls**: Create a new pull request for a repository. - **POST /api/v1/repos/{owner}/{repo}/pulls/{number}/merge**: Merge a pull request. - **POST /api/v1/repos/{owner}/{repo}/hooks**: Create a webhook for a repository. - **POST /api/v1/bounties/{id}/...**: Interact with bounties (specific actions depend on `...`). - **POST /{owner}/{repo}/git-receive-pack**: Git smart-HTTP endpoint for receiving pack data (pushing). ``` -------------------------------- ### Check Node On-Chain Status Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Retrieves and displays the current on-chain status of your gitlawb node, including operator wallet, stake, HTTP URL, last heartbeat, active status, and pending rewards. ```bash gl node onchain-status ``` -------------------------------- ### Expected Health Response Source: https://github.com/gitlawb/node/blob/main/README.md The expected JSON response when querying the health endpoint of a running Gitlawb Node. ```json { "status": "ok" } ``` -------------------------------- ### Claim Pending Rewards Source: https://github.com/gitlawb/node/blob/main/docs/RUN-A-NODE.md Claims any accumulated pending rewards for your gitlawb node. Rewards can be claimed anytime without unstaking. ```bash gl node claim ``` -------------------------------- ### Remove extended attributes from macOS app Source: https://github.com/gitlawb/node/blob/main/README.md After building an unsigned local copy of the macOS app, this command is used to remove extended attributes, which can prevent the app from running due to security policies. ```bash xattr -cr "dist/Gitlawb Node.app" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.