diff --git a/README.md b/README.md index de341cf..ab40666 100644 --- a/README.md +++ b/README.md @@ -113,14 +113,14 @@ from bitcoin_tools.analysis.status.utils import parse_ldb # Set the version of the Bitcoin Core you are using (which defines the chainstate format) # and the IO files. -version = 0.15 + f_utxos = "decoded_utxos.txt" f_parsed_utxos = "parsed_utxos.txt" # Parse all the data in the chainstate. -parse_ldb(f_utxos, version=version) +parse_ldb(f_utxos) # Parses transactions and utxos from the dumped data. -utxo_dump(f_utxos, f_parsed_utxos, version=version) +utxo_dump(f_utxos, f_parsed_utxos) # Data is stored in f_utxos and f_parsed_utxos files respectively ``` diff --git a/bitcoin_tools/analysis/status/README.md b/bitcoin_tools/analysis/status/README.md index f3d543c..6ca5025 100644 --- a/bitcoin_tools/analysis/status/README.md +++ b/bitcoin_tools/analysis/status/README.md @@ -3,9 +3,11 @@ **STATUS** (**ST**atistical **A**nalysis **T**ool for **U**txo **S**et) is an open source tool that provides an easy way to access, decode and analyze data from the Bitcoin's `utxo set`. The accompanying working paper further explains its design, application, and presents results of a recently performed analysis: [https://eprint.iacr.org/2017/1095.pdf](https://eprint.iacr.org/2017/1095.pdf) -STATUS is coded in Python 2 and works for both the existing versions of Bitcoin Core's `utxo set`, that is, the first defined format (versions 0.8 - 0.14) and the recently defined one (version 0.15). +STATUS is coded in Python 2 and works for both the existing versions of Bitcoin Core's `utxo set`, that is, the first defined format (versions 0.8 - 0.14) and the recently defined one (version 0.15). -STATUS reads from a LevelDB folder (usually located under `.bitcoin/chainstate`) and parses all the `utxo` entries into a `json` file. From the parsed file, STATUS allows you to perform two type of analysis, a `utxo` based one, and a `transaction` based one, by decoding all the parsed information from the chainstate. +STATUS works, from now on, with 0.15 format. For 0.8-0.14 version refer to `ldb_0.14` branch. + +STATUS reads from a LevelDB folder (usually located under `.bitcoin/chainstate`) and parses all the `utxo` entries into a `json` file. From the parsed file, STATUS allows you to perform two type of analysis, a `utxo` based one, and a `transaction` based one, by decoding all the parsed information from the chainstate. ## UTXO based analysis diff --git a/bitcoin_tools/analysis/status/data_dump.py b/bitcoin_tools/analysis/status/data_dump.py index 385b630..c049a21 100644 --- a/bitcoin_tools/analysis/status/data_dump.py +++ b/bitcoin_tools/analysis/status/data_dump.py @@ -6,6 +6,16 @@ def transaction_dump(fin_name, fout_name): + """ + Reads from a parsed utxo file and dumps additional metadata related to transactions. + + :param fin_name: Name of the parsed utxo file. + :type fin_name: str + :param fout_name: Name of the file where the final data will be stored. + :type fout_name: str + :return: None + :rtype: None + """ # Transaction dump # Set the input and output files @@ -44,7 +54,19 @@ def transaction_dump(fin_name, fout_name): fout.close() -def utxo_dump(fin_name, fout_name, coin, count_p2sh=False, non_std_only=False, ordered_dict=False): +def utxo_dump(fin_name, fout_name, coin, count_p2sh=False, non_std_only=False): + """ + Reads from a parsed utxo file and dumps additional metadata related to utxos. + + :param fin_name: Name of the parsed utxo file. + :type fin_name: str + :param fout_name: Name of the file where the final data will be stored. + :type fout_name: str + :param coin: Currency that will be analysed + :return: None + :rtype: None + """ + # UTXO dump # Input file @@ -108,14 +130,14 @@ def utxo_dump(fin_name, fout_name, coin, count_p2sh=False, non_std_only=False, o "index": utxo['index'], "register_len": utxo['len']} - # Additional data used to explain dust figures (describes the size taken into account by each metric - # when computing dust/unprofitability). It is not used in most of the cases, and generates overhead - # in both size and time of execution, so ity is not added by default. Uncomment if necessary. + # Additional data used to explain dust figures (describes the size taken into account by each metric + # when computing dust/unprofitability). It is not used in most of the cases, and generates overhead + # in both size and time of execution, so ity is not added by default. Uncomment if necessary. - # result["dust_size"] = out_size + in_size - # result["min_size"] = min_size - # result["est_size"] = get_est_input_size(out, utxo["height"], p2pkh_pksize, p2sh_scriptsize, - # nonstd_scriptsize, p2wsh_scriptsize)} + # result["dust_size"] = out_size + in_size + # result["min_size"] = min_size + # result["est_size"] = get_est_input_size(out, utxo["height"], p2pkh_pksize, p2sh_scriptsize, + # nonstd_scriptsize, p2wsh_scriptsize)} # Updates the dictionary with the remaining data from out, and stores it in disk. result.update(out)