Created
January 11, 2019 01:33
-
-
Save jonspock/57252f1bfac719b2f36d4f1e1d030206 to your computer and use it in GitHub Desktop.
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
Below is based on | |
commit e0e8d79d7a35995e6eb795436658b1a95e5b7a56 | |
Author: hkalodner <harry.kalodner@gmail.com> | |
Date: Sat Mar 17 10:54:47 2018 -0400 | |
Updated versions may need modifications | |
---------------------------------------------------------------- | |
For CMake make sure OPENSSL is setup. | |
+set(OPENSSL_VER "1.0.2n") | |
+set(OPENSSL_ROOT_DIR "/usr/local/Cellar/openssl/${OPENSSL_VER}/") | |
also | |
# to make sure it finds secp256k1 which will be copied in,etc | |
include_directories(${include_directories} ${CMAKE_CURRENT_SOURCE_DIR}/secp256k1/include) | |
link_directories(/usr/local/lib ${CMAKE_CURRENT_SOURCE_DIR}/secp256k1/.libs) | |
add_subdirectory(clustering) | |
---------------------------------------------------------------- | |
From blocksci/opreturn.py | |
remove the various address_matches such as | |
- Address(89427334, address_type.pubkeyhash):"Base64DataAddress1", | |
---------------------------------------------------------------- | |
in clustering directory do this for CMakeLists.txt | |
-add_subdirectory(../libs/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11) | |
+##add_subdirectory(../libs/pybind11 ${CMAKE_CURRENT_BINARY_DIR}/pybind11) | |
-add_subdirectory(src/example) | |
+###add_subdirectory(src/example) | |
---------------------------------------------------------------- | |
---------------------------------------------------------------- | |
COIN SPECIFIC | |
---------------------------------------------------------------- | |
---------------------------------------------------------------- | |
change src/blocksci/util/data_configuration.cpp | |
Around line 63 | |
- pubkeyPrefix = std::vector<unsigned char>(1,0); | |
- scriptPrefix = std::vector<unsigned char>(1,5); | |
+ pubkeyPrefix = std::vector<unsigned char>(1,50); | |
+ scriptPrefix = std::vector<unsigned char>(1,9); | |
Comment out "configFile" stuff around line 32 - not sure why now | |
---------------------------------------------------------------- | |
change src/parser/parser_configuration.cpp | |
around line 50, change | |
- blockMagic = 0xd9b4bef9; | |
+ blockMagic = 0xdf03b5f8; | |
---------------------------------------------------------------- | |
Grab secp256k1 and put at same level as Notebooks | |
You may also have to copy the .dylib, etc files to /usr/local so that the install will work | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
RUNNING | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
do "python3 setup.py install" | |
each time it fails, do a 'pip3 install ...' | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
Copy the blocksci_parser, clusterer and mempool_recorder to your path | |
Go to the directory with the Blocks | |
Run this | |
> blocksci_parser --output-directory ./CHAIN update disk -c . | |
Should create the following dirs in CHAIN | |
addressesDb chain config.ini hashIndex parser scripts | |
copy CHAIN directory to work area (new directory) | |
Run | |
> clusterer CHAIN | |
Should create the following files | |
clusterAddresses.dat clusterOffsets.dat | |
multisig_script_cluster_index.dat nonstandard_script_cluster_index.dat | |
null_data_script_cluster_index.dat pubkey_script_cluster_index.dat | |
scripthash_script_cluster_index.dat | |
> create a directory CLUSTER and move those files in | |
As example, run the following script | |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
import blocksci | |
import blocksci.cluster_python | |
import matplotlib.pyplot as plt | |
import matplotlib.ticker | |
import collections | |
import pandas as pd | |
import numpy as np | |
import sys | |
# Update these paths as needed to point to above created directories | |
chain_data_directory='/Users/Extra/other_repos/BlockSci/Notebooks/CHAIN' | |
cluster_data_directory='/Users/Extra/other_repos/BlockSci/Notebooks/CLUSTER' | |
chain = blocksci.Blockchain(chain_data_directory) | |
cm = blocksci.cluster_python.ClusterManager(cluster_data_directory, chain) | |
#address = chain.address_from_string("MU7YNFPziMRWxCYG3JXJnSsGjPXQNBfxRa") | |
#cluster = cm.cluster_with_address(address) | |
print("Count = ", cm.cluster_count()) | |
COIN = 100000000.0 | |
# Manual insert/update supply to get % | |
supply = 1530431600.0 | |
# Only do wallets with balances above this | |
fiveM = 500000 | |
for i in range(cm.cluster_count()): | |
num = len(cm.clusters()[i].addresses) | |
bal = (cm.clusters()[i].balance()/COIN) | |
sbal = '{:10.0f}'.format(bal) | |
pc = '{:4.1f}'.format(0.1*int(1000.0*(bal/supply))) | |
#if ((num > 1000) and (bal > 10000000)): | |
max_bal = 0 | |
max_address = "" | |
if (bal > fiveM): | |
for a in cm.clusters()[i].addresses: | |
try: | |
av = chain.address_from_string(a.address_string) | |
if (av.balance() > max_bal): | |
max_bal = av.balance() | |
max_address = a.address_string | |
except: | |
print ("Exception for ",a) | |
print(pc,"%, bal = ",sbal," 1st address = ",cm.clusters()[i].addresses[0]," max address = ",max_address," num = ",num) | |
#sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment