Smart Contracts and the Blockchain

In theory, smart contracts do not depend on the blockchain. In practice, however, most applications do connect the two. Here I investigate the strength of the link by analyzing Github repositories.

I used a Python script to go through all the repositories that fit the search query “smart contracts.” The (very raw) code is appended below, should anyone want to replicate this

I then analyzed the tags of these repositories. I sought to evaluate, what percent mention any of the clearly blockchain related keywords. The problem is that there is a depressingly large amount of scammy sounding tags and various concepts are ambigious. The below is my best attempt to capture what I thought were the biggest blockchain indicators. While there are errors on both sides, I believe that the computation is on the conservative side:

tag_list = (‘etherum’, ‘blockchain’, ‘solidity’, ‘solidty’, ‘distributed-ledger’,’ethereum’, ‘clarity’, ‘ethereum-dapp’, ‘solana’, ‘distributed-systems’, ‘cardano’, ‘hyperledger’, ‘multichain’, ‘bitcoin-script’, ‘solidity-dapps’)

Results: of repos with tags 394/455 contain blockchain indicative tags

Script

import requests

Set the API endpoint and your personal access token

endpoint = “https://api.github.com/search/repositories”
token = “your_personal_access_token”
tag_list = (‘etherum’, ‘blockchain’, ‘solidity’, ‘solidty’, ‘distributed-ledger’,’ethereum’, ‘clarity’, ‘ethereum-dapp’, ‘solana’, ‘distributed-systems’, ‘cardano’, ‘hyperledger’, ‘multichain’, ‘bitcoin-script’, ‘solidity-dapps’)

Set the search query and the parameters for the request

q = “smart contracts”
params = {“q”: q, “sort”: “stars”, “order”: “desc”, “per_page”: 100}
page =1
total_count =0

Make the HTTP request to the API endpoint

counter =0
z=0
i=0
tag_counter =0
while True:
# Set the current page number
params[“page”] = page
response = requests.get(endpoint, params=params, auth=(“username”, token))
tags = []
# Check the status code of the response

if response.status_code == 200:
    # Parse the JSON data in the response
    data = response.json()
    page += 1
    print (page)
    if page >= 11:
            break
    for repo in data["items"]:
        i +=1
        tags=[]
        if len(repo["topics"])>1:
            tag_counter +=1
        for tag in repo["topics"]:
            tags.append(tag)
        z=0
        for t in tags:
            if t in tag_list:
                z=1
            else:
                pass
        if z==1:
            counter+=1
            z=0
        else:
            if len(tags)>1:
                print(tags)

else:
print(f”Request failed with status code: {response.status_code}”)

print(f”Total repos is {i}”)
print (f”total repos with tags is {tag_counter}”)
print(counter)

Leave a Reply

Your email address will not be published.