Commit graph

13558 commits

Author SHA1 Message Date
Sean Darcy
866691d9d8 Batching of service node rewards
This updates the coinbase transactions to reward service nodes
periodically rather than every block. If you recieve a service node
reward this reward will be delayed x blocks, if you receive another
reward to the same wallet before those blocks have been completed it
will be added to your total and all will be paid out after those x
blocks has passed.

For example if our batching interval is 2 blocks:

Block 1 - Address A receives reward of 10 oxen - added to batch
Block 2 - Address A receives reward of 10 oxen - added to batch
Block 3 - Address A is paid out 20 oxen.

Batching accumulates a small reward for all nodes every block

The batching of service node rewards allows us to drip feed rewards
to service nodes. Rather than accruing each service node 16.5 oxen every
time they are pulse block leader we now reward every node the 16.5 /
num_service_nodes every block and pay each wallet the full amount that
has been accrued after a period of time (Likely 3.5 days).

To spread each payment evenly we now pay the rewards based on the
address of the recipient. This modulus of their address determines which
block the address should be paid and by setting the interval to our
service_node_batching interval we can guarantee they will be paid out
regularly and evenly distribute the payments for all wallets over this
2022-04-29 09:51:14 +10:00
Jason Rhinelander
0d266a4e18
Merge pull request #1529 from oxen-io/readme-gutt-2022-04-14
remove old info from readme
2022-04-21 19:58:04 -03:00
Jason Rhinelander
81a1c1e50e
Merge pull request #1535 from jagerman/prepare-reg-dust
Fix prepare_registration dust
2022-04-21 19:57:20 -03:00
Jason Rhinelander
311587adf1
Merge pull request #1537 from jagerman/stake-info
Include SN status info info list_current_stakes()
2022-04-21 19:56:59 -03:00
Jason Rhinelander
d9f19ca463
Include SN status info info list_current_stakes()
Adds unlock height, funded, and decommissioned info to returned stake
info.
2022-04-21 18:27:45 -03:00
Jason Rhinelander
711c7462c3
Fix prepare_registration dust
We could get a rounding error in the contributor spots that would make
the registration fail when passed to oxend.  This fixes it by restoring
the missing logic that was accidentally dropped in the
prepare_registration refactor.
2022-04-19 22:48:16 -03:00
Jason Rhinelander
a91c491111
Merge pull request #1531 from jagerman/aux-pubkey-checks
Add ed25519_pubkey field to SS & lokinet pings
2022-04-18 21:18:01 -03:00
Jason Rhinelander
0fdaeff95d
Merge pull request #1532 from jagerman/checkpoint-vote-delay
Delay checkpoints by a block
2022-04-18 21:17:46 -03:00
Jason Rhinelander
9a6c4a93a0
Merge pull request #1530 from jagerman/prepare-reg-disp-fix
Prepare registration fixes and improvements
2022-04-18 21:17:07 -03:00
Jason Rhinelander
98de2910ec
Merge pull request #1533 from jagerman/w2api-is-stake
Add is-stake to wallet api
2022-04-18 19:06:45 -03:00
Jason Rhinelander
882ba4820a
Fix StakeUnlockResult non-virtual destructor
We destruct a subclass via base class instance pointer, which requires a
base class virtual destructor.
2022-04-18 15:06:38 -03:00
Jason Rhinelander
a73002747a
Add is-stake to wallet api
Mobile wallet needs this to determine when a transaction is a stake
rather than a transfer, otherwise it shows all stakes as outgoing
transfers of 0.
2022-04-18 11:18:12 -03:00
Jason Rhinelander
f46884c5f1
Delay checkpoints by a block
Testnet has shown that it is virtually impossible to route around a
checkpoint for a block that had to be rendered unacceptable because it
accepts the future checkpoint which then prevents an alternate block
from being generated at all.

This mitigates it in two ways:

- Don't accept new checkpoint votes before we receive the block
- Delay checkpoint voting & vote distribution by one block (e.g. nodes
  will vote on block 12345 only once 12346 is received).

