Commit graph

53 commits

Author SHA1 Message Date
Kristaps Kaupe
8798b8bc6e
Redirect back to / after /refreshorderbook and /rotateOb 2024-05-10 18:05:51 +03:00
Kristaps Kaupe
6e5cdc81ae
Refactor: move bitcoin unit conversion functions from ob-watcher to jmbitcoin 2024-02-28 13:33:04 +02:00
Kristaps Kaupe
3d568376a9
Remove unnecessary check for Python 3.7+ 2024-01-20 11:22:31 +02:00
roshii
4e5d894007 Remove imports from future and past 2023-08-07 07:58:28 +02:00
Carl Dong
11ddec7841 docs: Remove now-confusing mentions of virtualenv 2022-11-07 13:50:39 -05:00
Adam Gibson
501b5f0dac
Merge #1301: ob-watcher: tackle stale orders by first removing all of them
ace9996 ob-watcher: tackle stale orders by first removing all of them (Tim Akinbo)
2022-10-08 14:55:27 +01:00
theborakompanioni
2b277b0ff2
fix(ob-watcher): consistent orderbook.json response 2022-08-18 23:26:02 +02:00
Tim Akinbo
ace9996d8e ob-watcher: tackle stale orders by first removing all of them
when checking for timed-out counterparties (or refreshing the
orderbook), stale entries are preserved because those peers
disconnected prematurely. This fix prevents that issue by
first removing all entries before requesting for the orderbook.
2022-06-07 06:36:17 +00:00
Adam Gibson
044bef6fff
Change default fidelity bond exponent settings.
Closes #1247.
This consists of an inclusion of the bond value exponent into the config
that the user can alter, and a change of that from 2 to default 1.3.
Also updates the fidelity bond documentation to account for those
changes, including the units used in ob-watcher, but not the calculation
of fidelity bond attack resistance (which remains a TODO).
2022-05-03 17:24:00 +01:00
Adam Gibson
e915daef88
Passive mode for ob-watcher bots on onion-mc
Prior to this commit, running ob-watcher with
an onion-type message channel configured would result
in the bot attempting to connect to all the makers,
which is bad. This happened because the internal logic
of the onion message channel is that receivers of privmsgs
will be sent peer info from the directory, so that they can
immediately respond p2p if they succeed in outward connecting.
But for bots who do not intend to engage in a coinjoin interactive
protocol, like ob-watchers, this is absolutely not the desired outcome.
After this commit, a bot can specify mode "PASSIVE" in the call to
get_mchannels(), which results in the OnionMessageChannel object only
creating non-directory remote peer objects of type OnionPeerPassive,
instead of OnionPeer, which means they never try to connect to those
remote peers.
2022-04-06 09:52:49 +01:00
Adam Gibson
52eeeb09b9
Merge #1182: Only onion message channels
5cc1695 Disconnection logic fixes, add btcnet to handshake (Adam Gibson)
830ac22 Allow taker peers to not serve onions + bugfixes. (Adam Gibson)
fd550ee Onion-based message channels with directory nodes (Adam Gibson)
2022-04-05 17:32:14 +01:00
Kristaps Kaupe
4310af4f00
Merge JoinMarket-Org/joinmarket-clientserver#1061: Add support to build and autostart local Tor instance in jmvenv
5132342f57 update install.sh to build tor on macOS (jules23)
7a88781648 Add support to build and autostart local Tor instance in jmvenv (Kristaps Kaupe)

Pull request description:

  See https://github.com/JoinMarket-Org/joinmarket-clientserver/pull/1000#issuecomment-957379435 for context.

  This adds new option `--with-local-tor` to `install.sh` which builds Tor locally inside jmvenv. Then, when starting JM scripts that might need Tor connection, it is started automatically if nobody already listens on `127.0.0.1:9050`.

  If no problems are found with his approach in testing, we could switch to this as a default and remove all clearnet IRC configs from default config.

Top commit has no ACKs.

Tree-SHA512: caa7fcac88e57321f65a3f9fc09def94f9659855977026a19e1ac8f2f160a01237fe90220b986561bd622b05534f201ea5a29a9cdbc71013e40301992ed59e4d
2022-04-02 17:55:47 +03:00
Adam Gibson
830ac22934
Allow taker peers to not serve onions + bugfixes.
In the previous commit, all peers served an onion.

After this commit, taker client instances will automatically
send a config var to the jmdaemon backend that instructs
the OnionMessageChannel instance to not start an onion service,
and the handshake messages sent by these peers replace the
onion location with a placeholder string NOT-SERVING-ONION.
Directories and maker peers will not therefore to connect outbound
to them, but privmsging still happens p2p with connections from
takers to makers after the directory has communicated their
reachable .onion addresses.
This change reduces the configuration requirement for takers and
is better for their privacy and security (without sacrificing
the gain we get from having p2p connections).
The above comments re: takers also apply to ob-watcher bots.

This commit also fixes a large number of minor bugs and errors in
documentation, as well as many Python cleanups after review from
@PulpCattel. A few concrete items are:
It fixes the ob-watcher functionality to work with the new subclass
of MessageChannel (OnionMessageChannel).
It corrects the on_nick_leave trigger to make dynamic nick switching
between MessageChannels (as implemented in MessageChannelCollection)
work correctly.
It corrects the order of events in the add_peer workflow to ensure that
a handshake can always be sent so that the activation of the connection
always works.
It sets a default messaging config with onion, 2 active IRC servers and
one inactive IRC server. The onion config has 2 signet directory nodes,
so this will change to mainnet after the PR is merged to master.
2022-03-29 12:15:46 +01:00
Adam Gibson
fd550ee564
Onion-based message channels with directory nodes
Joinmarket bots run their own onion services allowing inbound connections.
Both takers and makers connect to other makers at the mentioned
onion services, over Tor.
Directory nodes run persistent onion services allowing peers to
find other (maker) peers to connect to, and also forwarding
messages where necessary.
This is implemented as an alternative to IRC, i.e. a new
implementation of the abstract class MessageChannel, in onionmc.py.

Note that using both this *and* IRC servers is supported; Joinmarket
supports multiple, redundant different communication methods,
simultaneously.

Messaging is done with a derived class of twisted's LineReceiver,
and there is an additional layer of syntax, similar to but not the
same as the IRC syntax for ensuring that messages are passed with
the same J5.. nick as is used on IRC. This allows us to keep the
message signing logic the same as before. As well as Joinmarket line
messages, we use additional control messages to communicate peer lists,
and to manage connections.
Peers which send messages not conforming to the syntax are dropped.
See https://github.com/JoinMarket-Org/JoinMarket-Docs/pull/12 for
documentation of the syntax.
Connections to directory nodes are robust as for IRC servers, in
that we use a ReconnectingClientFactory to keep trying to re-establish
broken connections with exponential backoff. Connections to maker
peers do not require this feature, as they will often disconnect
in normal operation.
Multiple directory nodes can and should be configured by bots.
2022-03-29 12:15:00 +01:00
Kristaps Kaupe
9594238886
Output script instead of address in /orderbook.json 2022-03-15 16:03:42 +02:00
Kristaps Kaupe
7a88781648
Add support to build and autostart local Tor instance in jmvenv 2022-03-03 14:01:07 +02:00
Adam Gibson
7eaf368dd7
Fix ob-watcher script after dust threshold change
Before this commit, the ob-watcher.py script errored
in trying to read offers because the variable
dust_threshold of the OrderbookWatch class was not
initialized; this was because this variable is now
set by the client in the AMP message JMInit; but
ob-watcher is a script that runs without any such
client. Since the script has access to the global
configuration from the jmclient package anyway, the
fix is just to add that into the ObBasic class
constructor.
2021-09-07 09:19:50 +01:00
Erik Arvstedt
80d0017357 Set library file as non-executable 2021-08-12 15:25:09 +02:00
chris-belcher
ce08a0cd85
Fix year 2038 problem in ob-watcher /fidelitybonds 2021-08-04 23:56:02 +01:00
chris-belcher
58d3e596c7
Fix Export Orders page on ob-watcher 2021-08-04 23:54:48 +01:00
openoms
f9ea973be9
fix overflow error on 32bit ARM
based on #857 as discussed in #953
2021-08-02 12:52:33 +01:00
chris-belcher
97b8b3b32a
Show fidelity bonds on orderbook watch html page
Add two new pages for the orderbook watch html server. One displays
each fidelity bond individually, the other shows calculations about
how expensive a successful sybil attack would be against the current
fidelity bonds in the orderbook.
2021-07-20 12:47:56 +01:00
chris-belcher
6b6fc4ae5d
Handle fidelity bonds in client-server protocol
Parse incoming and announce outgoing fidelity bond messages

