This script treats DLTs like Radix and Ethereum like engines and attempts to measure their efficiency in creating utility.
Introduction
Mechanical efficiency is measured by dividing Work or Power Output by Power Input:
η=WIW=WorkI=Power Inputη=IWW=WorkI=Power Input
The following method substitutes Github repos for Work and Google Trends volume as a measure of Power Input. The assumption is that amount of ecosystem activity will be roughly reflected in the search volume.
In this version, the number of Github repos for Radix and Ethereum is determined using the comparable search terms “Scrypto Radix” and “Solidity Ethereum”. The search volumes for “Scrypto Radix” are not large enough to register so instead we have used “XRD Radix” and “ETH Ethereum” to maintain equivalence and eliminate searches for other uses of the term ‘Radix’.
Repl
Run the embedded script here or scroll down for the method.
Results
DLT | Repos | Efficiency (η) (23/07/14) | Vs Ethereum | Search terms (Github) | Search terms (Google Trends) |
12461 | 8.45 | 1 | “Solidity Ethereum” | “ETH Ethereum” | |
1076 | 0.79 | 11x | “Rust Solana” | “SOL Solana” | |
Avalanche | 88 | 0.09 | 91x | “Solidity Avalanche” | “AVAX Avalanche” |
176 | 0.09 | 97x | “Plutus Cardano” | “ADA Cardano” | |
Radix | 21 | 0.07 | 123x | “Scrypto Radix” | “XRD Radix” |
Method & Python Script
Install VS Code: https://code.visualstudio.com or another IDE.
In VS Code open a new terminal window by navigating to Terminal > New Terminal.
Install Homebrew by pasting the following code into the terminal and pressing Enter:
Copy
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Install Python in the same way:
Copy
brew install pythonNext, install the modules that the script needs (dependencies):
Copy
pip3 install requests pytrendsNow, create a project folder and navigate to it in VS Code via File > Open Folder.
Create a new Python file in VS Code via File > New File. Name it something like DLTefficiency.py
Copy and paste the following script into DLTefficiency.py and save it.
Copy
# v.0.0.3 import requests from pytrends.request import TrendReq from concurrent.futures import ThreadPoolExecutor from tqdm import tqdm # Function to get the number of Github repositories for a search query def get_github_repo_count(session, search_query): url = f"https://api.github.com/search/repositories?q={search_query}" try: response = session.get(url) response.raise_for_status() return (search_query, response.json()['total_count']) except requests.exceptions.HTTPError: return (search_query, None) # Function to get the worldwide popularity score from Google Trends for a search query def get_google_trends_score(pytrends, search_query): pytrends.build_payload([search_query], timeframe='today 1-m') interest_over_time_df = pytrends.interest_over_time() if not interest_over_time_df.empty: return (search_query, interest_over_time_df[search_query].sum()) else: return (search_query, None) # Function to calculate efficiency score for a search query def calculate_efficiency_score(session, pytrends, search_query_pair): github_search_query, google_trends_search_query = search_query_pair with ThreadPoolExecutor(max_workers=2) as executor: github_future = executor.submit(get_github_repo_count, session, github_search_query) google_future = executor.submit(get_google_trends_score, pytrends, google_trends_search_query) github_repo_result, google_trends_result = github_future.result(), google_future.result() if github_repo_result[1] is not None and google_trends_result[1] is not None: return (search_query_pair, github_repo_result[1] / google_trends_result[1]) else: return (search_query_pair, None) # Main program to calculate efficiency scores for different search queries search_queries = [("Rust Solana", "SOL Solana"), ("Plutus Cardano", "ADA Cardano"), ("Solidity Avalanche", "AVAX Avalanche"), ("Scrypto Radix", "XRD Radix"), # ("wasm polkadot", "DOT polkadot") # Github seems to only allow 4 queries. ] baseline_search_query = ("Solidity Ethereum", "ETH Ethereum") with requests.Session() as session: pytrends = TrendReq(hl='en-US', tz=360) github_results, google_results, efficiency_scores = [], [], [] for query in tqdm([baseline_search_query] + search_queries, desc='Calculating Efficiency Scores'): github_result = get_github_repo_count(session, query[0]) google_result = get_google_trends_score(pytrends, query[1]) efficiency_score = calculate_efficiency_score(session, pytrends, query) github_results.append(github_result) google_results.append(google_result) efficiency_scores.append(efficiency_score) print("Github Repository Counts:\n") for query, count in github_results: print(f"{query}: {count}") print("\nGoogle Trends Scores:\n") for query, score in google_results: print(f"{query}: {score}") print("\nEfficiency Scores:\n") baseline_efficiency_score = efficiency_scores[0][1] # Get baseline efficiency score for query, score in efficiency_scores: if score is not None: value_metric = baseline_efficiency_score / score print(f"{query[0].split(' ')[1]}: {score:.2f} (Ethereum = {value_metric:.0f}x {query[0].split(' ')[1]})") else: print(f"Error calculating efficiency score for '{query[0]}' and '{query[1]}'.")Run the script from the terminal with:
Copy
python3 DLTefficiency.pyConnect your wallet to join the discussion.
