Code Monkey home page Code Monkey logo

tinycoinlib's Introduction

TinyCoinLib (pre-release, v0.0.1)

A minimalistic any coin (Bitcoin, Litecoin, Dogecoin..) RPC client and utilities for Python 3.

  • Tiny
  • Easy to review
  • Free and open source (GPLv3)
  • No external dependencies
  • No API breaking changes in horizon

It allows you to build Python programs that

Warning! TinyCoinLib comes without any warranty. Improper use or software bugs can lead to loss of coins. Run only on trusted platforms. Proceed at your own risk.

Warning! TinyCoinLib is in early development and not production ready yet. Its features remain mainly untested. This will change in future revisions.

Warning! Pre-release versions (v.0.0.Z) are completely untested. Functionality is likely broken.

💿 Installing

First, install TinyCoinLib form the Python Package Index

pip install tinycoinlib

Next, download the Core Wallet from a trusted source and verify its integrity (checksums and signature). Start the bundled coind program (bitcoind, litecoind, dogecoind, ...) and wait for the blockchain to synchronise.

Then you are ready to go.

📚 Examples

1) General RPC commands

from tinycoinlib.talk import TinyCoinTalk

talker = TinyCoinTalk('litecoin')
response = talker.call('getblockhash 69')

The constructor takes a URL as its first parameter. It points to the {}coind RPC server or is a special value listed in the PRESET_PORTS dictionary.

The call method takes in a command and returns the server's response.

2) Accept payments (receive coins)

from tinycoinlib.receive import TinyCoinReceive

receiver = TinyCoinReceive('127.0.0.1:18933')
trans_id = 'my-transaction-id'

paymend_address = receiver.get_payment_address(trans_id)
is_complete, amount = receiver.payment_completed(trans_id, 42)

The get_payment_address method adds (if not already existing) a receive address with the label my-transaction-id to the Core wallet. The payment_completed method checks if the payment has been completed (42 or more coins in the address).

3) Make payments (send coins)

from tinycoinlib.send import TinyCoinSend

sender = TinyCoinSend('dogecoin')

transaction_id = sender.send(1.38, 'DMrzmskQzXJ9pDHQBxBu5de36UaH5EYtDa')

TinyCoinSend has two more methods, get_balance and get_details for wallet balance and transaction details (confirmations, fee, ...) enquery, respectively.

Contributing

For bugs and ideas, please see our Issues. Further details are in CONTRIBUTING.md.

☕Supporting the project

Financial support is highly appreciated as it allows me (BigCoinBoy) to work on this project

  • Bitcoin: bc1qp4xyynjqzfffxjsq8xucd7jfjs58sm0reunm9d | URI | QR-code | History
  • Litecoin: ltc1quaqg6kfragqcfg3z4w2jlupsf4dcf4e59gujcg | URI | QR-code | History
  • Dogecoin: DMrzmskQzXJ9pDHQBxBu5de36UaH5EYtDa | URI | QR-code | History

Thank you to everyone who has donated!

tinycoinlib's People

Contributors

bigcoinboy avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.