{"id":18881625,"url":"https://github.com/alakise/decentralized-pgp-key-server-contract","last_synced_at":"2026-05-05T22:41:00.416Z","repository":{"id":250949673,"uuid":"835765519","full_name":"alakise/decentralized-pgp-key-server-contract","owner":"alakise","description":"A decentralized PGP key server contract with trust scoring and attestation mechanisms.","archived":false,"fork":false,"pushed_at":"2024-07-30T21:22:32.000Z","size":289,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T03:27:53.071Z","etag":null,"topics":["ethereum","ethereum-contract","optimism","pgp","solidity"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alakise.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-30T13:41:57.000Z","updated_at":"2024-12-25T23:41:44.000Z","dependencies_parsed_at":"2024-07-31T01:53:41.728Z","dependency_job_id":null,"html_url":"https://github.com/alakise/decentralized-pgp-key-server-contract","commit_stats":null,"previous_names":["alakise/decentralized-pgp-key-server-contract"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alakise%2Fdecentralized-pgp-key-server-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alakise%2Fdecentralized-pgp-key-server-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alakise%2Fdecentralized-pgp-key-server-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alakise%2Fdecentralized-pgp-key-server-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alakise","download_url":"https://codeload.github.com/alakise/decentralized-pgp-key-server-contract/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239850446,"owners_count":19707348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","ethereum-contract","optimism","pgp","solidity"],"created_at":"2024-11-08T06:50:32.272Z","updated_at":"2026-02-21T04:30:20.295Z","avatar_url":"https://github.com/alakise.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Decentralized PGP Key Server Contract\n\n## Table of Contents\n\n1. [Overview](#overview)\n2. [Features](#features)\n3. [Technical Details](#technical-details)\n   - 3.1 [Contract Inheritance](#contract-inheritance)\n   - 3.2 [Key Data Structures](#key-data-structures)\n   - 3.3 [Core Functionality](#core-functionality)\n   - 3.4 [Calculations and Algorithms](#calculations-and-algorithms)\n   - 3.5 [Security Measures](#security-measures)\n   - 3.6 [Gas Optimization](#gas-optimization)\n   - 3.7 [Events](#events)\n4. [Prerequisites](#prerequisites)\n5. [Installation](#installation)\n6. [Usage](#usage)\n7. [Deployment](#deployment)\n   - 7.1 [Deployed Contract](#deployed-contract)\n8. [Testing](#testing)\n9. [Contributing](#contributing)\n10. [License](#license)\n\n## 1. Overview\n\nThe Advanced PGP Key Server is a smart contract-based solution for managing PGP keys on the Ethereum blockchain. It provides a decentralized platform for key registration, attestation, and trust scoring, enhancing the security and reliability of PGP key management.\n\n## 2. Features\n\n- PGP key registration with staking mechanism\n- Key attestation system\n- Trust scoring based on attestations and account activity\n- Key revocation functionality\n- Stake withdrawal after key revocation\n- Trust decay mechanism to encourage active participation\n- Admin functions for parameter adjustment\n\n## 3. Technical Details\n\n### 3.1 Contract Inheritance\nThe contract inherits from:\n- `ReentrancyGuard`: Prevents reentrancy attacks\n- `Ownable`: Provides basic access control\n- `Pausable`: Allows pausing contract functionality\n\n### 3.2 Key Data Structures\n\n#### PGPKey\nStores information about a registered PGP key:\n- `publicKey`: The PGP public key string\n- `registrationTime`: Timestamp of key registration\n- `isRevoked`: Boolean flag for key revocation status\n- `stake`: Amount of ETH staked with the key\n- `attestations`: Mapping of attestor addresses to Attestation structs\n- `attestors`: Array of attestor addresses\n\n#### Attestation\nRepresents an attestation made for a PGP key:\n- `timestamp`: When the attestation was made\n- `weight`: Importance of the attestation\n- `isRevoked`: Whether the attestation has been revoked\n\n#### TrustMetrics\nHolds various metrics used to calculate trust scores:\n- `totalWeight`: Sum of all attestation weights\n- `recentActivityScore`: Based on recent attestations\n- `longevityScore`: Based on account age\n- `diversityScore`: Based on unique attestors\n- `reputationScore`: Overall reputation score\n\n### 3.3 Core Functionality\n\n1. Key Registration\n2. Attestations\n3. Revocations\n4. Trust Scoring\n5. Stake Management\n6. Admin Functions\n\n### 3.4 Calculations and Algorithms\n\n#### Attestation Weight Calculation\nFormula: `weight = 50 - (attesterScore / 10)`\n\n#### Trust Metrics Calculation\n1. Total Weight\n2. Recent Activity Score\n3. Diversity Score\n4. Longevity Score\n5. Reputation Score\n\n#### Trust Score Calculation\n1. Raw Score Calculation\n2. Score Capping\n3. Trust Decay\n4. Final Score Assignment\n\n#### Key Algorithms\n1. Attestation Process\n2. Trust Score Update\n3. Revocation Handling\n4. Stake Management\n\n### 3.5 Security Measures\n- ReentrancyGuard for all state-changing functions\n- Pausable functionality for emergency stops\n- Access control for admin functions (Ownable)\n\n### 3.6 Gas Optimization\n- Limits the number of attestors processed in trust calculations (MAX_ATTESTORS_PER_UPDATE)\n- Unique Attestor Tracking\n- Selective Updates\n\n### 3.7 Events\n- Key registration\n- Attestations (made/revoked)\n- Key revocation\n- Trust score updates\n- Admin parameter changes\n\n## 4. Prerequisites\n\nBefore you begin, ensure you have met the following requirements:\n\n- Node.js (v14.0.0 or later)\n- npm (v6.0.0 or later)\n- An Ethereum wallet with test ETH (for deploying to testnets)\n- Infura account (for deploying to public networks)\n- Etherscan API key (for contract verification)\n\n## 5. Installation\n\n1. Clone the repository:\n   ```\n   git clone https://github.com/your-username/advanced-pgp-key-server.git\n   cd advanced-pgp-key-server\n   ```\n\n2. Install the dependencies:\n   ```\n   npm install\n   ```\n\n3. Create a `.env` file in the root directory and add the following environment variables:\n   ```\n   MNEMONIC=\"your mnemonic phrase\"\n   INFURA_PROJECT_ID=\"your infura project id\"\n   ETHERSCAN_API_KEY=\"your etherscan api key\"\n   ```\n\n## 6. Usage\n\nTo interact with the contract, you can use Hardhat tasks or write your own scripts. Here are some example commands:\n\n- Compile the contracts:\n  ```\n  npm run compile\n  ```\n\n- Run the tests:\n  ```\n  npm run test\n  ```\n\n- Deploy to local Hardhat network:\n  ```\n  npm run deploy\n  ```\n\n## 7. Deployment\n\nThe contract can be deployed to various Ethereum networks. Use the following commands for deployment:\n\n- Deploy to Sepolia testnet:\n  ```\n  npm run deploy:sepolia\n  ```\n\n- Deploy to Holesky testnet:\n  ```\n  npm run deploy:holesky\n  ```\n\n- Deploy to Ethereum mainnet:\n  ```\n  npm run deploy:mainnet\n  ```\n\nNote: Make sure you have sufficient ETH in your wallet to cover the deployment gas costs.\n\n### 7.1 Deployed Contract\n\nThe contract has been deployed to the Holesky testnet at the following address:\n\n```\n0x431F968abe3Bf65b5Ac6998513A89E9D5c80CDD1\n```\n\n## 8. Testing\n\nTest suite contains 38 tests. Currently all of them functioning as expected. To run the test suite, execute:\n\n```\nnpm run test\n```\n\n\n## 9. Contributing\n\nContributions to the Advanced PGP Key Server project are welcome. Please follow these steps to contribute:\n\n1. Fork the repository\n2. Create a new branch (`git checkout -b feature/your-feature-name`)\n3. Make your changes\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin feature/your-feature-name`)\n6. Create a new Pull Request\n\nPlease make sure to update tests as appropriate and adhere to the existing coding style.\n\n## 10. License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n\n---\n\nFor more information or support, please open an issue in the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falakise%2Fdecentralized-pgp-key-server-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falakise%2Fdecentralized-pgp-key-server-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falakise%2Fdecentralized-pgp-key-server-contract/lists"}