Commit Graph

41 Commits

Author SHA1 Message Date
TomZ 617fc9afb6 Make API clearer: add UserTag1 - 3
Users are allowed to put (almost) anything in the header and we parrot
it back to them, this API makes it clearer which ones are available for
users.
2020-11-21 12:20:05 +01:00
Justaphf 18ca7abb7c Add scalenet 2020-10-02 18:43:52 -04:00
Justaphf 13286db582 Add testnet4 2020-10-02 18:43:52 -04:00
TomZ 0293890e80 Add optional async job to Hub API
The current design of the API is that all questions are answered in-
order. This implies that handling of one connection will also just use
one thread.

If we want to improve performance of things like "sendTransaction" we
want an async option, which runs the action and generates the answer
when its done in a separate thread (a new one for each async-request).

This breaks the in-order reply sequence for clients and as such it
requires them to set a new header-option to enable this.
2020-09-29 17:34:06 +02:00
TomZ b033cd8ac4 [API] Add outindex field to mempool address search
When you request matching transactions from the mempool for certain
addreses, the API now returns the matched output-index as a separate
tag, which makes it easier to, for instance, use the 'amount' field in
the reply.
2020-09-18 20:40:11 +02:00
TomZ fcc3b094ef [API] Improve featureset of MempoolSearch
The mempool search now shares its serialization code with the blockchain
transaction fetcher, allowing all the filtering and include flags to work
here too.
This also fixes several bugs and reverts the mempool API change.
Additionally I return the FirstSeenTime for each mempool entry.

There is a slight API breakage in the LiveTransactions service, which as
far as I know is still unused outside of Flowee.
These enum values changed:
Api::LiveTransactions::
  Transaction   20 =>  25
  UnspentState  23 => 26
  OutputScript  24 => 23

The reason for this change is to have the Blockchain namespace in
sync with the LiveTransactions namespace for similar features.
2020-09-14 15:27:15 +02:00
TomZ db9a80f8eb [API] Add support to query the mempool
This allows a search based on TxId or output-script-hash for
mempool transactions.
We include double spend proof info when available in the reply
2020-09-11 14:07:14 +02:00
TomZ c244c94634 Add new Indexer API message: 'version'.
This mirrors the one in the Hub in that it returns the version of the
Indexer running on the server.
2020-07-27 21:27:26 +02:00
TomZ 69a7db91ec Introduce TransactionMonitorService
This supplies a push notification on txid becoming known to the Hub.

Additionally this changes its close relative the AddressMonitorService
to use a different tag for the transaction data and the
double-spend-proof data so as to make it obvious which one is being
sent.
2020-05-19 20:57:51 +02:00
TomZ 82dfd082cd Initial support for a Transaction Monitor API 2020-05-19 08:29:31 +02:00
TomZ 7b1b742036 Remove workaround for old boost version
The API changes in boost between 1.66 and later was the need
for the boost_compat.h header file.
Its been a long time since Flowee started demanding 1.67 minimum
for boost, making this compat obsolete.
2020-03-29 12:55:12 +02:00
TomZ bf24ed042b Add support for legacy p2p network envelope in networkmanager 2020-03-29 12:55:12 +02:00
TomZ 11d16001c6 Indexer: add get for current sync-height 2020-01-20 12:17:55 +01:00
TomZ e7ad998d57 Add -fPIC to installed libs 2019-11-04 14:20:50 +01:00
TomZ c1c3d7bd25 Reviewed the API for BlockChain service more.
This finishes the refactor and review and making it much
more future proof by adding gaps in the numbers for extensibility.
2019-10-21 13:55:30 +02:00
TomZ 79e4974d19 Port API getblock::filter to use script-hash
The API call for GetBlock has a filter-on-address functionality which is
now ported to no longer use ripe160 addresses but instead uses output-
script hashes.
This avoids problems for transactions not using p2pkh and generally is a
cleaner solution.

This also adds a unit test to test this feature.
2019-10-20 22:12:09 +02:00
TomZ f1d0a68579 Port address monitor service to use address-hash
Remove addresses of type ripe160 to be used in the API of AddresMonitor
API service. Instead use a sha256 hash of the entire output script.

This is mostly internal changes not affecting the operations much.
2019-10-20 20:17:17 +02:00
TomZ 00814e24f9 API: Use hash of outscript instead of address
The usage of a ripe160 for bitcoin addresses in the API and in the
Indexer loses some info, specifically what kind of script it is.
Additionally not all types of scripts fit this mold. At best that means
its not future-proof.

This adds a method to the API in order to select from a Tx the hashed
outscript (thats singlehashed sha256) and refactor the address indexer
to use that instead of the ripe160 address.

The API enums broke a little, so I used the opportunity to break it a
lot and clean up the enums in order to make them more future-proof.
But, yeah, software from before this commit is protocol incompatible
with software after this commit.
2019-10-16 22:57:50 +02:00
TomZ 6cda85e79f Catch DSP exception and pass to interface 2019-09-02 23:54:43 +02:00
TomZ df7de2ecd2 Clean up the hairy ball of util.cpp
Move some globals and all stuff pulling in crypto to the
server/serverutil.cpp file

