VISCHub / cryptux

Code examples for operating on Cryptocurrency accounts and wallets
4 stars 0 forks source link

Interface for Bitcoin #1

Open vietlq opened 6 years ago

vietlq commented 6 years ago

Clean APIs for consideration:

vietlq commented 6 years ago
Bitcoin
+ static fromWIF(wif_bytes) -> ECPair
+ static toWIF(ECPair) -> wif_bytes

ECPair
+ importWIF() -> boolean
+ exportWIF() -> wif_bytes
+ getAddr() -> addr_bytes
+ sendTx(add_bytes, amount) -> raw_tx_bytes
vietlq commented 6 years ago

Check out @staticmethod

https://realpython.com/blog/python/instance-class-and-static-methods-demystified/

https://julien.danjou.info/blog/2013/guide-python-static-class-abstract-methods

https://softwareengineering.stackexchange.com/questions/306092/what-are-class-methods-and-instance-methods-in-python

vietlq commented 6 years ago

Check out @property

https://www.blog.pythonlibrary.org/2014/01/20/python-201-properties/

class A:
    def __init__(self): pass
    @property
    def age(self): return 10