[notes][spam] pursuing dgit/gitopia

Undiscussed Horrific Abuse, One Victim of Many gmkarl at gmail.com
Tue Feb 15 02:39:30 PST 2022


# I think this python script enumerates all git updates on the arweave
blockchain. There are not very many. The hashes are not included,
means adding query parameters I haven't found where to look up quite
yet.
# The early updates used an app called 'argit', then called 'dgit',
and then 'Gitopia' is where things migrated off.

#!/usr/bin/env python3

import json
import requests

GRAPHQL_URI='https://arweave.net/graphql'

def find_updates(uri, Type, cursor=''):
    resp = requests.post(uri,
    	json={'query':'''
    		query {
    			transactions(
    				tags: [
    					{ name: "Type", values: [''' + json.dumps(Type) + '''] }
    				]
                    after: ''' + json.dumps(cursor) + '''
    			) {
    				edges {
    					node {
    						owner {
    							address
    						}
                            tags {
                                name
                                value
                            }
    					}
                        cursor
    				}
    			}
            }
    	'''}
    )
    cursor = None
    data = resp.json()
    if 'data' not in data:
        raise Exception(data)
    edges = data['data']['transactions']['edges']
    if len(edges):
        cursor = edges[-1]['cursor']
    objects = [
        dict(
            owner = node['owner']['address'],
            tags = {tag['name']: tag['value'] for tag in node['tags']}
        )
        for node in (edge['node'] for edge in edges)
    ]
    return objects, cursor

cursor = None
while True:
    objs, cursor = find_updates(GRAPHQL_URI, 'update-ref', cursor)
    if not len(objs):
        break
    for obj in objs:
        print(obj)


More information about the cypherpunks mailing list