Giter Site home page Giter Site logo

tbtc.py's Introduction

tBTC.py

A python client to interact with the tbtc protocol.

tBTC Protocol version: 1.1.0

Setup:

  1. Create & activate virtulenv (python 3.6+)

  2. Install the library using pypi.

    pip install tbtc
    

Usage:

  1. 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)
    
  2. Get lot sizes

    >>> lot_sizes = t.get_available_lot_sizes()
    
  3. Create a deposit contract

    >>> logs = t.create_deposit(lot_sizes[0])
    

    Example txn created the deposit contract

  4. 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

Development:

  1. Clone & enter the repo. git clone https://github.com/ankitchiplunkar/tbtc.py.git
  2. Install required libraries. pip install -r requirements.txt

Testing:

  1. Run the tests locally

    pytest -vv tests/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.