-
Notifications
You must be signed in to change notification settings - Fork 705
Add sybil checker Skill using Gitcoin passport and proof of humanity #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MrGtee1
wants to merge
9
commits into
crestalnetwork:main
Choose a base branch
from
MrGtee1:skill/sybil-checker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bff37bc
Add sybil_checker skill combining Gitcoin Passport and PoH
MrGtee1 4343f74
Merge branch 'main' into skill/sybil-checker
bluntbrain e588273
chore: remove test_sybil.py
MrGtee1 c93b600
chore: remove requirements.txt
MrGtee1 8728782
chore: remove dummy epyxid module
MrGtee1 9b73e48
docs: add sybil_checker skill icon
MrGtee1 3674671
feat(schema): add docs section with description and icon
MrGtee1 6d28bb9
docs(sybil_checker): move logo to skill root and update schema image URL
MrGtee1 8371642
Remove incorrect sybil_checker image
MrGtee1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| class XID: | ||
| def __init__(self): | ||
| self.value = "dummy-xid" | ||
|
|
||
| def __str__(self): | ||
| return self.value | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| annotated-types==0.7.0 | ||
|
MrGtee1 marked this conversation as resolved.
Outdated
|
||
| anyio==4.9.0 | ||
| argon2-cffi==23.1.0 | ||
| argon2-cffi-bindings==21.2.0 | ||
| arrow==1.3.0 | ||
| asttokens==3.0.0 | ||
| async-lru==2.0.5 | ||
| attrs==25.3.0 | ||
| babel==2.17.0 | ||
| beautifulsoup4==4.13.3 | ||
| bleach==6.2.0 | ||
| build==1.2.2.post1 | ||
| CacheControl==0.14.2 | ||
| certifi==2025.1.31 | ||
| cffi==1.17.1 | ||
| charset-normalizer==3.4.1 | ||
| cleo==2.1.0 | ||
| colorama==0.4.6 | ||
| comm==0.2.2 | ||
| contourpy==1.3.1 | ||
| crashtest==0.4.1 | ||
| cryptography==44.0.2 | ||
| cycler==0.12.1 | ||
| debugpy==1.8.13 | ||
| decorator==5.2.1 | ||
| defusedxml==0.7.1 | ||
| distlib==0.3.9 | ||
| dulwich==0.22.8 | ||
| executing==2.2.0 | ||
| fastjsonschema==2.21.1 | ||
| filelock==3.13.1 | ||
| findpython==0.6.3 | ||
| fonttools==4.56.0 | ||
| fqdn==1.5.1 | ||
| fsspec==2024.6.1 | ||
| gitdb==4.0.12 | ||
| GitPython==3.1.44 | ||
| h11==0.14.0 | ||
| httpcore==1.0.7 | ||
| httpx==0.28.1 | ||
| idna==3.10 | ||
| installer==0.7.0 | ||
| ipykernel==6.29.5 | ||
| ipython==9.0.2 | ||
| ipython_pygments_lexers==1.1.1 | ||
| isoduration==20.11.0 | ||
| jaraco.classes==3.4.0 | ||
| jaraco.context==6.0.1 | ||
| jaraco.functools==4.1.0 | ||
| jedi==0.19.2 | ||
| jeepney==0.9.0 | ||
| Jinja2==3.1.6 | ||
| joblib==1.4.2 | ||
| json5==0.10.0 | ||
| jsonpatch==1.33 | ||
| jsonpointer==3.0.0 | ||
| jsonschema==4.23.0 | ||
| jsonschema-specifications==2024.10.1 | ||
| jupyter-events==0.12.0 | ||
| jupyter-lsp==2.2.5 | ||
| jupyter-server-mathjax==0.2.6 | ||
| jupyter_client==8.6.3 | ||
| jupyter_core==5.7.2 | ||
| jupyter_server==2.15.0 | ||
| jupyter_server_terminals==0.5.3 | ||
| jupyterlab==4.3.6 | ||
| jupyterlab_git==0.51.0 | ||
| jupyterlab_pygments==0.3.0 | ||
| jupyterlab_server==2.27.3 | ||
| keyring==25.6.0 | ||
| kiwisolver==1.4.8 | ||
| langchain-core==0.3.54 | ||
| langsmith==0.3.32 | ||
| MarkupSafe==3.0.2 | ||
| matplotlib==3.10.1 | ||
| matplotlib-inline==0.1.7 | ||
| mistune==3.1.2 | ||
| more-itertools==10.6.0 | ||
| mpmath==1.3.0 | ||
| msgpack==1.1.0 | ||
| narwhals==1.31.0 | ||
| nbclient==0.10.2 | ||
| nbconvert==7.16.6 | ||
| nbdime==4.0.2 | ||
| nbformat==5.10.4 | ||
| nest-asyncio==1.6.0 | ||
| networkx==3.3 | ||
| notebook_shim==0.2.4 | ||
| numpy==2.2.4 | ||
| orjson==3.10.16 | ||
| overrides==7.7.0 | ||
| packaging==24.2 | ||
| pandas==2.2.3 | ||
| pandocfilters==1.5.1 | ||
| parso==0.8.4 | ||
| pbs-installer==2025.4.9 | ||
| pexpect==4.9.0 | ||
| pillow==11.1.0 | ||
| pkginfo==1.12.1.2 | ||
| platformdirs==4.3.6 | ||
| plotly==6.0.1 | ||
| poetry==2.1.2 | ||
| poetry-core==2.1.2 | ||
| prometheus_client==0.21.1 | ||
| prompt_toolkit==3.0.50 | ||
| psutil==7.0.0 | ||
| ptyprocess==0.7.0 | ||
| pure_eval==0.2.3 | ||
| pycparser==2.22 | ||
| pydantic==2.11.3 | ||
| pydantic_core==2.33.1 | ||
| Pygments==2.19.1 | ||
| pyparsing==3.2.1 | ||
| pyproject_hooks==1.2.0 | ||
| python-dateutil==2.9.0.post0 | ||
| python-json-logger==3.3.0 | ||
| pytz==2025.1 | ||
| PyYAML==6.0.2 | ||
| pyzmq==26.3.0 | ||
| RapidFuzz==3.13.0 | ||
| referencing==0.36.2 | ||
| requests==2.32.3 | ||
| requests-toolbelt==1.0.0 | ||
| rfc3339-validator==0.1.4 | ||
| rfc3986-validator==0.1.1 | ||
| rpds-py==0.23.1 | ||
| scikit-learn==1.6.1 | ||
| scipy==1.15.2 | ||
| seaborn==0.13.2 | ||
| SecretStorage==3.3.3 | ||
| Send2Trash==1.8.3 | ||
| setuptools==76.0.0 | ||
| shellingham==1.5.4 | ||
| six==1.17.0 | ||
| smmap==5.0.2 | ||
| sniffio==1.3.1 | ||
| soupsieve==2.6 | ||
| stack-data==0.6.3 | ||
| sympy==1.13.1 | ||
| tenacity==9.1.2 | ||
| terminado==0.18.1 | ||
| threadpoolctl==3.6.0 | ||
| tinycss2==1.4.0 | ||
| tomlkit==0.13.2 | ||
| torch==2.6.0+cpu | ||
| tornado==6.4.2 | ||
| traitlets==5.14.3 | ||
| trove-classifiers==2025.4.11.15 | ||
| types-python-dateutil==2.9.0.20241206 | ||
| typing-inspection==0.4.0 | ||
| typing_extensions==4.12.2 | ||
| tzdata==2025.1 | ||
| uri-template==1.3.0 | ||
| urllib3==2.3.0 | ||
| virtualenv==20.30.0 | ||
| wcwidth==0.2.13 | ||
| webcolors==24.11.1 | ||
| webencodings==0.5.1 | ||
| websocket-client==1.8.0 | ||
| zstandard==0.23.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from .combined_checker import CombinedSybilChecker | ||
|
|
||
| def get_skills(config): | ||
| return [CombinedSybilChecker(config)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| from skills.base import Skill | ||
|
|
||
| class SybilCheckerSkill(Skill): | ||
| def check_sybil(self, wallet_address: str) -> dict: | ||
| raise NotImplementedError("Must implement check_sybil method") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| from .base import SybilCheckerSkill | ||
| from .gitcoin_passport_checker import GitcoinPassportChecker | ||
| from .proof_of_humanity_checker import ProofOfHumanityChecker | ||
|
|
||
| class CombinedSybilChecker(SybilCheckerSkill): | ||
| def __init__(self, config): | ||
| self.gitcoin_checker = GitcoinPassportChecker(config) | ||
| self.poh_checker = ProofOfHumanityChecker(config) | ||
|
|
||
| def check_sybil(self, wallet_address: str) -> dict: | ||
| gitcoin_result = self.gitcoin_checker.check_sybil(wallet_address) | ||
| poh_result = self.poh_checker.check_sybil(wallet_address) | ||
|
|
||
| return { | ||
| "wallet": wallet_address, | ||
| "results": [ | ||
| gitcoin_result, | ||
| poh_result | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import requests | ||
| from .base import SybilCheckerSkill | ||
|
|
||
| class GitcoinPassportChecker(SybilCheckerSkill): | ||
| def __init__(self, config): | ||
| self.api_key = config.get("api_key") | ||
| self.base_url = "https://api.scorer.gitcoin.co" | ||
|
|
||
| def check_sybil(self, wallet_address: str) -> dict: | ||
| headers = {"Authorization": f"Bearer {self.api_key}"} | ||
| url = f"{self.base_url}/v1/score/{wallet_address}" | ||
| response = requests.get(url, headers=headers) | ||
| if response.status_code == 200: | ||
| return { | ||
| "source": "Gitcoin Passport", | ||
| "result": response.json() | ||
| } | ||
| else: | ||
| return { | ||
| "source": "Gitcoin Passport", | ||
| "error": f"Failed with status {response.status_code}" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import requests | ||
| from .base import SybilCheckerSkill | ||
|
|
||
| class ProofOfHumanityChecker(SybilCheckerSkill): | ||
| def __init__(self, config): | ||
| self.subgraph_url = "https://api.thegraph.com/subgraphs/name/kleros/proof-of-humanity" | ||
|
|
||
| def check_sybil(self, wallet_address: str) -> dict: | ||
| query = { | ||
| "query": """ | ||
| query ($id: ID!) { | ||
| submission(id: $id) { | ||
| id | ||
| registered | ||
| submissionTime | ||
| name | ||
| } | ||
| } | ||
| """, | ||
| "variables": { | ||
| "id": wallet_address.lower() | ||
| } | ||
| } | ||
|
|
||
| response = requests.post(self.subgraph_url, json=query) | ||
| data = response.json() | ||
|
|
||
| submission = data.get("data", {}).get("submission") | ||
| if submission and submission.get("registered"): | ||
| return { | ||
| "source": "Proof of Humanity", | ||
| "result": { | ||
| "status": "verified", | ||
| "details": submission | ||
| } | ||
| } | ||
| else: | ||
| return { | ||
| "source": "Proof of Humanity", | ||
| "result": { | ||
| "status": "not_verified", | ||
| "details": None | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "type": "object", | ||
| "properties": { | ||
| "api_key": { | ||
|
MrGtee1 marked this conversation as resolved.
Outdated
|
||
| "type": "string", | ||
| "description": "Gitcoin Passport API key" | ||
| } | ||
| }, | ||
| "required": ["api_key"] | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from skills.sybil_checker.combined_checker import CombinedSybilChecker | ||
|
MrGtee1 marked this conversation as resolved.
Outdated
|
||
|
|
||
| config = { | ||
| "api_key": "JJ3ZuaRt.myiyKaSSySNw74J1myDlU4M2KabnPlaa" | ||
| } | ||
|
|
||
| checker = CombinedSybilChecker(config) | ||
| result = checker.check_sybil("0x4c98bF5ADC39E12f81c214cC3A32Ef24F9CAbeB3") # Replace with any wallet | ||
| print(result) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.