{"id":44019407,"url":"https://github.com/multisig-labs/slurp","last_synced_at":"2026-02-07T16:07:25.468Z","repository":{"id":187149727,"uuid":"674488920","full_name":"multisig-labs/slurp","owner":"multisig-labs","description":"CLI that downloads the Avalanche P-Chain to a SQLIte database for exploration","archived":false,"fork":false,"pushed_at":"2025-02-21T22:19:08.000Z","size":77,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-21T23:34:28.672Z","etag":null,"topics":["avalanchego","sqlite"],"latest_commit_sha":null,"homepage":"https://gogopool.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multisig-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-08-04T04:26:59.000Z","updated_at":"2025-02-21T22:19:12.000Z","dependencies_parsed_at":"2024-01-31T18:45:05.241Z","dependency_job_id":"bc37ab02-1d05-4861-87cf-a056103752e0","html_url":"https://github.com/multisig-labs/slurp","commit_stats":null,"previous_names":["multisig-labs/slurp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/multisig-labs/slurp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multisig-labs%2Fslurp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multisig-labs%2Fslurp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multisig-labs%2Fslurp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multisig-labs%2Fslurp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multisig-labs","download_url":"https://codeload.github.com/multisig-labs/slurp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multisig-labs%2Fslurp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29199519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T14:35:27.868Z","status":"ssl_error","status_checked_at":"2026-02-07T14:25:51.081Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["avalanchego","sqlite"],"created_at":"2026-02-07T16:07:24.969Z","updated_at":"2026-02-07T16:07:25.462Z","avatar_url":"https://github.com/multisig-labs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slurp\n\nUse the AvalancheGo Index API to slurp blocks into a sqlite database.\n\nA SQLite DB file containing the entire P-Chain (as of 8-2023) can be found [here](https://gogopool.s3.amazonaws.com/slurp-mainnet-processed.db.7z) (~5G zipped)\n\n## Data\n\nThe `raw_blocks_p` table has a row for every index number, which is just an incrementing integer the indexer creates when indexing the chain. Once this table is populated with every block, we then process each block and save the transactions into the `txs_p` table.\n\n## Usage\n\n```\n# We require SQLite 3.42+ (built-in Mac one is too old)\nbrew install sqlc just sqlite3\n\n# Need to activate the brew sqlite3 version with something like this\n# echo 'export PATH=\"/opt/homebrew/opt/sqlite/bin:$PATH\"' \u003e\u003e ~/.zshrc\n\njust build\njust create-db\n\n# Find out latest chain height\ncurl --request POST \\\n  --url https://api.avax.network/ext/bc/P \\\n  --header 'content-type: application/json' \\\n  --data '{\"id\": 0,\"jsonrpc\": \"2.0\",\"method\": \"platform.getHeight\",\"params\": {}}'\n\n# Slurp the raw blocks\nbin/slurp pchain --node-url https://indexer-demo.avax.network 0 7827793\n\n(NOTE: We were using the indexer demo above, since it was faster, but it seems to be gone now, so we should really change back to using an archive node)\n\n# Now process the DB to parse the blocks starting at idx 0 and processing 7827793 blocks into transactions\nbin/slurp process-p 0 7827793\n```\n\n## SQL FTW\n\nIn keeping with the quick-and-dirty theme of this project, we use the `avalanchego` packages to marshal a block into JSON, then insert the JSON into a SQLite `text` column, and leverage generated columns and json functions to break out the pieces we are interested in into their own columns.\n\n## Interesting Queries\n\n```sql\nselect count(*) count, memo from txs_p\ngroup by memo\norder by count desc;\n\nselect count(*) count, node_id\nfrom txs_p\nwhere type_id = 14 -- AddValidatorTx\ngroup by node_id\norder by count desc;\n\nselect count(*) count, rewards_addr\nfrom txs_p\nwhere type_id = 14 -- AddValidatorTx\ngroup by rewards_addr\norder by count desc;\n\nselect count(*) as count, signer_addr_p\nfrom txs_p\nwhere signer_addr_p != \"\"\ngroup by signer_addr_p\norder by count desc;\n\nselect count(*) as count, signer_addr_c\nfrom txs_p\nwhere signer_addr_c != \"\"\ngroup by signer_addr_c\norder by count desc;\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultisig-labs%2Fslurp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultisig-labs%2Fslurp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultisig-labs%2Fslurp/lists"}