This file contains hidden or 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
const data = await alchemy.core.getAssetTransfers({ // fetch Transaction Data | |
fromBlock:"0x0", | |
fromAddress: desiredWallet, | |
category: ["external", "internal", "erc20", "erc721", "erc1155"], | |
}) | |
const transfers = data['transfers'] | |
const bool_array = [] | |
if (transfers.length > 5) { | |
bool_array.push(true) |
This file contains hidden or 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
// fetching transaction history | |
const data = await alchemy.core.getAssetTransfers({ | |
fromBlock:"0x0", | |
fromAddress: desiredWallet, | |
category: ["external", "internal", "erc20", "erc721", "erc1155"], | |
}) | |
// alg 1 | |
var account_sender_count = {} | |
for (let i =0; i<= transfers.length; i++) { | |
const cur_transfer_dict = transfers[i] |
This file contains hidden or 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
// fetch all tokens | |
async function checkBal() { | |
var token_dict = {} | |
console.log("In function") | |
const address = desiredWallet; // holder address needs to change | |
// Get token balances | |
const balances = await alchemy.core.getTokenBalances(address); | |
console.log(balances) |
This file contains hidden or 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 hashlib | |
import random | |
nonce_limit = 1000000000 | |
zeroes = random.randint(1, 100) | |
def mine(block_num, transaction_hash, previous_hash): | |
for nonce in range(nonce_limit): | |
base_text = str(block_num) + transaction_hash + previous_hash + str(nonce) |
This file contains hidden or 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 math | |
def sieve_of_eratosthenes (limit): | |
if (limit <= 1): | |
return [] | |
output = [True] * (limit+1) | |
output[0] = False |
This file contains hidden or 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
def sieve_of_eratosthenes(limit): | |
true_indices = [] | |
array = [i for i in range(2, limit + 1)] | |
dictionary = {} | |
for number in array: | |
dictionary[number] = True | |
for key, value in dictionary.items(): | |
if value == False: | |
continue |
This file contains hidden or 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
def visit_checker(graph): | |
for status in list(graph.values()): | |
if status == "unvisited": | |
return False | |
else: | |
continue | |
return True | |
def traveling_salesperson(graph): |
This file contains hidden or 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
def dfs(graph, current_vertex, edges, last_edge, last_vertex, prev_vertex=None, visited=None): | |
edges_vertices = (list(graph.values())) | |
lst_values = [] | |
for lst in edges_vertices: | |
lst_values.append(len(lst)) | |
biggest_lst = max(lst_values) | |
biggest_edge = None |
This file contains hidden or 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
from dfs import dfs | |
from inputs import g1, g2 | |
paths = [] | |
def eulerian(*args): | |
graphs = args | |
for graph in graphs: | |
print("-"*24 + "\n") |
This file contains hidden or 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
## Our graph has been converted into a dictionary in the form of {vertex: [edge1, edge2, edge3, ..., edge n]} ## | |
### BFS Traversal ### | |
first_element = list(test_graph.graph_dict.keys())[0] | |
last_element = list(test_graph.graph_dict.keys())[-1] | |
lst = list(test_graph.graph_dict[first_element].edges.keys()) | |
for i in range(len(lst)): | |
first_edge = lst[0] |
NewerOlder