65 Commits

Author SHA1 Message Date
John Galt ae5fc27e4f Improve AddressMonitorService
This is a combination of 5 commits.

Improve AddressMonitorService
Changed double spend notifications to new format & include cashtoken data
Updated AddressMonitorService response for txs found in the mempool.
Removed duplicate BitcoinScriptHashed tags
AddressMonitorService update
2025-02-12 16:01:19 +01:00
tomFlowee e4735ebd54 Post commit review of Johns CashToken stuff
This makes minor renames and cleanups.
We merge the 5 different cashtoken booleans into one, making
usage and server-code simpler.
And probably in real use not actually causing bigger messages.
2025-02-12 15:35:41 +01:00
tomFlowee a009b92c59 Revert half of Johns patch to split two features
This splits off the AddressMonitor parts from the previous commit
so we can review that separately.
2025-02-12 15:35:41 +01:00
John Galt 9942126040 Various changes made to the Flowee API to understand CashTokens and imrpove the AddressMonitorService 2025-02-12 15:35:41 +01:00
tomFlowee a674a3fb7c Change returning of 'target' to be a bytearray.
This affects both the BlockChain/GetBlockHeaderReply and the
BlockChain/GetBlockVerboseReply calls.
The field with id 75 was confusingly called 'bits', but this is really
the blocktarget from the blockheaders. We renamed this.

This field is a int-encoded-floating point value and as such it makes no
sense to send it as a simple int. It is now a byte-array.
Notice that the documentation always listed it as a byte-array so we
actually fixed the implementation to follow the spec.
2024-09-16 23:18:34 +02:00
tomFlowee 4fe9d69e7b Use more specific define-guards 2024-01-24 21:03:58 +01:00
tomFlowee 6002803fa4 Add more bannable messages.
Alert:
This has been sunset so long ago, no complient BCH client will (/can) use it.

Protoconf:
This looks like its a BSV message.
2023-02-25 19:38:06 +01:00
tomFlowee 18fed67872 Use known not-bch p2p messages to disconnect
When we receive a known message (currently just avahello) we now
intantly ban and disconnect the peer, no need to
test compliance when they openly greet us saying they are not following
the same chain.
2023-02-25 12:02:19 +01:00
tomFlowee 1ab4d88993 Split version.h
Version.h held mostly stuff for protocol.h, which is a hub-specific file.
The only thing that we actually use is the PROTOCOL_VERSION in our code
and as such that one moved to the interfaces dir.
2022-07-06 22:50:53 +02:00
tomFlowee 6ff0e7c0de [Refactor] FastBlock -> Block 2021-11-02 10:18:24 +01:00
tomFlowee 4689cc6a92 [Refactor] CBlock -> MutableBlock 2021-11-02 09:36:09 +01:00
tomFlowee ae78dd0bb8 Update email address 2021-06-20 22:44:44 +02:00
tomFlowee 9cd25d4fbf Be consistent 2021-03-25 18:49:00 +01:00
tomFlowee 3e9fe7aa3c Add to the Flowee API: Mining::SubmitBlock
This adds a new API endpoint that allows submitting of a new block to be
validated and possibly appended to the tip of the chain.
2021-03-24 21:00:25 +01:00
tomFlowee ce8ecd965e Add api doc. 2021-03-24 21:00:25 +01:00
tomFlowee c1cdbba72b Add new feature, search a block with script-type
This new flag to the getBlock API call allows us to select
a transaction based on the usage of a certain script opcode.
This uses the new metadata index.
2021-03-24 19:08:25 +01:00
tomFlowee 9025a2e2ea Add DoubleSpendService to listen to all double spend notifications 2021-03-16 19:53:14 +01:00
tomFlowee bd5baa7133 Add ability to retrieve fees for a transaction.
This adds an option to the GetTransaction Flowee API to return the fees
for a whole transaction.
Support for this is added in the Blockchain (searcher) and the
RestService components.

Notice that no fees will be returned if the BlockMetaData was not
created properly.
2021-03-12 09:06:06 +01:00
tomFlowee b697a17168 Add 'validationOnly' option to API 2021-03-04 15:48:56 +01:00
tomFlowee b83fd08789 Add chainReorged msg to BlockNotificationService
When blocks are reverted clients likely want to know. This gives them
the information the moment it becomes clear.
2021-02-19 13:43:56 +01:00
tomFlowee 29082a1066 Follow coding guide; lowercase method names 2021-02-19 13:43:56 +01:00
tomFlowee 44e8717d1e Send a MEMPOOL message on SPV/merkleblock sync. 2021-02-04 17:39:44 +01:00
tomFlowee 449dc47871 Move CReserveScript to the only user: the wallet
This does remove the feature that mining can use the internal wallet as
a source of coinbase addresses, but since Flowee doesn't actually ship a
wallet, that was just not a good reason to keep an unused class in the
libs.
2021-01-20 22:43:37 +01:00
Justaphf 517db921f9 Add getmempoolinfo RPC wrapper to API 2020-12-24 09:57:30 -05:00
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