Created
December 22, 2023 02:54
-
-
Save tkgshn/aece3bdd6ba193ebb2be932d621f131c to your computer and use it in GitHub Desktop.
Estimating the cost of generate clustered data in GR participant data via DeCartography
This file contains 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
import json | |
def load_data(file_path): | |
with open(file_path, 'r') as f: | |
return json.load(f) | |
def calculate_tasks(data, file_path): | |
total_address = len(data) | |
print(f"Analyzing {total_address:,} addresses... (Target file: '{file_path.split('/')[-1]}')") | |
count_of_initial_task = total_address / 6 | |
count_of_subsequent_task = total_address / 6 | |
count_of_additional_task = count_of_initial_task / 2 | |
total_require_count_analyze = round(count_of_initial_task + count_of_subsequent_task + count_of_additional_task) | |
print(f"Need to solve {total_require_count_analyze:,} tasks") | |
session_per_task = 10 | |
number_of_require_session = total_require_count_analyze / session_per_task | |
budget_per_session_USD = 0.5 | |
print(f"If you solve {session_per_task} tasks per session and pay {budget_per_session_USD}$ as a reward...") | |
total_budget = number_of_require_session * budget_per_session_USD | |
number_of_required_send_transaction = total_require_count_analyze / session_per_task | |
print(f"A budget of {round(total_budget):,} $ is required. This requires {round(number_of_required_send_transaction):,} transactions. (Gas fee for sending is required, reduction is possible with batch operation)") | |
file_path = '/Users/tkgshn/Desktop/decartography/backend/backend_app/static/gr15_addresses.json' # or, mvp_addresses30file.json | |
data = load_data(file_path) | |
calculate_tasks(data, file_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment