Walletd API Reference

class turtlecoin.Walletd(password, host='127.0.0.1', port=8070)

Integrates with Walletd RPC interface.

Run Walletd like this:

$ walletd -w test.wallet -p mypw --local --rpc-password test
create_address(spend_secret_key='', spend_public_key='')

Create a new address

Parameters:
  • spend_secret_key (str) –
  • spend_public_key (str) –
Returns:

the hash of the new address

Return type:

str

create_integrated_address(address, payment_id)

Creates a unique 236 char long address which corresponds to given address and paymentID

Parameters:
  • address (str) – valid TRTL address
  • payment_id (str) – valid payment id
Returns:

integrated address

Return type:

str

delete_address(address)

Delete address from wallet

Parameters:address (str) – the address to delete
Returns:True if successful
Return type:bool
delete_delayed_transaction(transaction_hash)

Delete a delayed transaction

Example

>>> wallet.delete_delayed_transaction('8dea3....')
estimate_fusion(threshold, addresses=[])

Counts the number of unspent outputs of the specified addresses and returns how many of those outputs can be optimized.

feeinfo()

Gets the fee address and amount (if any) from the node that the turtle-service instance is currently connected to. This fee will be automatically sent to the address on every sendTransaction() and sendDelayedTransaction() request. Note that it does not apply to sendFusionTransaction().

Returns:address int: amount
Return type:str
get_balance(address='')

Returns the balance of an address

Note

Amount needs to be divided by 100 to get decimal places. If balance returned is 1000 it means 10.00 TRTL

Parameters:address (str) – (optional) The address for which to return the balance. Must exist in this wallet.
Returns:available balance (int) and locked amount (int):
{
    'availableBalance': 1000,
    'lockedAmount': 0
}
Return type:dict
get_delayed_transaction_hashes()

Returns a list of delayed transaction hashes

get_mnemonic_seed(address)

Returns the mnemonic seed for the given address

Parameters:address (str) – Valid and existing in this container address
Returns:mnemonic seed
Return type:str
get_spend_keys(address)

Returns spend keys

Parameters:address (str) – Valid and existing in this container address
Returns:A dictionary with the secret and public spend keys:
{
    'spendPublicKey': '3550a41b004520030941183b7f3e5ec075042cdde492044ea5064e4a1d99a3ba',
    'spendSecretKey': 'f66997b99f9a8444417f09b4bca710e7afe9285d581a5aa641cd4ac0b29f5d00'
}
Return type:dict
get_transaction(transaction_hash)

Returns information about a particular transaction

Parameters:transaction_hash (str) – Hash of the requested transaction
Returns:information about the transaction:
{'amount': -110,
 'blockIndex': 274123,
 'extra': '013ffd7e8481121a427a01e034cc9f4604d7b474412186ddd9fc56361dc0eafb72',
 'fee': 10,
 'isBase': False,
 'paymentId': '',
 'state': 0,
 'timestamp': 1521641265,
 'transactionHash': 'dc1221181e5745b9016fed2970bf002d14fe2ad8c90d7a55456d0eb459c7c2b8',
 'transfers': [{'address': 'TRTLuxBjcKs5Ubbopcwc9N6yV62781VdDCS4ZVFupFdWBm3UZrAabVFKwc6yLWQVV3agCBxYzGQhGJsHZokixfufgxZ7EK3d33A',
                'amount': 100,
                'type': 0},
               {'address': 'TRTLuxqgEUr24bw6dWKEJnNHRWk8SfbpgfERJUX43Dys5xACTU22zTZBR32BFi8TavSNei6cU9ym6DPECaTrqQaaaFRgF3xKE73',
                'amount': 790,
                'type': 2},
               {'address': 'TRTLuxqgEUr01cw61WKfJnNHRWk7SgbpgfERJUX4WDys5xACTU123TZBR32BFi8TavSNei6cU9ym6DPECaTrqQaaaFRgF3xKE73',
                'amount': -900,
                'type': 0}],
 'unlockTime': 0}
Return type:dict
get_unconfirmed_transaction_hashes(addresses=[])

Returns the current unconfirmed transaction pool for addresses

Parameters:addresses (list) – (optional) List of addresses. If not set, all addresses of this wallet will be used.
Returns:Hashes of unconfirmed transactions
Return type:list
get_view_key()

Returns the view key

Returns:Private view key
Return type:str
reset(view_secret_key)

Re-syncs the wallet

Note

If the view_secret_key parameter is not specified, the reset() method resets the wallet and re-syncs it. If the view_secret_key argument is specified, reset() method substitutes the existing wallet with a new one with a specified view_secret_key and creates an address for it.

save()

Save the wallet

send_delayed_transaction(transaction_hash)

Send a delayed transaction

Example:

>>> wallet.send_delayed_transaction('8dea3...')
Raises:
  • ValueError – { ‘code’: -32000, ‘data’: {‘application_code’: 15}, ‘message’: ‘Transaction transfer impossible’
  • }
send_fusion_transaction(threshold, anonymity, addresses, destination_address)

Send a fusion transaction, by taking funds from selected addresses and transferring them to the destination address.

Returns:hash of the sent transaction
Return type:str
send_transaction(transfers, anonymity=3, fee=10, addresses='', change_address='', extra='', payment_id='', unlock_time=0)

Send a transaction to one or multiple addresses.

Note

The amount/fee need to be multiplied by 100 to get TRTL amount.

If you want to transfer 10 TRTL with a fee of 0.1 TRLT you should set transfer amount to 1000 and fee to 10

Params:
anonymity: mixin amount transfers: address where to send the funds to. (address, amount) fee: transaction fee (default 100 (0.1 TRTL)) source_addresses: addresses from which to take the funds from. change_address: address where to send the change to. extra (bytes): extra data to include payment_id: can be given to receiver to identify transaction unlock_time (int)

Example:

>>> wallet.send_transaction(
    anonymity=3,
    transfers=[
        {'address': 'TRTL...',
         'amount': 500}],
    fee=10
)
{'transactionHash': '1b87a........'}