txs module

The Transactions module is designed with all the functions needed to query incoming and outgoing transactions on the GreenAddress service, and more.

Here you can manage your subaccounts, get your balance or a list of previously authorized transactions. A server assisted BIP70 implementation is available.

You may also be interested in time locked transactions (nLockTime), the safety feature which makes GreenAddress users able to retrieve their funds independently of the service.

nLocktime is described in the Bitcoin protocol specifications as a parameter that can be attached to a transaction, that mandates a minimal time, that before this time, the transaction cannot be accepted into a block.

On GreenAddress your funds are always redeemable with an nLocktime transaction and the garecovery tool.

com.greenaddress.txs

com.greenaddress.txs.change_memo(txhash, memo[, memo_type])
Set or edit a transactions associated memo.
If the transaction already has a payment request memo, the call will fail.
Parameters:
  • txhash (string) – Transaction hash, hex-encoded.
  • memo (string) – Memo to associate with the transaction.
  • memo_type (string) – Either “user” for a user entered memo or “payreq” to add a BIP 70 payment request memo (which cannot be updated once set).
Returns:

success

Return type:

Boolean

com.greenaddress.txs.create_subaccount(pointer, name, pubkey_hex, chaincode_hex[, backup_pubkey_hex][, backup_chaincode_hex])
Create a new subaccount. Available only in full control mode.
Parameters:
  • pointer (number) – Subaccount pointer.
  • name (string) – Subaccount name.
  • pubkey_hex (String) – Subaccount BIP32 public key in compressed sec format, hex-encoded
  • chaincode_hex (String) – Master BIP32 chaincode, hex-encoded
  • backup_pubkey_hex (String) – Users backup public key in compressed sec format, hex-encoded
  • backup_chaincode_hex (String) – Users backup chaincode, hex-encoded
Returns:

The GreenAddress receiving ID

Return type:

String

com.greenaddress.txs.get_all_unspent_outputs([confs][, subaccount][, ga_asset_id])
Return a list of information on all UTXO’s in a given subaccount.
Parameters:
  • confs (number) – Minimum number of confirmations required (default=1)
  • subaccount (number) – The subaccount to get UTXO’s for (default=0)
Returns:

{‘block_height’: Number, ‘txhash’: String, ‘pt_idx’: Number, ‘subaccount’: Number, ‘pointer’: Number, ‘script_type’: Number, ‘subtype’: Number, ‘value’: Number}

com.greenaddress.txs.get_balance([subaccount][, confs][, asset])
Return the sum of unspent outputs destined to user’s wallet.
Parameters:
  • subaccount (number) – Subaccount pointer (int) or ‘all’ (str). Default is ‘all’.
  • conf (number) – number of required confirmations. NOTE: GreenAddress instant confirmed transactions not handled by this call. See get_balance_by_addr for instant confirmations support.
Returns:

{‘fiat_value’: String, ‘fiat_exchange’: String”, ‘fiat_currency’: String, ‘satoshi’: String}

com.greenaddress.txs.get_balance_by_addr(address[, confs])
Deprecated, this call will be removed in the near future.
com.greenaddress.txs.get_list_v2([page_id][, search_query][, sort_by][, date_range][, subaccount][, return_prev_data])
Return a list of user’s transactions. Accept multiple parameters.
Parameters:
  • page_id (number) – Returns the selected page from a paginated feed. Interval is 30 transactions per page. Page number must be smaller than 30.
  • search_query (string) – Generic search term. Queries the linked third party account names, memos and vouchers.
  • sort_by (string) – Sorts transactions by timestamp or value. Accepted ‘ts’, ‘value’. Descending if param starts with ‘-‘, else ascending (i.e.: ‘-value’)
  • date_range (list) – Returns transactions in range. i.e.: [‘2014-01-01T00:00:00.000’, ‘2014-06-31T23:59:59.999’].
  • subaccount (number) – Returns transactions belong to the specified subaccount, param is int account identifier. Also accepts string the ‘all’. If not specified returns Main account transactions.
Returns:

{‘fiat_currency’: String, ‘cur_block’: Number, ‘fiat_value’: Number, ‘list’: [...], ‘unclaimed’: {...}}

com.greenaddress.txs.get_payment_request(txhash)
BIP70 payment protocol. Return the payment request for the specified transaction.
Please refer to:
Parameters:txhash (string) – Transaction hash.
com.greenaddress.txs.get_raw_output(txhash_hex)
Return the hex-encoded raw transaction data for a user transaction.
If the transaction does not exist or does not involve the user, an
empty string is returned.

Returns:The hex-encoded transaction or an empty string.
Return type:String
com.greenaddress.txs.get_raw_unspent_output(txhash_hex[, ga_asset_id])
Return the hex-encoded raw transaction data for an unspent output.

If the transaction is not unspent or does not exist return an empty string.
com.greenaddress.txs.get_redeem_message(type_, hash_or_pubkey)
Return a voucher’s message. No authentication is needed against this public API.
An anonymous user can request the message attached to his voucher providing the voucher pubkey received (‘pubkey’).
Redeem is also available with the hash of the bip38 encrypted private key (‘hash’).
Parameters:
  • type (string) – ‘pubkey’ or ‘hash’.
  • hash_or_pubkey (string) – BIP38 hash or public key.
Returns:

message

Return type:

String

com.greenaddress.txs.rename_subaccount(pointer, name)
Rename already existing subaccount. Doesn’t accept duplicates.
Parameters:
  • pointer (number) – Subaccount pointer.
  • name (string) – Subaccount name.
Returns:

success

Return type:

Boolean

com.greenaddress.txs.send_nlocktime()
Request an email with the user’s nLockTime transactions.
Available only in full control mode.
Returns:success
Return type:Boolean
com.greenaddress.txs.upcoming_nlocktime()
Return upcoming nLocktime signed transactions. Available only in full control mode.
Returns:{‘cur_block’: Int, ‘list’: [{‘nlocktime_at’: Int, ‘output_n’: Int, ‘txhash’: String, ‘locktype’: Int}, ...]}