The first allows a manual pop_blocks to remove checkpoints that won't
get re-added (e.g. if the checkpointed block has become unacceptable, as
occurs sometimes in testnet/devnet, but could theoretically occur on
mainnet if we have to do a block reversal).

The second minimizes the number of rejected votes that will occur since
nodes will almost always have the block now when the checkpoint arrives.
2022-04-17 12:59:36 -03:00
Jason Rhinelander
50a41e63de
Add ed25519_pubkey field to SS & lokinet pings
Allows lokinet & storage server to feed the ed25519 key back to oxend so
that oxend makes sure everyone is on the same key.
2022-04-17 11:16:45 -03:00
Jason Rhinelander
d51c4466cf
Overhaul prepare_registration page
Reorders the way questions are asked to flow better.  Previously the way
questions was asked was sort of awkward.

The old order, for instance staking a partially open node:

- entire stake?
- fee?
- reserve more?
- how many more?
- operator address?
- operator stake size?
- contributor address?
- how much for contributor?
- more contributors, if any
- not filled okay?
- confirm everything?

where there are related values (e.g. operator addr & stake) intermingled
with around other things (e.g. fee & number of contributors).

With this commit the order is rewritten to:

- operator address?
- entire stake?
- operator stake size?
- fee?
- reserve more?
- how many more?
- contributor 1 addr
- contributor 1 amnt
- more contributors, if any
- not filled okay?
- confirm everything?

Additional changes:
- substantially DRY out the code.  There was a huge amount of repeated
  code in this section.

- highlight OXEN amounts in cyan.

- I rewrote much of the language to make it clearer and more grammatical

- reformatted the summary table to look a bit better

- the fee in the final summary is highlighted yellow.

- if there are multiple open spots this is now more clearly indicated in
  the output and the final summary screen.

Example:

```
$ oxend prepare_registration
2022-04-15 20:11:29.211	I Oxen 'Audacious Aurochs' (v9.2.0-0b38bd982-dev)
Current staking requirement: 15000 OXEN
Enter the OXEN address of the Service Node operator (C/Cancel):
LDoptfyQB3YHbS9cnt2wHdTTj2wtZGPuM48evCFwZpomVajQw4eJ6mDCpXeUNTxsqbTiYytnqEDQNin3XGwp3nReMooMaWG

Will the operator contribute the entire stake? (Y/Yes/N/No/B/Back/C/Cancel): n

The operator contribution must be between 3750 OXEN and 15000 OXEN to meet the staking requirements.

How much OXEN does the operator want to stake? (B/Back/C/Cancel): 5555

Enter operator fee as a percentage of earned rewards [0-100]% (B/Back/C/Cancel):  4.567

Do you want to reserve stakes for specific contributors? (Y/Yes/N/No/B/Back/C/Cancel): y

Number of additional contributors [1-3] (B/Back/C/Cancel): 2

Enter the OXEN address of contributor 1 (B/Back/C/Cancel):
L6JasonXTGW6juHrJgsXTxXH1Jh9u94H8NQ9m4rMwz5a9SZGr2e1cXw9MqnVH6Qx5bTgL5wf7qfvHeNPdwyC63AzMixU5ad

The next contribution must be between 3148.333333333 OXEN and 9445 OXEN to meet the staking requirements.

How much OXEN does contributor 1 want to stake? (B/Back/C/Cancel): 5555

Enter the OXEN address of contributor 2 (B/Back/C/Cancel):
L7jC35E9MnQZu2dS1n8wCqbvVBFpGHJt7iNHgAuEy5is57dzX2uQZDASv4KvwzruxXARxa4omafN6i19QBY7KAcSH1Xz7ZL

The next contribution must be between 1945 OXEN and 3890 OXEN to meet the staking requirements.

How much OXEN does contributor 2 want to stake? (B/Back/C/Cancel): 3000

Total reserved contributions: 14110 OXEN

The total reserved amount (14110 OXEN) is less than the required full stake (15000 OXEN).
The remaining stake (890 OXEN) will be open to contribution from 1 public contributor.
The Service Node will not activate until the full contribution has been filled.

Is this acceptable? (Y/Yes/N/No/B/Back/C/Cancel): y

Registration Summary:

Operator fee (as % of Service Node rewards): 4.567%

 Contributor       Address          Contribution  Contr. %
_____________   _____________  _________________  ________

   Operator     LDoptfyQB..WG     5555.000000000    37.03%
Contributor 1   L6JasonXT..ad     5555.000000000    37.03%
Contributor 2   L7jC35E9M..ZL     3000.000000000    20.00%
    (open)          (any)          890.000000000     5.93%

Is the staking information above correct? (Y/Yes/N/No/B/Back/C/Cancel):
```

For a open node with 3 open spots the summary table looks like this:

```
 Contributor       Address          Contribution  Contr. %
_____________   _____________  _________________  ________

   Operator     L6JasonXT..ad     6789.000000000    45.26%
    (open)          (any)       >=2737.000000000  >=18.25%
    (open)          (any)
    (open)          (any)
```
2022-04-15 17:54:04 -03:00
Jason Rhinelander
44da471153
Remove unused decimal point arg; add format_money()
- The decimal point argument isn't used anywhere.

- change `get_unit()` to return `OXEN` instead of `oxen`

- Add a "strip_zeros" option to print_money that lets you remove
  trailing insignificant 0's from the returned amount.

- Add format_money that does print_money (with 0s stripped by default) +
  get_unit().  E.g. it returns `"45.67 OXEN"`.
2022-04-15 17:54:03 -03:00
Jason Rhinelander
63ede5ec4d
Make cryptonote::parse_amount return an optional
Replace a gross non-const uint64_t& argument + bool return with an
std::optional<uint64_t> return value.
2022-04-15 17:54:03 -03:00
Jason Rhinelander
d5551009f9
Fix cursor line overwriting in prepare_registration
When I issue a `prepare_registration` command the cursor gets positioned
at the beginning of the line instead of the end of the line, so typing
things in results in overwriting the text that I was asked.

E.g.:

```
Current staking requirement: 15000.000000000 oxen
yill the operator contribute the entire stake? (Y/Yes/N/No/C/Cancel):
`-- the y I typed replaced the "W"
```
or:
```
Enter the oxen address for the solo staker (B/Back/C/Cancel):
```
and because the cursor is positioned at the beginning, my address
overwrites the prompt as I type/paste it:
```
L6JasonXTGoxen address for the solo staker (B/Back/C/Cancel):
```

This is caused because we were suspending the readline buffer *after*
printing things out, and something (perhaps local config, or perhaps an
update to libreadline) repositions to cursor at column 0.

This commit suspends the readline handler *before* we print the message,
which makes it sane again:
```
Enter the oxen address for the solo staker (B/Back/C/Cancel): L6JasonXTG
```
2022-04-15 17:54:03 -03:00
Jason Rhinelander
ef51e5dd63
Merge pull request #1527 from jagerman/dep-updates
Dependency updates & OpenSSL/unbound removal
2022-04-15 17:53:40 -03:00
Jason Rhinelander
0638aea2fb
Fix apple static libs check 2022-04-15 14:32:06 -03:00
Jason Rhinelander
1cf48a28c3
Silence false maybe-unused warning
This variable does always get set via the lvalue parameter in the call
below, but it's far enough away that gcc isn't sure of it.
2022-04-15 13:51:58 -03:00
Jason Rhinelander
5e578069d6
Remove redundant size checks
These were needed with oxenmq::is_hex a long time ago, but have been
redundant for quite a while.
2022-04-15 13:51:58 -03:00
Jason Rhinelander
4fa12395ef
More epee purging
Remove misc_language.h: Half of it is unused, half of it is crap doesn't
need to be used, and the two useful things (median calculator and a
scope exit caller) were poorly written.

Rewrote median from scratch and moved it out of epee.

Simplified the scope exit handler and moved it to its own small header
in epee.
2022-04-15 13:51:57 -03:00
Jason Rhinelander
bf5162efdb
Remove now-unused ascii output magic 2022-04-15 13:51:57 -03:00
Jason Rhinelander
b0cc711606
Replace stale seed node with new ones 2022-04-15 13:51:57 -03:00
Jason Rhinelander
5e95cef882
Remove openssl, unbound, expat, OpenAlias
openssl is a miserable dependency to fight with, especially for
iOS/Android, and we use it for very little:

- it gets (mis)used to write base64 data to a file in wallet2 for things
  like multisig data.  However this mode is *not* enabled by default,
  basically completely unknown, completely unused, only exists in the
  cli wallet, and is just dumb.  (Honestly the justification given in
  the PR is that "Windows users might want it", presupposing that there
  exists Windows users who are capable of generating a multisig wallet
  in a CLI-only application and yet are incapable of dealing with binary
  files).

- it's a dependency of unbound (in order to do dnssec, I believe).
  Unbound itself is fairly useless for Oxen, so I've removed it too:
    - it does OpenAlias lookups, which are a Monero thing that has never
      been used outside Monero, doesn't work reliably (because it fails
      if the result isn't DNSSEC validated) and is pointless when we
      have ONS.

    - it does DNS resolution on seed nodes, but we have never set seed
      nodes by name and just use seed node IPs instead (which seems a
      bit better anyway since the DNS lookup leaks some metadata).

- it *was* being used for sha256, but an earlier commit in this PR
  already replaced that with libsodium (entirely coincidentally).

- for static deps, it enables HTTPS support for the wallet.  However
  only the CLI wallet actually supports this (the GUI and mobile wallets
  don't), and since oxend hasn't support this for a while I have strong
  doubts it is being used anywhere.  (Plus wallet3 will do everything
  encrypted using zmq/libsodium, so doesn't need this to be secure).
  Note here that it is *only* removed by this commit for static builds:
  if doing a system build that links to libcurl supporting HTTPS then
  HTTPS support will still work.

Libexpat is also gone because it was only there for libunbound.
2022-04-15 13:51:57 -03:00
majestrate
26b24fd787
Update README.md
gut old parts of readme.md for tor
2022-04-14 19:50:15 -04:00
Jason Rhinelander
5d42ae4c4d
hidapi macos fix 2022-04-14 17:49:57 -03:00
Jason Rhinelander
7bc2a0aa7e
Android fixes
- fix openssl build on android with new openssl incantations needed with
  openssl 3.x
- disable Werror on android
2022-04-14 14:37:17 -03:00
Jason Rhinelander
3cfbf0fb66
Windows build fixes
- bump libusb version
- build hidapi using cmake (autoconf is deprecated, and doesn't properly
  set up the required linking on Windows)
- pass through toolchain
- zmq/win32 compilation fix
2022-04-14 14:36:59 -03:00
Jason Rhinelander
0456e5ffb4
Make sure WARNINGS_AS_ERRORS is really off 2022-04-14 14:34:50 -03:00
Jason Rhinelander
a4ab3a7a7d
Silence clang warning 2022-04-14 14:34:50 -03:00
Jason Rhinelander
539c3b2947
De-static epee headers
static inline functions in headers are pointless and wasteful in C++,
and are the C equivalent of a plain inline function in C++.  Make them
merely inline instead.
2022-04-14 14:34:50 -03:00
Jason Rhinelander
c86a7a2a28
Replace epee base64 with oxen-encoding 2022-04-14 14:34:50 -03:00
Jason Rhinelander
a66fc8ae61
Replace epee hex with oxen-encoding
- Aside from converting code, this commit also:

- Cleans out a bunch of epee garbage that this code touches.

- Removes some of the wipeable_string usage from wallet2 added by
  upstream Monero, because that usage was worse than useless: every
  instance removed uses a wipeable_string but then *copies the value
  into a std::string*, which makes the entire thing useless.

  It is, however, *worse* than useless because it is deceptive: a casual
  observer would think that the values are being wiped, when in
  actuality it only added an extra intermediate buffer that gets wiped
  while the final destination doesn't.  This deception is worse than
  nothing, and so I've removed it.

- Removes epee md5 code.  It is entirely unused, and was depending on
  the removed hex code.

- Removes a bunch of useless functions from
  epee/storages/parserse_base_utils.h: in particular the
  exception-to-bool wrappers were only being used in the test suite
  (which was dumb: the test suite is perfectly capable of a "does not
  throw" assertion).

- De-templatizes the parsing code in parserse_base_utils.h that was only
  ever called with a `const char*` "It" (except for one place in the
  test suite was which easily fixed), and moved the implementation into
  a .cpp file.
2022-04-14 14:34:50 -03:00
Jason Rhinelander
2821f5f4ef
Remove unused variable 2022-04-14 14:34:50 -03:00
Jason Rhinelander
47ff596533
Remove UPnP support
We have disabled uPnP by default for nearly a year now (#1423) with no
adverse affects; this commit finishes it off entirely, removing it from
the codebase.

Fixes #1419 -- see discussion in that issue for why UPnP really doesn't
add much utility to Oxen.
2022-04-14 14:34:49 -03:00
Jason Rhinelander
330638361e
Downgrade cpr to 1.7.2
1.8.0 requires a very recent version of curl, which breaks on buster and
bionic; there's nothing added in 1.8.x that we need anyway.
2022-04-14 14:34:49 -03:00
Jason Rhinelander
cf1ee25220
cpr header build fix 2022-04-14 14:34:49 -03:00
Jason Rhinelander
9d58a07260
Update submodules to latest stable versions 2022-04-14 14:32:02 -03:00
Jason Rhinelander
5a5c9bf450
Update static build deps to latest versions 2022-04-14 14:32:02 -03:00
Jason Rhinelander
6fcfd0b8ba
Update oxenmq to latest oxen-mq+oxen-encoding
All the encoding parts move to oxen-encoding recently; this updates to
the latest version of oxen-mq, adds oxen-encoding, and converts
everything to use oxenc headers rather than the oxenmq compatibility
shims.
2022-04-14 14:32:01 -03:00
Jason Rhinelander
83ac88e8ab
Replace openssl sha256 implementation with libsodium
Also completely remove the default OPENSSL_init_ssl() call; openssl has
known how to call that itself since 2016.
2022-04-14 14:32:01 -03:00
Jason Rhinelander
82cb6460ac
Merge pull request #1526 from jagerman/wallet2-api-stake-fix
Only return own contributions in listCurrentStakes()
2022-04-14 14:30:17 -03:00
Jason Rhinelander
39e6fdecfc
Merge pull request #1516 from darcys22/wallet2-import-outputs-remove-macro-and-goto
Removes macro and goto code in wallet2::import_outputs function
2022-04-13 20:42:17 -03:00
Jason Rhinelander
b5276f0648
Only return own contributions in listCurrentStakes()
This is currently returning all contributions in all service nodes you
are staked to, which causes the mobile wallet to list everyone's stakes
in multi-contribution service nodes as your own.
2022-04-13 19:34:20 -03:00
Sean
4f15cd832b
Merge pull request #1518 from darcys22/staking-to-full-node-rebrand
some lingering references to Loki
2022-03-02 08:59:37 +11:00
Sean Darcy
842fe39d83 some lingering references to Loki 2022-02-17 12:02:44 +11:00
Sean Darcy
f7bf4be664 Removes macro and goto code in wallet2::import_outputs function
This simply replaces a confusing code section and replaces an odd
macro/goto combination with a more reasonable if statment.
2022-02-11 14:44:50 +11:00
Sean
9588055440
Merge pull request #1467 from jagerman/ledger-speculos
Ledger emulator (speculos) support
2021-11-17 15:58:36 +11:00