{"id":21459187,"url":"https://github.com/citp/testchain-generator","last_synced_at":"2025-07-15T01:31:50.159Z","repository":{"id":48231762,"uuid":"158274148","full_name":"citp/testchain-generator","owner":"citp","description":"Generate synthetic blockchains","archived":false,"fork":false,"pushed_at":"2021-12-13T10:04:44.000Z","size":47,"stargazers_count":8,"open_issues_count":4,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-07-30T17:24:45.944Z","etag":null,"topics":["bitcoin","bitcoin-cash","blockchain","blocksci"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/citp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-19T18:47:16.000Z","updated_at":"2023-06-23T16:16:18.000Z","dependencies_parsed_at":"2022-09-15T12:11:24.884Z","dependency_job_id":null,"html_url":"https://github.com/citp/testchain-generator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citp%2Ftestchain-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citp%2Ftestchain-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citp%2Ftestchain-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/citp%2Ftestchain-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/citp","download_url":"https://codeload.github.com/citp/testchain-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226012036,"owners_count":17559607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitcoin-cash","blockchain","blocksci"],"created_at":"2024-11-23T06:27:18.573Z","updated_at":"2024-11-23T06:27:19.019Z","avatar_url":"https://github.com/citp.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testchain Generator\n\n[![Build Status](https://travis-ci.org/citp/testchain-generator.svg?branch=master)](https://travis-ci.org/citp/testchain-generator)\n\nThis tools deterministically generates a synthetic blockchain using Bitcoin's regtest mode.\nIt was written to provide a lean blockchain to run functional and regression against and is used to test [BlockSci](https://github.com/citp/BlockSci).\n\n## Requirements\n- Requires Python \u003e=3.6\n- Install Bitcoin Core (`bitcoind`)\n    - Mac: `brew install bitcoin`\n    - Linux: [Install instructions](https://bitcoin.org/en/full-node#linux-instructions) (only install the daemon)\n- Install [secp256k1](https://github.com/bitcoin-core/secp256k1)\n- Install Python3 requirements\n    - `pip3 install -r requirements.txt`\n\n## Running\n\nThe `generate_chain.py` script takes three arguments:\n\n- `--output-dir=` specifies where the output should be stored (default: `../files/`)\n- `--chain=` specifies whether a Bitcoin or a Bitcoin Cash chain should be generated (options: `btc` or `bch`, default: `btc`)\n- `--exec=` expects a path to the node daemon (default: `bitcoind`)\n\nIf you are using this as a submodule for BlockSci and want to update the Bitcoin (BTC) chain, you would run\n```\npython3 generate_chain.py\n```\nIt will automatically update the `BlockSci/test/files/btc/` directory with the new block and json files. \n\nTo update the Bitcoin Cash output, you'll need to select `bch` and provide a path to the Bitcoin ABC daemon executable.\n```\npython3 generate_chain.py --chain=bch --exec=\u003cpath/to/bitcoincashdaemon\u003e\n```\n\nIf you're using this as a standalone tool, you'll probably want to change the output directory for the generated files, e.g.\n```\npython3 generate_chain.py --output-dir=.output\n```\n\n## Extending the blockchain\n\nNew motifs can be created by adding a new class in `blockgen/motifs/` that inherits from `Generator`.\nThen, add this new class to `generate_chain.py`.\nThe `Generator` class provides a number of utility functions, such as:\n\n- `next_address()`: returns a new `Address`\n- `current_address()`: returns the current address (the one returned by the last `next_address()` call)\n- `fund_address(addr, value)`: sends `value` BTC to the address `addr`\n- `create_transaction([sources], [recipients])`: creates a new transaction using a list of addresses as inputs (`[sources]`) and another list of addresses as outputs (`[recipients]`)\n- `generate_block()`: creates a new block that includes all transactions created since it was last called\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitp%2Ftestchain-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcitp%2Ftestchain-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitp%2Ftestchain-generator/lists"}