Functions¶
In this section you can find non-calss related functions and their description.
Note
In the methods documentation 1bitcoinaddress, txhash and blockhash
are used instead of real addresses, transaction hashes and blocks hashes. If
you want to try the examples listed below, you have to use real values.
-
libchain.tobtc(_currency, _value)¶ When a currency symbol (USD, EUR, JPY, …) and a value are given, the amount is converted in bitcoin at the actual exchange rate
Examples:
>>>> libchain.tobtc('EUR', 100) 0.01783487
-
libchain.exchangerate()¶ Return a dictionary with the actual exchange rate of the most famous currencies
Examples:
>>>> libchain.exchangerate() {'USD': {'15m': 6508.15, 'last': 6508.15, 'buy': 6508.15, 'sell': 6508.15, 'symbol': '$'}, 'AUD': {'15m': 8740.46, 'last': 8740.46, 'buy': 8740.46, 'sell': 8740.46, 'symbol': '$'}, ...}
-
libchain.lasthash()¶ Return the hash of the last block added to the chain
Examples:
>>>> libchain.lasthash() blockhash
-
libchain.poolblocks(_pool_name)¶ When the name (case sensitive) of a mining pool is given, the latest blocks mined in that pool are returned as list
Examples:
>>>> libchain.poolblocks('AntPool') ['000000000000000000195caa1b5c7aa8bd94b0b8866e8fecf1d9ef61b1d5c97d', '00000000000000000034fce45130415766495ad4ee58daa8a1404d499b2c2203', '0000000000000000000616c5ae17d51c5d903c9b79c187c189849cd1b8bce161', ...]
-
libchain.dayblocks(_time)¶ When the time (in milliseconds) of a day is given, the blocks mined in that day are returned as list
Examples:
>>>> lc.dayblocks('1529176182') []
Note
I’m not sure this is working right now, need more investigation
-
libchain.unconfirmedtx()¶ Return a list of the latest unconfirmed transactions
Examples:
>>>> for tx in lc.unconfirmedtx(): ... print(tx) ... hash: 2c6c97f5ee17fefbb01e6140458c039808ad803f0dccb4b02090fc4302af12cc index: 354886645 senders: 1LQWp7eZRryr4DjsZHhGopV5aL1fSS94oX 7616394 13i994ZyvNqGEJxFoDcWbNjMqZjqoi2zFA 166133 recipients: 14rRznVHsaBYKed7iSBAP9vJRbu8YTaGhD 7714187 . . .