Remove dead code.

Move several items that were used in only one place to the respective
files using them.

Move the class WaitUntilFinishedHelper into its own file.

Made sure no header includes utils.h
remove a handfull of files including utils.h for nothing.
2019-08-24 22:25:09 +02:00
TomZ 0755acd1e6 [API] Add double-spend-proofs to addressMonitor
In the address monitor service this detects specifically if a double
spend detected by the Hub is applicable for our subscriber, and if it is
then a Message will be sent to the subscriber.

This introduces a new message type DoubleSpendFound
and changes the API for the TransactionFound message while dropping the
TransactionRejected message.
2019-07-24 18:41:16 +02:00
TomZ 1c27a291d0 Add a way for GetTransaction to only return certain outputs 2019-06-15 16:19:27 +02:00
TomZ 9e69a3fef9 Add new indexer; spentoutput
where the UTXO allows you to find an output based on txid+output, the
spentoutput DB turns that around and allows you to find an input that
spends a certain output.

This also fits perfectly find into the UTXO database class, so this
creates a new dir "spent" which is filled as expected.
2019-06-11 17:38:30 +02:00
TomZ 0a916c21e9 Add UTXO support to APIs
Generically this looks like this;

IsUnspent
[
  { "txid": "0x111111", "output": 1 },
  { "txid": "0x111111", "output": 11 }
]
IsUnspentReply
[
  { "blockHeight": 1111, "offsetInBlock": 1111, "unspent": true },
  { "unspent": false }
]

GetUnspentOutput
[
  { "txid": "0x111111", "output": 1 },
  { "txid": "0x111111", "output": 0 }
]
GetUnspentOutputReply
[
  { "blockHeight": 1111, "offsetInBlock": 1111, "unspent": true,
    "amount": 1111, "outputscript": "bytearray" },
  { "unspent": false }
]

note: txids are naturally always sha256s.
2019-06-10 21:02:15 +02:00
TomZ 99e7f8656c Make headers go to nice subdirs 2019-06-07 09:53:05 +02:00
TomZ a1dfd1cde9 Work on installable headers 2019-06-03 10:59:33 +02:00
TomZ db9eb1adfb Install some more files 2019-05-30 13:36:57 +02:00
TomZ 134f6952d0 Sync the new AddressMonitor service API with others
the OffsetInBlock token now has the same value as with other services.
2019-05-18 15:57:40 +02:00
TomZ 82a8e137bb API reviews
Rename 'RawTransaction' to 'LiveTransactions'
Review the AddressMonitorService.
Cleanup and remove some unused items (but keep binary compatible).
2019-05-06 20:13:10 +02:00
TomZ 78219d5bba Make the indexer-cli and indexer interact well
This adds lots of little things;
* Add GetTransaction API call
* I refactored the GetBlock API a little to reuse code.
* a new 'Version' API call for the hub
* API for the logging manager, so we can set a default
  setup with just C++-APIs
* various (usability) fixes in the FloweeServiceApplication
* Binding to localhost attempts to bind to both IPv4 and v6
* Print the actual transaction hex from indexer-cli (which really
  is just a testing app)
2019-04-10 20:52:04 +02:00
TomZ 890ebf2650 Remove obsolete method GetTransaction
It was a bad attempt of correctness and with Indexer it is ready to be
retired.

The RPC methods now just look in the mempool.
2019-04-10 16:16:05 +02:00
TomZ 20694d4f33 Make indexer be a server too 2019-04-09 19:34:55 +02:00
TomZ b8d329ef9f Further moves; NetworkEnums and netbase.{cpp|h}
NetworkEnums.h moves from utils to interfaces.
netbase moves from server to utils/
2019-03-29 21:39:08 +01:00
TomZ 5939de8ef0 Move API protocol definition to interfaces dir.
It makes no sense to include the API "library" just to use
the header file.
2019-03-29 21:07:28 +01:00
TomZ a45eaac865 Make validationinterface a bit more consistent
This also fixes some regressions in the zmq API
2019-03-10 14:02:27 +01:00
TomZ 5655a30558 whitespace 2018-11-14 22:59:28 +01:00
TomZ 68708e5dd3 Allow building when boost is not in /usr/include 2018-06-24 23:58:04 +02:00
TomZ 3cdc7acf17 Detect and notify listeners on douple spend 2018-03-25 18:38:51 +02:00
TomZ cc5d3bd5ce Make compile with boost 1.66 2018-02-18 01:04:41 +01:00
TomZ 260a393411 Cleanup interface, remove unused argument. 2018-02-17 14:45:09 +01:00
TomZ 33fe0fccb5 Cleanup ValidationInterface
Get rid of the weird boost signals setup
Move it to a new library 'interfaces' which is
for stuff that has no dependencies and can avoid
creating inter-library or cicular dependencies.
2018-02-16 12:37:13 +01:00