A python client to interact with the tbtc protocol.
tBTC Protocol version: 1.1.0
-
Create & activate virtulenv (python 3.6+)
-
Install the library using pypi.
pip install tbtc
-
Initialize the tbtc system
>>> from tbtc.session import init_web3 >>> node_url = os.getenv("ROPSTEN_URL") >>> private_key = os.getenv("TBTC_PRIVATE_KEY") >>> w3 = init_web3(node_url) >>> version = "1.1.0" >>> t = TBTC(version, w3, 'testnet', private_key)
-
Get lot sizes
>>> lot_sizes = t.get_available_lot_sizes()
-
Create a deposit contract
>>> logs = t.create_deposit(lot_sizes[0])
-
Get the bitcoin address for depositing BTC
>>> d = Deposit( ... t, ... logs[0]['args']['_depositContractAddress'], ... logs[0]['args']['_keepAddress'] ... ) >>> address = d.get_signer_public_key()
Example txn retrieved the address: tb1q38yzl97hg0vnn4wf7srguwjnmlgfa30uq3nrwt
- Clone & enter the repo.
git clone https://github.com/ankitchiplunkar/tbtc.py.git
- Install required libraries.
pip install -r requirements.txt
-
Run the tests locally
pytest -vv tests/