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, pubkey_hex, chaincode_hex[, backup_pubkey_hex][, backup_chaincode_hex])
Create a new subaccount. Available only in full control mode.
Check usage on Github: JS Example
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 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])
Return 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])
Return 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_list_v2([page_id][, search_query][, sort_by][, date_range][, subaccount][, return_prev_data])
Return 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. Return 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)
Return the hex-encoded raw transaction data for a user transaction.

If the transaction does not exist or does not involve the user return an empty 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’).
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()
Return 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}, ...]}