Created
January 7, 2024 19:55
-
-
Save Reecepbcups/8a5ee9cdd209601f249fc2c86b840dc8 to your computer and use it in GitHub Desktop.
Read an entire genesis file from the RPC in chunks
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
# ref: https://github.com/Reecepbcups/unicorn-airdrop-list-jan-7 | |
import base64 | |
from httpx import get | |
RPC = "https://rpc.unicorn.meme/genesis_chunked" | |
headers = {"Content-Type": "application/json"} | |
def get_chunk(idx: int = 0) -> str: | |
params = {"chunk": idx} | |
r = get(RPC, params=params, headers=headers) | |
data = r.json().get("result", {}).get("data", {}) | |
return base64.b64decode(data) | |
all_text = "" | |
for i in range(0, 6): | |
text = get_chunk(i) | |
all_text += str(text) | |
with open("chunked_genesis.json", "a") as f: | |
f.write(all_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment