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)
Edit already existing transaction’s memo.
Parameters:
  • txhash (string) – Transaction hash, hex-encoded.
  • memo (string) – New memo.
Returns:

success

Return type:

Boolean

com.greenaddress.txs.create_subaccount(pointer, name, user_public, user_chaincode[, backup_public][, backup_chaincode])
Create a new subaccount. Available only in full control mode.
Returns the receiving ID, also used for payment
Check usage on Github: JS Example
Parameters:
Returns:

Receiving ID

Return type:

String

com.greenaddress.txs.get_all_unspent_outputs([confs][, subaccount][, ga_asset_id])
Returns a list of all user’s unspent transaction hashes and output numbers.
Parameters:confs (number) – Minimum number of confirmations required (default=1)
com.greenaddress.txs.get_balance([subaccount][, confs][, asset])
Returns the sum of unspent outputs destined to user’s wallet.
Check usage on Github: JS Example
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])
Returns the sum of unspent outputs destined to given user’s address.
Parameters:
  • address (number) – base58 encoded address
  • confs (number) – number of required confirmations. NOTE: GreenAddress instant confirmed transactions will be considered to have this number of confirmations, no matter how large it is. For example, given confs=1000000, this call will return balance of user’s instant confirmation outputs.
com.greenaddress.txs.get_daily_balance_chart([subaccount])
com.greenaddress.txs.get_list(last_txhash, unclaimed)
com.greenaddress.txs.get_list_v2([page_id][, search_query][, sort_by][, date_range][, subaccount][, return_prev_data])
Returns a list of user’s transactions. Accept multiple parameters.
Check usage on Github: JS Example
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. Returns the payment request for the specified transaction.
Check usage on Github: JS Example
Please refer to:
Parameters:txhash (string) – Transaction hash.
com.greenaddress.txs.get_raw_output(txhash_hex)
Returns a list of all user’s confirmed unspent transaction hashes and output numbers.
com.greenaddress.txs.get_raw_unspent_output(txhash_hex[, ga_asset_id])
Returns a list of all user’s confirmed unspent transaction hashes and output numbers.
com.greenaddress.txs.get_redeem_message(type_, hash_or_pubkey)
Returns 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’).
Check usage on Github: JS Example
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.
Check usage on Github: JS Example
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.
Check usage on Github: JS Example
Returns:success
Return type:Boolean
com.greenaddress.txs.upcoming_nlocktime()
Returns upcoming nLocktime signed transactions. Available only in full control mode.
Check usage on Github: JS Example
Returns:{‘cur_block’: Int, ‘list’: [{‘nlocktime_at’: Int, ‘output_n’: Int, ‘txhash’: String}, ...]}