Skip to content
killerstorm edited this page Aug 6, 2015 · 4 revisions

Welcome to the cc-api-service wiki!

Transaction State Monitor API:

/api/tsm/newMonitoringGroup

returns groupId

/api/tsm/addTx

parameters: groupId, txid

Adds txid to the set of monitored transactions for the group.

/api/tsm/addAddress

parameters: groupId, address

Adds an address to a list of group's monitored addresses.

/api/tsm/getLog

parameters: groupId, 'fromPoint' (optional)

Returns transaction states updated since a certain point. If point is not provided, returns transaction states of all transactions in a group.

Output:

  {"lastPoint": 31337,
   "transactionStates": [
     {"txid": ...,
      "status": "block"/"mempool"/"invalid"/"conflict"/"mutated"/"missing",
      "block": {"height": 312333, "hash": "xxxx"} // present only for status:block
      "mutantTxId": "xxx" // present only for status:mutated
      "conflictTxId": "xxx" // present only for status:conflict
      "error": "xxx" //optional, might be present for status:invalid
      "warning": "xxx" //optional, might be present for status:mempool
       }]}

lastPoint should be stored and used in next call as a fromPoint parameter.

Statuses:

  • block: transaction is present in a block (confirmed), block hash and height is provided
  • mempool: transaction is present in mempool, is expected to be confirmed
  • invalid: transaction is not in a mempool and cannot enter mempool to the best of our knowledge. detailed error might be provided in error field.
  • conflict: mempool or blocks have another transaction which spends the same outputs
  • mutated: similar to conflict, with the difference that inputs/outputs of the conflicting transaction are the same (that is, it is the same transaction with a different signature)
  • missing: transaction is not present neither in mempool nor in blocks and we know nothing about it

Usage:

  1. Create a new monitoring group once per wallet or once per multi-wallet environment. Store groupId.
  2. Add addresses you want to monitor. Transactions affecting these addresses will be automatically added to the transaction set
  3. Add new transactions you create to make sure you get notifications when their state changes.
  4. use getLog to get transaction status updates (confirmations, reorganizations etc.) and new transactions. Pass fromPoint parameter to get only new log entries.

Clone this wiki locally