Fidelity bond proof messages will be checked and added to the internal
database just like offers. Such messages are not announced in public
but only directly to takers who ask for them, this is because the
signature proofs must commmit to the maker's and taker's IRC nicknames
in order to avoid replay attacks.
2021-07-16 15:06:32 +01:00
undeath
ae5765701a
ob-watcher.py: gracefully exit on old python versions 2021-06-03 13:34:35 +02:00
undeath
fc74c94c35
add missing jquery lib to ob-watcher.py 2021-02-11 14:32:17 +01:00
undeath
5f8219617d
fix ob-watcher.py serving from relative location 2021-02-10 21:38:15 +01:00
undeath
ddcfd608e4
simplify ob-watcher.py static file serving code 2021-02-10 17:54:07 +01:00
3nprob
693609e095 Vendorize js and css dependencies 2021-02-10 22:59:35 +09:00
Erik Arvstedt
00be3a3748 ob-watcher: Use relative links
Using relative links instead of root-relative links allows hosting ob-watcher with an
arbitrary URL path prefix, like 'orderbook' (https://example.com/orderbook).
2021-01-01 14:27:45 +01:00
Kristaps Kaupe
6aa300ae8e
Fix relunit selector 2020-11-13 11:48:10 +02:00
Jules Comte
9e66bc54af Update ob-watcher 2020-11-07 22:23:16 -05:00
Jules Comte
ab87db2477 Create native segwit v0 order type
Note: The defaults for the fake offer and yg-privacyenhanced remain
on nested segwit
2020-11-06 18:34:27 -05:00
Kristaps Kaupe
1b6beda013
Remove /shutdown from ob-watcher
1) It is bad, people run public orderbooks;
2) It is broken anyway, both by throwing exception and then reconnecting
   to IRC servers instead of shutdown;
3) Same can be achieved locally by killing / restarting ob-watcher.py,
   if somebody wants such functionality from web interface, some access
   control needs to be introduced.
2020-10-28 00:41:50 +02:00
Kristaps Kaupe
942ea588bb
Fix relfee cjfee display issues caused by the use of float 2020-10-08 03:57:49 +03:00
Kristaps Kaupe
6d626614cb
Allow running ob-watcher without matplotlib installed 2020-09-09 20:22:10 +03:00
Kristaps Kaupe
ea855b302c
Correct import matplotlib exception handling
Error message about missing matplotlib is only correct in case of
exception during `import matplotlib`. If there is fatal exception
later, it is some other issue and it's better display it as is. On a
RaspiBolt for me `import matplotlib.pyplot as plt` causes
"ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory".
2020-08-05 21:08:54 +03:00
Adam Gibson
59747d857b
bugfix: ob-watcher base58 encoding 2020-07-25 13:03:41 +01:00
Kristaps Kaupe
6bd101ebb3
Remove link to old non segwit version and change new version link to use JoinMarket github organization 2020-05-20 23:24:59 +03:00
Kristaps Kaupe
e8ec595d31
Shebang and +x for ob-watcher.py 2020-05-20 20:31:38 +03:00
Kristaps Kaupe
80333b2872
Make ob-watcher independent of current working directory 2020-05-20 20:30:20 +03:00
Kristaps Kaupe
8997147848
Terminate ob-watcher immediately if HTTP server fails to start 2020-05-20 20:18:57 +03:00
James Hilliard
4bf1f50d4e Remove Python 2 compatibility imports and disable Python 2 installation in setuptools. 2020-01-19 11:31:57 -07:00
Kristaps Kaupe
0cdd5aca2e
Add missing space to "matplotlib not found" error message 2020-01-08 20:34:41 +02:00
Adam Gibson
cfa032d0c2
bugfix obwatcher options load 2020-01-08 12:44:18 +00:00
Adam Gibson
8c8e6e2fa8
Move all user data to home directory
To facilitate easier management by users and to
follow generally accepted standards, this PR moves
the following all to user home directory, subdir
.joinmarket :
joinmarket.cfg file
wallets/ directory
logs/ directory
cmtdata/ directory
commitmentlist file

User can override location with --datadir option.
An info message is added on startup showing location.
2020-01-06 13:49:47 +00:00
cindiv
52108b62d8 Update exit codes
Many exit codes were 0 (success) when they should have been 1
(general failure) or 2 (argument error). This corrects that.

Related: #409
2019-11-17 03:51:04 +00:00
James Hilliard
2db4e23603 Fix F632 use ==/!= to compare str, bytes, and int literals flake8 errors 2019-02-01 04:48:46 +08:00
AdamISZ
54618e61da
Remove btc.py
Previous to this commit, the jmbitcoin package was accessed via
a file in jmclient `btc.py` which was originally added as an
interface to allow the client to use a non-jmbitcoin package to
provide the implementation; while this idea is useful, the way
it was implemented was not, moreover it is not currently used
and contained duplicated code that was unmanaged. Also, the
original usage of this was only by the electrum plugin, which
has currently been abandoned. This simplifies the code and
avoids spurious error messages. Note that most of the changes
are a result of pulling the logging function directly from the
jmbase package instead of indirectly via this interface (which
was unnecessary and not connected with jmbitcoin).
2018-12-19 14:37:26 +01:00
James Hilliard
6dc3504f8a Convert jmclient to py3 style 2018-12-06 02:40:36 +08:00
James Hilliard
3537fb48fb Convert jmbitcoin to py3 style 2018-11-28 09:00:10 +08:00