Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vaibhavs10/summer_of_bitcoin
https://github.com/vaibhavs10/summer_of_bitcoin
Last synced: 17 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/vaibhavs10/summer_of_bitcoin
- Owner: Vaibhavs10
- Created: 2021-06-14T13:14:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-16T22:26:24.000Z (over 3 years ago)
- Last Synced: 2023-08-26T05:22:58.120Z (over 1 year ago)
- Language: Python
- Size: 445 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Summer of Bitcoin
Submission by [Vaibhav Srivastav](https://de.linkedin.com/in/vaibhavs10 "Vaibhav's LinkedIn")
## Run Guide
To create the block run:
```
python transactions.py
```
To run tests on the newly created block run:
```
python tests.py
```Note: The code has only been tested on Python 3.8.5 and doesn't require any special packages except the standard library.
## Methodology
The key strategy used is to optimise on transaction fees.
1. Parse mempool.csv
2. Sort the transactions in descending order on fees
3. Find all the parents (& their parents & so on) for all the transactions with parent IDs
4. Slot in all the parent IDs before the child transaction ID
5. Write to block so long as the block weight is less than the MAX_WEIGHTThe focus while building this code was to ensure all the block conditions are met, hence a lot of quadratic lookups have been made to ensure that the transactions are valid.
## Further Improvements
There are a lot quadratic lookups throughout the code to check whether all the parents and their parents (and so on) are slotted in before the child transactions, for a large mempool, this would not scale well.
Possible improvements could to be to use hashmaps or deques for faster search and access.