Turtlecoind API Reference¶
-
class
turtlecoin.
TurtleCoind
(host='127.0.0.1', port=11898)¶ Integrates with JSON-RPC interface of TurtleCoind.
-
get_block
(block_hash)¶ Returns information on a single block
Parameters: block_hash – Block hash of the block you wish to retrieve Returns: dict: { "block": { "alreadyGeneratedCoins": "1484230931125", "alreadyGeneratedTransactions": 974921, "baseReward": 2935998, "blockSize": 48846, "depth": 0, "difficulty": 358164537, "effectiveSizeMedian": 100000, "hash": "f11580d74134ac34673c74f8da458080aacbe1eccea05b197e9d10bde05139f5", "height": 501854, "major_version": 4, "minor_version": 0, "nonce": 214748383, "orphan_status": false, "penalty": 0, "prev_hash": "674046ea53a8673c630bd34655c4723199e69fdcfd518503f4c714e16a7121b5", "reward": 2936608, "sizeMedian": 231, "timestamp": 1527891820, "totalFeeAmount": 610, "transactions": [ { "amount_out": 2936608, "fee": 0, "hash": "61b29d7a3fe931928388f14cffb5e705a68db219e1df6b4e15aee39d1c2a16e8", "size": 266 }, ....., ....., ], "transactionsCumulativeSize": 48535 }, "status": "OK" }
-
get_block_count
()¶ Returns current chain height.
Returns: dict: { "jsonrpc":"2.0", "result":{ "count":560915, "status":"OK" } }
-
get_block_hash
(block_hash)¶ Returns block hash for a given height off by one
Parameters: height – 123456 Returns: dict:: result - {
- “jsonrpc”: “2.0”, “result”: “4bd7dd9649a006660e113efe49691e0739d9838d044774f18732111b145347c8”
}
-
get_block_header_by_hash
(hash)¶ Returns last block header by given hash.
Parameters: hash (str) – a valid block hash Returns: See getlastblockheader Return type: dict
-
get_block_header_by_height
(height)¶ Returns last block header by given hash.
Parameters: hash (int) – a valid block height Returns: See getlastblockheader Return type: dict
-
get_block_template
(reserve_size, wallet_address)¶ Returns blocktemplate with an empty “hole” for nonce.
Parameters: - reserve_size (int) – 123
- wallet_address (str) – a valid wallet address
Returns: the block template:
{ "blocktemplate_blob": "0300f29a5cddd1a88f9b95...", "difficulty": 273666101, "height": 286393, "reserved_offset": 412, "status": "OK" }
Return type: dict
-
get_blocks
(height)¶ Returns information on the last 30 blocks before height (inclusive)
Parameters: height – the height of the blockchain to start at Returns: dict: { "jsonrpc": "2.0", "result": { 'blocks':[ { "cumul_size": 22041, "difficulty": 285124963, "hash": "62f0058453292af5e1aa070f8526f7642ab6974c6af2c17088c21b31679c813d", "height": 500000, "timestamp": 1527834137, "tx_count": 4 }, ....., ....., ], "status": "OK" } }
-
get_currency_id
()¶ Returns unique currency identifier.
Returns: dict: {'currency_id_blob': '7fb97df81221dd1366051b2...'}
-
get_fee_info
()¶ Returns information on fee set by remote node
Returns: - dict::
- {
- ‘address’: ‘’, ‘amount’: 0, ‘status’: “Node’s fee address is not set”
}
-
get_height
()¶ Returns current chain height
Returns: dict: { 'height': 613945, 'network_height': 613945, 'status': 'OK' }
-
get_info
()¶ Returns information of network and connection
Returns: - dict::
- {
- ‘alt_blocks_count’: 7,
‘difficulty’: 162204943,
‘grey_peerlist_size’: 736,
‘hashrate’: 5406831,
‘height’: 613945,
‘incoming_connections_count’: 0,
‘last_known_block_index’: 613942,
‘major_version’: 4,
‘minor_version’: 0,
‘network_height’: 613945,
‘outgoing_connections_count’: 8,
‘start_time’: 1531374018,
‘status’: ‘OK’,
‘supported_height’: 620000,
‘synced’: True,
‘testnet’: False,
‘tx_count’: 719763,
‘tx_pool_size’: 0,
‘upgrade_heights’: [187000, 350000, 440000, 620000, …
], ‘version’: ‘0.6.4’, ‘white_peerlist_size’: 52
}
-
get_last_block_header
()¶ Returns last block header.
Returns: information about the last block header: { 'block_header': { 'depth': 0, 'difficulty': 226559499, 'hash': '34aa8777302f4856e360fef49a0a7b6c78cc8eff999c0c716bad234837917986', 'height': 286397, 'major_version': 3, 'minor_version': 0, 'nonce': 18205, 'orphan_status': False, 'prev_hash': '522f53dae525f0a66064377c41bc1f78c6eb4eea2b3e7630efccd395bb17f43f', 'reward': 2954906, 'timestamp': 1521732086 }, 'status': 'OK' }
Return type: dict
-
get_peers
()¶ Returns array of peers connected to the daemon
Returns: - dict::
- {
- ‘peers’: [
- 142.44.212.51:11897, 45.55.33.219:11897. …
], ‘status’: ‘OK
}
-
get_transaction
(transaction_hash)¶ Gets information on the single transaction
Parameters: transaction_hash – (str) The transaction hash Returns: dict: { "block": { "cumul_size": 22041, "difficulty": 103205633, "hash": "62f0058453292af5e1aa070f8526f7642ab6974c6af2c17088c21b31679c813d", "height": 500000, "timestamp": 1527834137, "tx_count": 4 }, "status": "OK", "tx": { "extra": "019e430ecdd501714900c71cb45fd49b4fa77ebd4a68d967cc2419ccd4e72378e3020800000000956710b6", "unlock_time": 500040, "version": 1, "vin": [ { "type": "ff", "value": { "height": 500000 } } ], "vout": [ { "amount": 80, "target": { "data": { "key": "5ce69a87940df7ae8443261ff610861d2e4207a7556ef1aa35878c0a5e7e382d" }, "type": "02" } }, ....., ....., ] }, "txDetails": { "amount_out": 2936280, "fee": 0, "hash": "702ad5bd04b9eff14b080d508f69a320da1909e989d6c163c18f80ae7a5ab832", "mixin": 0, "paymentId": "", "size": 266 } }
-
get_transaction_pool
()¶ Gets the list of transaction hashs in the mempool.
Returns: dict: { "jsonrpc": "2.0" "transactions": [ { "amount_out": 1660000, "fee": 0, "hash": "721ae50994d5446d5683ca79d6fa97dce321a39e88e1df70ae433dc67573841b", "size": 13046 }, ....., ....., ] }
-
get_transactions
()¶ Returns array of missed transactions
Returns: - dict::
- {
- ‘missed_tx’: [], ‘status’: ‘OK’, ‘txs_as_hex’: []
}
-
submit_block
(block_blob)¶ Submits a block
Parameters: block_blob (str) – a valid block blob … Returns: dict: { "jsonrpc": "2.0" "result": { "status": "OK" } }
-