Skip to content

Instantly share code, notes, and snippets.

Announcing python-bitcointx v1.0.1 release

Python-bitcointx is a Python3 (3.6+) library to work with Bitcoin transactions, and other related things, like addresses, keys, Bitcoin script, etc.

It is based on popular python-bitcoinlib library, but with slightly different focus. Some functionality was removed to reduce the maintenance burden, while other useful functionaliy was added (full list of changes is in release notes).

This library should be viewed as a completely separate library from python-bitcoinlib, it diverges from python-bitcoinlib significantly and breaks the compatibility when it makes sense. Still, it can accomodate most of the code written for python-bitcoinlib, with minor adjustments.

I did not release the official announcement of the library until now, so here it goes.

This is the sketch of the loan contract that allows price-dependent liquidation without involving an oracle.
Author: Dmitry Petukhov (https://github.com/dgpv/)
Concrete implementation is not yet thought out.
This sketch does not take into account the fees that the debtor has to pay, for simplicity of illustration.
Fees will make calculations more complex, but the basic principle should still work.
Loan contract:
- Alice puts 1 btc collateral,
- Bob gives 10K usdt loan
This is the sketch of the loan contract that allows price-dependent liquidation via oracle signature,
but with leverage-enforced protection from malicious oracle
Author: Dmitry Petukhov (https://github.com/dgpv/)
----
Other sketches:
- Price-dependent loan liquidation without involving an oracle:
https://gist.github.com/dgpv/49bba5ac33764301204493f2837be270
- Asset price bet contract that allows price-dependent outcome without involving an oracle:
https://gist.github.com/dgpv/6ec715a4f38d61cc9058c2619ca44b89
This is the sketch of the bet contract that allows price-dependent outcome without involving an oracle.
Author: Dmitry Petukhov (https://github.com/dgpv/)
Note: the asset prices are chosen for convenience and may not reflect current reality.
Assumes the possibility to use the covenant to enforce the rules,
for example the coventant that was used for the construction of
asset-based loans for Liquid Network: https://ruggedbytes.com/articles/ll/
Bet: