lokinet revert

This commit is contained in:
Sean Darcy 2021-01-04 15:21:21 +11:00 committed by Jason Rhinelander
parent ccd712542d
commit 2822747a62
33 changed files with 379 additions and 379 deletions

View File

@ -24,7 +24,7 @@ local debian_pipeline(name, image,
lto=false,
werror=false, // FIXME
build_tests=true,
test_lokid=true, # Simple lokid offline startup test
test_oxend=true, # Simple oxend offline startup test
run_tests=false, # Runs full test suite
cmake_extra='',
extra_cmds=[],
@ -49,7 +49,7 @@ local debian_pipeline(name, image,
apt_get_quiet + ' install -y eatmydata',
'eatmydata ' + apt_get_quiet + ' dist-upgrade -y',
'eatmydata ' + apt_get_quiet + ' install -y --no-install-recommends cmake git ca-certificates ninja-build ccache '
+ deps + (if test_lokid then ' gdb' else ''),
+ deps + (if test_oxend then ' gdb' else ''),
'mkdir build',
'cd build',
'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE='+build_type+' ' +
@ -64,12 +64,12 @@ local debian_pipeline(name, image,
else
['ninja -j' + jobs + ' -v']
) + (
if test_lokid then [
'(sleep 3; echo "status\ndiff\nexit") | TERM=xterm ../utils/build_scripts/drone-gdb.sh ./bin/lokid --offline --data-dir=startuptest'
if test_oxend then [
'(sleep 3; echo "status\ndiff\nexit") | TERM=xterm ../utils/build_scripts/drone-gdb.sh ./bin/oxend --offline --data-dir=startuptest'
] else []
) + (
if run_tests then [
'mkdir -v -p $$HOME/.loki',
'mkdir -v -p $$HOME/.oxen',
'GTEST_COLOR=1 ctest --output-on-failure -j'+jobs
] else []
) + extra_cmds,
@ -112,7 +112,7 @@ local mac_builder(name,
'ninja -j' + jobs + ' -v'
] + (
if run_tests then [
'mkdir -v -p $$HOME/.loki',
'mkdir -v -p $$HOME/.oxen',
'GTEST_COLOR=1 ctest --output-on-failure -j'+jobs
] else []
) + extra_cmds,
@ -159,8 +159,8 @@ local gui_wallet_step(image, wine=false) = {
'eatmydata ' + apt_get_quiet + ' update',
'eatmydata ' + apt_get_quiet + ' install -y nodejs',
'git clone https://github.com/loki-project/loki-electron-gui-wallet.git',
'cp -v build/bin/lokid' + (if wine then '.exe' else '') + ' loki-electron-gui-wallet/bin',
'cp -v build/bin/loki-wallet-rpc' + (if wine then '.exe' else '') + ' loki-electron-gui-wallet/bin',
'cp -v build/bin/oxend' + (if wine then '.exe' else '') + ' loki-electron-gui-wallet/bin',
'cp -v build/bin/oxen-wallet-rpc' + (if wine then '.exe' else '') + ' loki-electron-gui-wallet/bin',
'cd loki-electron-gui-wallet',
'eatmydata npm install',
'sed -i -e \'s/^\\\\( *"version": ".*\\\\)",/\\\\\\\\1-${DRONE_COMMIT_SHA:0:8}",/\' package.json',
@ -175,7 +175,7 @@ local gui_wallet_step_darwin = {
environment: { SSH_KEY: { from_secret: "SSH_KEY" }, CSC_IDENTITY_AUTO_DISCOVERY: 'false' },
commands: [
'git clone https://github.com/loki-project/loki-electron-gui-wallet.git',
'cp -v build/bin/{lokid,loki-wallet-rpc} loki-electron-gui-wallet/bin',
'cp -v build/bin/{oxend,oxen-wallet-rpc} loki-electron-gui-wallet/bin',
'cd loki-electron-gui-wallet',
'sed -i -e \'s/^\\\\( *"version": ".*\\\\)",/\\\\1-${DRONE_COMMIT_SHA:0:8}",/\' package.json',
'npm install',
@ -212,7 +212,7 @@ local gui_wallet_step_darwin = {
// Static mingw build (on focal) which gets uploaded to builds.lokinet.dev:
debian_pipeline("Static (win64)", "ubuntu:focal", deps='g++ g++-mingw-w64-x86-64 '+static_build_deps,
cmake_extra='-DCMAKE_TOOLCHAIN_FILE=../cmake/64-bit-toolchain.cmake -DBUILD_STATIC_DEPS=ON -DARCH=x86-64',
build_tests=false, lto=false, test_lokid=false, extra_cmds=[
build_tests=false, lto=false, test_oxend=false, extra_cmds=[
'ninja strip_binaries', 'ninja create_zip', '../utils/build_scripts/drone-static-upload.sh'],
extra_steps=[gui_wallet_step('debian:stable', wine=true)]),

View File

@ -1,6 +1,6 @@
# Anonymity Networks with Loki
# Anonymity Networks with Oxen
Currently only Tor and I2P have been integrated into Loki. The usage of
Currently only Tor and I2P have been integrated into Oxen. The usage of
these networks is still considered experimental - there are a few pessimistic
cases where privacy is leaked. The design is intended to maximize privacy of
the source of a transaction by broadcasting it over an anonymity network, while
@ -16,11 +16,11 @@ will only be sent to peers on anonymity networks. If an anonymity network is
enabled but no peers over an anonymity network are available, an error is
logged and the transaction is kept for future broadcasting over an anonymity
network. The transaction will not be broadcast unless an anonymity connection
is made or until `lokid` is shutdown and restarted with only public
is made or until `oxend` is shutdown and restarted with only public
connections enabled.
Anonymity networks can also be used with `loki-wallet-cli` and
`loki-wallet-rpc` - the wallets will connect to a daemon through a proxy. The
Anonymity networks can also be used with `oxen-wallet-cli` and
`oxen-wallet-rpc` - the wallets will connect to a daemon through a proxy. The
daemon must provide a hidden service for the RPC itself, which is separate from
the hidden service for P2P connections.
@ -43,7 +43,7 @@ additional peers can be found through typical p2p peerlist sharing.
### Outbound Connections
Connecting to an anonymous address requires the command line option
`--tx-proxy` which tells `lokid` the ip/port of a socks proxy provided by a
`--tx-proxy` which tells `oxend` the ip/port of a socks proxy provided by a
separate process. On most systems the configuration will look like:
```
@ -51,7 +51,7 @@ separate process. On most systems the configuration will look like:
--tx-proxy i2p,127.0.0.1:9000
```
which tells `lokid` that ".onion" p2p addresses can be forwarded to a socks
which tells `oxend` that ".onion" p2p addresses can be forwarded to a socks
proxy at IP 127.0.0.1 port 9050 with a max of 10 outgoing connections and
".b32.i2p" p2p addresses can be forwarded to a socks proxy at IP 127.0.0.1 port
9000 with the default max outgoing connections. Since there are no seed nodes
@ -69,7 +69,7 @@ seed nodes on ALL networks, which will typically be undesirable.
### Inbound Connections
Receiving anonymity connections is done through the option
`--anonymous-inbound`. This option tells `lokid` the inbound address, network
`--anonymous-inbound`. This option tells `oxend` the inbound address, network
type, and max connections:
```
@ -77,24 +77,24 @@ type, and max connections:
--anonymous-inbound cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p:5000,127.0.0.1:30000
```
which tells `lokid` that a max of 25 inbound Tor connections are being
received at address "rveahdfho7wo4b2m.onion:28083" and forwarded to `lokid`
which tells `oxend` that a max of 25 inbound Tor connections are being
received at address "rveahdfho7wo4b2m.onion:28083" and forwarded to `oxend`
localhost port 28083, and a default max I2P connections are being received at
address "cmeua5767mz2q5jsaelk2rxhf67agrwuetaso5dzbenyzwlbkg2q.b32.i2p:5000" and
forwarded to `lokid` localhost port 30000.
forwarded to `oxend` localhost port 30000.
These addresses will be shared with outgoing peers, over the same network type,
otherwise the peer will not be notified of the peer address by the proxy.
### Wallet RPC
An anonymity network can be configured to forward incoming connections to a
`lokid` RPC port - which is independent from the configuration for incoming
`oxend` RPC port - which is independent from the configuration for incoming
P2P anonymity connections. The anonymity network (Tor/i2p) is
[configured in the same manner](#configuration), except the localhost port
must be the RPC port (typically 22023 for mainnet) instead of the p2p port:
```
HiddenServiceDir /var/lib/tor/data/loki
HiddenServiceDir /var/lib/tor/data/oxen
HiddenServicePort 18081 127.0.0.1:18081
```
@ -136,13 +136,13 @@ Tor must be configured for hidden services. An example configuration ("torrc")
might look like:
```
HiddenServiceDir /var/lib/tor/data/loki
HiddenServiceDir /var/lib/tor/data/oxen
HiddenServicePort 28083 127.0.0.1:28083
```
This will store key information in `/var/lib/tor/data/loki` and will forward
This will store key information in `/var/lib/tor/data/oxen` and will forward
"Tor port" 28083 to port 28083 of ip 127.0.0.1. The file
`/usr/lib/tor/data/loki/hostname` will contain the ".onion" address for use
`/usr/lib/tor/data/oxen/hostname` will contain the ".onion" address for use
with `--anonymous-inbound`.
I2P must be configured with a standard server tunnel. Configuration differs by
@ -161,7 +161,7 @@ sees a transaction over Tor, it could _assume_ (possibly incorrectly) that the
transaction originated from the peer. If both the Tor connection and an
IPv4/IPv6 connection have timestamps that are approximately close in value they
could be used to link the two connections. This is less likely to happen if the
system clock is fairly accurate - many peers on the Loki network should have
system clock is fairly accurate - many peers on the Oxen network should have
similar timestamps.
#### Mitigation
@ -172,14 +172,14 @@ the system clock is noticeably off (and therefore more fingerprintable),
linking the public IPv4/IPv6 connections with the anonymity networks will be
more difficult.
### Intermittent Loki Syncing
### Intermittent Oxen Syncing
If a user only runs `lokid` to send a transaction then quit, this can also
If a user only runs `oxend` to send a transaction then quit, this can also
be used by an ISP to link a user to a transaction.
#### Mitigation
Run `lokid` as often as possible to conceal when transactions are being sent.
Run `oxend` as often as possible to conceal when transactions are being sent.
Future versions will also have peers that first receive a transaction over an
anonymity network delay the broadcast to public peers by a randomized amount.
This will not completely mitigate a user who syncs up sends then quits, in
@ -211,20 +211,20 @@ signature. This issue was (primarily) raised by @secparam on Twitter.
#### Mitigation
`lokid` currently selects two outgoing connections every 5 minutes for
`oxend` currently selects two outgoing connections every 5 minutes for
transmitting transactions over I2P/Tor. Using outgoing connections prevents an
adversary from making many incoming connections to obtain information (this
technique was taken from Dandelion). Outgoing connections also do not have a
persistent public key identity - the creation of a new circuit will generate
a new public key identity. The lock time on a change address is ~20 minutes, so
`lokid` will have rotated its selected outgoing connections several times in
`oxend` will have rotated its selected outgoing connections several times in
most cases. However, the number of outgoing connections is typically a small
fixed number, so there is a decent probability of re-use with the same public
key identity.
@secparam (twitter) recommended changing circuits (Tor) as an additional
precaution. This is likely not a good idea - forcibly requesting Tor to change
circuits is observable by the ISP. Instead, `lokid` should likely disconnect
circuits is observable by the ISP. Instead, `oxend` should likely disconnect
from peers occasionally. Tor will rotate circuits every ~10 minutes, so
establishing new connections will use a new public key identity and make it
more difficult for the hidden service to link information. This process will

View File

@ -1,7 +1,7 @@
# Multistage docker build, requires docker 17.05
# TO RUN
# docker build -t loki-daemon-image .
# docker build -t oxen-daemon-image .
# TO COLLECT BINARIES
# ./util/build_scripts/collect_from_docker_container.sh
@ -105,7 +105,7 @@ RUN set -ex && \
make -j$(nproc) VERBOSE=1
RUN set -ex && \
ldd /src/build/release/bin/lokid
ldd /src/build/release/bin/oxend
# runtime stage
FROM ubuntu:16.04
@ -117,24 +117,24 @@ RUN set -ex && \
rm -rf /var/lib/apt
COPY --from=builder /src/build/release/bin /usr/local/bin/
# Create loki user
RUN adduser --system --group --disabled-password loki && \
mkdir -p /wallet /home/loki/.loki && \
chown -R loki:loki /home/loki/.loki && \
chown -R loki:loki /wallet
# Create oxen user
RUN adduser --system --group --disabled-password oxen && \
mkdir -p /wallet /home/oxen/.oxen && \
chown -R oxen:oxen /home/oxen/.oxen && \
chown -R oxen:oxen /wallet
# Contains the blockchain
VOLUME /home/loki/.loki
VOLUME /home/oxen/.oxen
# Generate your wallet via accessing the container and run:
# cd /wallet
# loki-wallet-cli
# oxen-wallet-cli
VOLUME /wallet
EXPOSE 22022
EXPOSE 22023
# switch to user monero
USER loki
# switch to user oxen
USER oxen
ENTRYPOINT ["lokid", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=22022", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=22023", "--non-interactive", "--confirm-external-bind"]
ENTRYPOINT ["oxend", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=22022", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=22023", "--non-interactive", "--confirm-external-bind"]

114
README.md
View File

@ -1,4 +1,4 @@
# Loki
# Oxen
<p align="center">
<a href="https://github.com/loki-project/loki/commits/dev"><img alt="pipeline status" src="https://gitlab.com/lokiproject/loki/badges/dev/pipeline.svg" /></a>
@ -22,13 +22,13 @@ Portions Copyright (c) 2012-2013 The Cryptonote developers.
## Information
Loki is a private cryptocurrency based on Monero. Loki currently offers an incentivised full node layer, over the coming months we will be looking to support a secondary p2p network (Lokinet) and a messenger that offers private communications based on the Signal protocol (Loki Messenger).
Oxen is a private cryptocurrency based on Monero. Oxen currently offers an incentivised full node layer, over the coming months we will be looking to support a secondary p2p network (Lokinet) and a messenger that offers private communications based on the Signal protocol (Session).
More information on the project can be found on the website and in the whitepaper.
Loki is an open source project, and we encourage contributions from anyone with something to offer. For more information on contributing, please contact team@loki.network
Oxen is an open source project, and we encourage contributions from anyone with something to offer. For more information on contributing, please contact team@loki.network
## Compiling Loki from source
## Compiling Oxen from source
### Dependencies
@ -49,7 +49,7 @@ library archives (`.a`).
| Boost | 1.65 | NO | `libboost-all-dev`[2] | `boost` | `boost-devel` | NO | C++ libraries |
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | `openssl-devel` | NO | sha256 sum |
| libzmq | 4.3.0 | YES | `libzmq3-dev` | `zeromq` | `zeromq-devel` | NO | ZeroMQ library |
| sqlite3 | ? | YES | `libsqlite3-dev` | `sqlite` | `sqlite-devel` | NO | Loki Name System |
| sqlite3 | ? | YES | `libsqlite3-dev` | `sqlite` | `sqlite-devel` | NO | Oxen Name System |
| libunbound | 1.4.16 | NO | `libunbound-dev` | `unbound` | `unbound-devel` | NO | DNS resolver |
| libsodium | 1.0.9 | YES | `libsodium-dev` | `libsodium` | `libsodium-devel` | NO | cryptography |
| libcurl | 4.0 | NO | `libcurl4-openssl-dev` | `curl` | `curl-devel` | NO | HTTP RPC |
@ -101,7 +101,7 @@ If you already have a repo cloned, initialize and update:
### Build instructions
Loki uses the CMake build system and an optional top-level [Makefile](Makefile) that wraps cmake
Oxen uses the CMake build system and an optional top-level [Makefile](Makefile) that wraps cmake
commands as needed (alternatively you may create a build directory and invoke cmake directly).
#### On Linux and macOS
@ -121,7 +121,7 @@ commands as needed (alternatively you may create a build directory and invoke cm
available per thread.
*Note*: The instructions above will compile the most stable release of the
Loki software. If you would like to use and test the most recent software,
Oxen software. If you would like to use and test the most recent software,
use ```git checkout master```. The master branch may contain updates that are
both unstable and incompatible with release software, though testing is always
encouraged.
@ -130,7 +130,7 @@ commands as needed (alternatively you may create a build directory and invoke cm
* Add `PATH="$PATH:$HOME/loki/build/release/bin"` to `.profile`
* Run Loki with `lokid --detach`
* Run Oxen with `oxend --detach`
* **Optional**: build and run the test suite to verify the binaries:
@ -169,7 +169,7 @@ the swap file is on the SD card: intensive writes to a swap file on an SD card c
quickly the SD card wears out. Devices with 4GB of RAM (such as the 4GB model of the Pi 4B, and
some other SBC ARM devices) can build without needing swap.
As an alternative, pre-built loki debs are available for ARM32 and ARM64 for recent
As an alternative, pre-built oxen debs are available for ARM32 and ARM64 for recent
Debian/Raspbian/Ubuntu distributions and are often a much better alternative for SBC-class devices.
If you still want to compile from source, ensure you have enough memory (or swap -- consult your OS
documentation to learn how to enable or increase swap size) and follow the regular linux build
@ -257,7 +257,7 @@ application.
make release-static-win32
```
* The resulting executables can be found in `build/<MinGW version>/<loki version>/release/bin`
* The resulting executables can be found in `build/<MinGW version>/<oxen version>/release/bin`
* **Optional**: to build Windows binaries suitable for debugging on a 64-bit system, run:
@ -271,12 +271,12 @@ application.
make debug-static-win32
```
* The resulting executables can be found in `build/<MinGW version>/<loki version>/debug/bin`
* The resulting executables can be found in `build/<MinGW version>/<oxen version>/debug/bin`
### On FreeBSD:
The project can be built from scratch by following instructions for Linux above(but use `gmake` instead of `make`).
If you are running Loki in a jail, you need to add `sysvsem="new"` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`.
If you are running Oxen in a jail, you need to add `sysvsem="new"` to your jail configuration, otherwise lmdb will throw the error message: `Failed to open lmdb environment: Function not implemented`.
### On OpenBSD:
@ -285,9 +285,9 @@ You will need to add a few packages to your system. `pkg_add cmake gmake zeromq
The `doxygen` and `graphviz` packages are optional and require the xbase set.
Running the test suite also requires `py-requests` package.
Build loki: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local gmake release-static`
Build oxen: `env DEVELOPER_LOCAL_TOOLS=1 BOOST_ROOT=/usr/local gmake release-static`
Note: you may encounter the following error, when compiling the latest version of loki as a normal user:
Note: you may encounter the following error, when compiling the latest version of oxen as a normal user:
```
LLVM ERROR: out of memory
@ -313,13 +313,13 @@ Then you can run make as usual.
```bash
# Build image (for ARM 32-bit)
docker build -f utils/build_scripts/android32.Dockerfile -t loki-android .
docker build -f utils/build_scripts/android32.Dockerfile -t oxen-android .
# Build image (for ARM 64-bit)
docker build -f utils/build_scripts/android64.Dockerfile -t loki-android .
docker build -f utils/build_scripts/android64.Dockerfile -t oxen-android .
# Create container
docker create -it --name loki-android loki-android bash
docker create -it --name oxen-android oxen-android bash
# Get binaries
docker cp loki-android:/src/build/release/bin .
docker cp oxen-android:/src/build/release/bin .
```
### Building portable statically linked binaries
@ -356,11 +356,11 @@ You can also cross-compile static binaries on Linux for Windows and macOS with t
The required packages are the names for each toolchain on apt. Depending on your distro, they may have different names.
Using `depends` might also be easier to compile Loki on Windows than using MSYS. Activate Windows Subsystem for Linux (WSL) with a distro (for example Ubuntu), install the apt build-essentials and follow the `depends` steps as depicted above.
Using `depends` might also be easier to compile Oxen on Windows than using MSYS. Activate Windows Subsystem for Linux (WSL) with a distro (for example Ubuntu), install the apt build-essentials and follow the `depends` steps as depicted above.
The produced binaries still link libc dynamically. If the binary is compiled on a current distribution, it might not run on an older distribution with an older installation of libc. Passing `-DBACKCOMPAT=ON` to cmake will make sure that the binary will run on systems having at least libc version 2.17.
## Installing Loki from a package
## Installing Oxen from a package
Pre-built packages are available for recent Debian and Ubuntu systems (and are often usable on
Debian or Ubuntu-derived Linux distributions). For more details see https://deb.imaginary.stream
@ -371,32 +371,32 @@ You can also build a docker package using:
```bash
# Build using all available cores
docker build -t loki-daemon-image .
docker build -t oxen-daemon-image .
# or build using a specific number of cores (reduce RAM requirement)
docker build --build-arg NPROC=1 -t loki .
docker build --build-arg NPROC=1 -t oxen .
# either run in foreground
docker run -it -v /loki/chain:/root/.loki -v /loki/wallet:/wallet -p 22022:22022 loki
docker run -it -v /oxen/chain:/root/.oxen -v /oxen/wallet:/wallet -p 22022:22022 oxen
# or in background
docker run -it -d -v /loki/chain:/root/.loki -v /loki/wallet:/wallet -p 22022:22022 loki
docker run -it -d -v /oxen/chain:/root/.oxen -v /oxen/wallet:/wallet -p 22022:22022 oxen
```
* The build needs 3 GB space.
* Wait one hour or more. For docker, the collect_from_docker_container.sh script will automate downloading the binaries from the docker container.
## Running lokid
## Running oxend
The build places the binary in `bin/` sub-directory within the build directory
from which cmake was invoked (repository root by default). To run in
foreground:
```bash
./bin/lokid
./bin/oxend
```
To list all available options, run `./bin/lokid --help`. Options can be
To list all available options, run `./bin/oxend --help`. Options can be
specified either on the command line or in a configuration file passed by the
`--config-file` argument. To specify an option in the configuration file, add
a line with the syntax `argumentname=value`, where `argumentname` is the name
@ -405,18 +405,18 @@ of the argument without the leading dashes, for example `log-level=1`.
To run in background:
```bash
./bin/lokid --log-file lokid.log --detach
./bin/oxend --log-file oxend.log --detach
```
To run as a systemd service, copy
[lokid.service](utils/systemd/lokid.service) to `/etc/systemd/system/` and
[lokid.conf](utils/conf/lokid.conf) to `/etc/`. The [example
service](utils/systemd/lokid.service) assumes that the user `loki` exists
[oxend.service](utils/systemd/oxend.service) to `/etc/systemd/system/` and
[oxend.conf](utils/conf/oxend.conf) to `/etc/`. The [example
service](utils/systemd/oxend.service) assumes that the user `oxen` exists
and its home is the data directory specified in the [example
config](utils/conf/lokid.conf).
config](utils/conf/oxend.conf).
If you're on Mac, you may need to add the `--max-concurrency 1` option to
loki-wallet-cli, and possibly lokid, if you get crashes refreshing.
oxen-wallet-cli, and possibly oxend, if you get crashes refreshing.
## Internationalization
@ -430,32 +430,32 @@ See [README.i18n.md](README.i18n.md).
> used solely for relaying transactions received over local RPC. This provides
> privacy and better protection against surrounding node (sybil) attacks.
While Loki isn't made to integrate with Tor, it can be used wrapped with torsocks, by
While Oxen isn't made to integrate with Tor, it can be used wrapped with torsocks, by
setting the following configuration parameters and environment variables:
* `--p2p-bind-ip 127.0.0.1` on the command line or `p2p-bind-ip=127.0.0.1` in
lokid.conf to disable listening for connections on external interfaces.
* `--no-igd` on the command line or `no-igd=1` in lokid.conf to disable IGD
oxend.conf to disable listening for connections on external interfaces.
* `--no-igd` on the command line or `no-igd=1` in oxend.conf to disable IGD
(UPnP port forwarding negotiation), which is pointless with Tor.
* `DNS_PUBLIC=tcp` or `DNS_PUBLIC=tcp://x.x.x.x` where x.x.x.x is the IP of the
desired DNS server, for DNS requests to go over TCP, so that they are routed
through Tor. When IP is not specified, lokid uses the default list of
through Tor. When IP is not specified, oxend uses the default list of
servers defined in [src/common/dns_utils.cpp](src/common/dns_utils.cpp).
* `TORSOCKS_ALLOW_INBOUND=1` to tell torsocks to allow lokid to bind to interfaces
* `TORSOCKS_ALLOW_INBOUND=1` to tell torsocks to allow oxend to bind to interfaces
to accept connections from the wallet. On some Linux systems, torsocks
allows binding to localhost by default, so setting this variable is only
necessary to allow binding to local LAN/VPN interfaces to allow wallets to
connect from remote hosts. On other systems, it may be needed for local wallets
as well.
* Do NOT pass `--detach` when running through torsocks with systemd, (see
[utils/systemd/lokid.service](utils/systemd/lokid.service) for details).
[utils/systemd/oxend.service](utils/systemd/oxend.service) for details).
* If you use the wallet with a Tor daemon via the loopback IP (eg, 127.0.0.1:9050),
then use `--untrusted-daemon` unless it is your own hidden service.
Example command line to start lokid through Tor:
Example command line to start oxend through Tor:
```bash
DNS_PUBLIC=tcp torsocks lokid --p2p-bind-ip 127.0.0.1 --no-igd
DNS_PUBLIC=tcp torsocks oxend --p2p-bind-ip 127.0.0.1 --no-igd
```
### Using Tor on Tails
@ -466,13 +466,13 @@ allow inbound connections. Full example:
```bash
sudo iptables -I OUTPUT 2 -p tcp -d 127.0.0.1 -m tcp --dport 22023 -j ACCEPT
DNS_PUBLIC=tcp torsocks ./lokid --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \
DNS_PUBLIC=tcp torsocks ./oxend --p2p-bind-ip 127.0.0.1 --no-igd --rpc-bind-ip 127.0.0.1 \
--data-dir /home/amnesia/Persistent/your/directory/to/the/blockchain
```
## Debugging
This section contains general instructions for debugging failed installs or problems encountered with Loki. First ensure you are running the latest version built from the Github repo.
This section contains general instructions for debugging failed installs or problems encountered with Oxen. First ensure you are running the latest version built from the Github repo.
### Obtaining stack traces and core dumps on Unix systems
@ -485,7 +485,7 @@ Run the build.
Once it stalls, enter the following command:
```bash
gdb /path/to/lokid `pidof lokid`
gdb /path/to/oxend `pidof oxend`
```
Type `thread apply all bt` within gdb in order to obtain the stack trace
@ -498,12 +498,12 @@ Enter `echo core | sudo tee /proc/sys/kernel/core_pattern` to stop cores from be
Run the build.
When it terminates with an output along the lines of "Segmentation fault (core dumped)", there should be a core dump file in the same directory as lokid. It may be named just `core`, or `core.xxxx` with numbers appended.
When it terminates with an output along the lines of "Segmentation fault (core dumped)", there should be a core dump file in the same directory as oxend. It may be named just `core`, or `core.xxxx` with numbers appended.
You can now analyse this core dump with `gdb` as follows:
```bash
gdb /path/to/lokid /path/to/dumpfile`
gdb /path/to/oxend /path/to/dumpfile`
```
Print the stack trace with `bt`
@ -514,13 +514,13 @@ Print the stack trace with `bt`
coredumpctl -1 gdb
```
#### To run Loki within gdb:
#### To run Oxen within gdb:
Type `gdb /path/to/lokid`
Type `gdb /path/to/oxend`
Pass command-line options with `--args` followed by the relevant arguments
Type `run` to run lokid
Type `run` to run oxend
### Analysing memory corruption
@ -528,17 +528,17 @@ There are two tools available:
#### ASAN
Configure Loki with the -D SANITIZE=ON cmake flag, eg:
Configure Oxen with the -D SANITIZE=ON cmake flag, eg:
```bash
cd build/debug && cmake -D SANITIZE=ON -D CMAKE_BUILD_TYPE=Debug ../..
```
You can then run the loki tools normally. Performance will typically halve.
You can then run the oxen tools normally. Performance will typically halve.
#### valgrind
Install valgrind and run as `valgrind /path/to/lokid`. It will be very slow.
Install valgrind and run as `valgrind /path/to/oxend`. It will be very slow.
### LMDB
@ -547,7 +547,7 @@ Instructions for debugging suspected blockchain corruption as per @HYC
There is an `mdb_stat` command in the LMDB source that can print statistics about the database but it's not routinely built. This can be built with the following command:
```bash
cd ~/loki/external/db_drivers/liblmdb && make
cd ~/oxen/external/db_drivers/liblmdb && make
```
The output of `mdb_stat -ea <path to blockchain dir>` will indicate inconsistencies in the blocks, block_heights and block_info table.
@ -562,13 +562,13 @@ These records are dumped as hex data, where the first line is the key and the se
### Socket-based
Because of the nature of the socket-based protocols that drive Loki, certain protocol weaknesses are somewhat unavoidable at this time. While these weaknesses can theoretically be fully mitigated, the effort required (the means) may not justify the ends. As such, please consider taking the following precautions if you are a Loki node operator:
Because of the nature of the socket-based protocols that drive Oxen, certain protocol weaknesses are somewhat unavoidable at this time. While these weaknesses can theoretically be fully mitigated, the effort required (the means) may not justify the ends. As such, please consider taking the following precautions if you are a Oxen node operator:
- Run `lokid` on a "secured" machine. If operational security is not your forte, at a very minimum, have a dedicated a computer running `lokid` and **do not** browse the web, use email clients, or use any other potentially harmful apps on your `lokid` machine. **Do not click links or load URL/MUA content on the same machine**. Doing so may potentially exploit weaknesses in commands which accept "localhost" and "127.0.0.1".
- If you plan on hosting a public "remote" node, start `lokid` with `--restricted-rpc`. This is a must.
- Run `oxend` on a "secured" machine. If operational security is not your forte, at a very minimum, have a dedicated a computer running `oxend` and **do not** browse the web, use email clients, or use any other potentially harmful apps on your `oxend` machine. **Do not click links or load URL/MUA content on the same machine**. Doing so may potentially exploit weaknesses in commands which accept "localhost" and "127.0.0.1".
- If you plan on hosting a public "remote" node, start `oxend` with `--restricted-rpc`. This is a must.
### Blockchain-based
Certain blockchain "features" can be considered "bugs" if misused correctly. Consequently, please consider the following:
- When receiving Loki, be aware that it may be locked for an arbitrary time if the sender elected to, preventing you from spending that Loki until the lock time expires. You may want to hold off acting upon such a transaction until the unlock time lapses. To get a sense of that time, you can consider the remaining blocktime until unlock as seen in the `show_transfers` command.
- When receiving Oxen, be aware that it may be locked for an arbitrary time if the sender elected to, preventing you from spending that Oxen until the lock time expires. You may want to hold off acting upon such a transaction until the unlock time lapses. To get a sense of that time, you can consider the remaining blocktime until unlock as seen in the `show_transfers` command.

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Example script using Python to query and decode and decrypt a .loki address or HF16+ Session address
# Example script using Python to query and decode and decrypt a .oxen address or HF16+ Session address
import requests
import nacl.hash
@ -8,7 +8,7 @@ import nacl.secret
from base64 import b64encode, b32encode
import sys
name = "Jason.loki"
name = "Jason.oxen"
type = 2 # 2 == lokinet, 0 == session
name_hash = nacl.hash.blake2b(name.lower().encode(), encoder=nacl.encoding.RawEncoder)
@ -18,7 +18,7 @@ name_hash_b64 = b64encode(name_hash)
print("Name: {}, hashed+base64: {}".format(name, name_hash_b64.decode()))
# Make the RPC request to some lokid
# Make the RPC request to some oxend
r = requests.post('http://localhost:22023/json_rpc',
json={ "jsonrpc": "2.0", "id": "0",
"method": "lns_resolve", "params": { "type": 2, "name_hash": name_hash_b64 }
@ -60,7 +60,7 @@ val = val.translate(str.maketrans("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567", "ybndrfg8e
# Base32 is also padded with '=', which isn't used in z-base-32:
val = val.rstrip('=')
# Finally slap ".loki" on the end:
val += ".loki"
# Finally slap ".oxen" on the end:
val += ".oxen"
print("Result: {}".format(val))

View File

@ -158,7 +158,7 @@ int generate(bool ed25519, std::list<std::string_view> args) {
std::cout <<
"Public key: " << lokimq::to_hex(pubkey.begin(), pubkey.end()) <<
"\nX25519 pubkey: " << lokimq::to_hex(x_pubkey.begin(), x_pubkey.end()) <<
"\nOxennet address: " << lokimq::to_base32z(pubkey.begin(), pubkey.end()) << ".snode\n";
"\nLokinet address: " << lokimq::to_base32z(pubkey.begin(), pubkey.end()) << ".snode\n";
} else {
std::cout << "Public key: " << lokimq::to_hex(pubkey.begin(), pubkey.end()) << "\n";
}
@ -243,7 +243,7 @@ int show(std::list<std::string_view> args) {
"\nSecret key: " << lokimq::to_hex(seckey.begin(), seckey.begin() + 32) <<
"\nPublic key: " << lokimq::to_hex(pubkey.begin(), pubkey.end()) <<
"\nX25519 pubkey: " << lokimq::to_hex(x_pubkey.begin(), x_pubkey.end()) <<
"\nOxennet address: " << lokimq::to_base32z(pubkey.begin(), pubkey.end()) << ".snode\n\n";
"\nLokinet address: " << lokimq::to_base32z(pubkey.begin(), pubkey.end()) << ".snode\n\n";
return 0;
}
@ -300,7 +300,7 @@ int restore(bool ed25519, std::list<std::string_view> args) {
if (0 != crypto_sign_ed25519_pk_to_curve25519(x_pubkey.data(), pubkey.data()))
return error(14, "Unable to convert Ed25519 pubkey to X25519 pubkey; is this a really valid secret key?");
std::cout << "X25519 pubkey: " << lokimq::to_hex(x_pubkey.begin(), x_pubkey.end()) <<
"\nOxennet address: " << lokimq::to_base32z(pubkey.begin(), pubkey.end()) << ".snode";
"\nLokinet address: " << lokimq::to_base32z(pubkey.begin(), pubkey.end()) << ".snode";
}
if (pubkey_expected) {

View File

@ -29,7 +29,7 @@ tx_extra_oxen_name_system tx_extra_oxen_name_system::make_buy(
tx_extra_oxen_name_system tx_extra_oxen_name_system::make_renew(
lns::mapping_type type, crypto::hash const &name_hash, crypto::hash const &prev_txid)
{
assert(is_oxennet_type(type) && prev_txid);
assert(is_lokinet_type(type) && prev_txid);
tx_extra_oxen_name_system result{};
result.fields = lns::extra_field::none;

View File

@ -489,9 +489,9 @@ namespace cryptonote
bool is_updating() const { return field_is_set(lns::extra_field::signature) && field_any_set(lns::extra_field::updatable_fields); }
// True if this is buying a new LNS record
bool is_buying() const { return (fields == lns::extra_field::buy || fields == lns::extra_field::buy_no_backup); }
// True if this is renewing an existing LNS: has no fields at all, is a renewal registration (i.e. oxennet),
// True if this is renewing an existing LNS: has no fields at all, is a renewal registration (i.e. lokinet),
// and has a non-null txid set (which should point to the most recent registration or update).
bool is_renewing() const { return fields == lns::extra_field::none && prev_txid && is_oxennet_type(type); }
bool is_renewing() const { return fields == lns::extra_field::none && prev_txid && is_lokinet_type(type); }
static tx_extra_oxen_name_system make_buy(
lns::generic_owner const& owner,

View File

@ -73,7 +73,7 @@ static_assert(STAKING_PORTIONS % 12 == 0, "Use a multiple of twelve, so that it
#define UPTIME_PROOF_MAX_TIME_IN_SECONDS (UPTIME_PROOF_FREQUENCY_IN_SECONDS * 2 + UPTIME_PROOF_BUFFER_IN_SECONDS) // How long until proofs of other network service nodes are considered expired
#define STORAGE_SERVER_PING_LIFETIME UPTIME_PROOF_FREQUENCY_IN_SECONDS
#define OXENNET_PING_LIFETIME UPTIME_PROOF_FREQUENCY_IN_SECONDS
#define LOKINET_PING_LIFETIME UPTIME_PROOF_FREQUENCY_IN_SECONDS
#define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 20000 // NOTE(oxen): For testing suite, //size of block (bytes) after which reward for block calculated using block size - before first fork

View File

@ -281,7 +281,7 @@ namespace cryptonote
, m_last_json_checkpoints_update(0)
, m_nettype(UNDEFINED)
, m_last_storage_server_ping(0)
, m_last_oxennet_ping(0)
, m_last_lokinet_ping(0)
, m_pad_transactions(false)
{
m_checkpoints_updating.clear();
@ -505,7 +505,7 @@ namespace cryptonote
}
// Returns a string for systemd status notifications such as:
// Height: 1234567, SN: active, proof: 55m12s, storage: 4m48s, oxennet: 47s
// Height: 1234567, SN: active, proof: 55m12s, storage: 4m48s, lokinet: 47s
std::string core::get_status_string() const
{
std::string s;
@ -540,8 +540,8 @@ namespace cryptonote
s += time_ago_str(now, last_proof);
s += ", storage: ";
s += time_ago_str(now, m_last_storage_server_ping);
s += ", oxennet: ";
s += time_ago_str(now, m_last_oxennet_ping);
s += ", lokinet: ";
s += time_ago_str(now, m_last_lokinet_ping);
}
}
return s;
@ -961,7 +961,7 @@ namespace cryptonote
MGINFO_YELLOW("- primary: " << tools::type_to_hex(keys.pub));
MGINFO_YELLOW("- ed25519: " << tools::type_to_hex(keys.pub_ed25519));
// .snode address is the ed25519 pubkey, encoded with base32z and with .snode appended:
MGINFO_YELLOW("- oxennet: " << lokimq::to_base32z(tools::view_guts(keys.pub_ed25519)) << ".snode");
MGINFO_YELLOW("- lokinet: " << lokimq::to_base32z(tools::view_guts(keys.pub_ed25519)) << ".snode");
MGINFO_YELLOW("- x25519: " << tools::type_to_hex(keys.pub_x25519));
} else {
// Only print the x25519 version because it's the only thing useful for a non-SN (for
@ -2133,7 +2133,7 @@ namespace cryptonote
void core::update_lmq_sns()
{
// TODO: let callers (e.g. oxennet, ss) subscribe to callbacks when this fires
// TODO: let callers (e.g. lokinet, ss) subscribe to callbacks when this fires
lokimq::pubkey_set active_sns;
m_service_node_list.copy_active_x25519_pubkeys(std::inserter(active_sns, active_sns.end()));
m_lmq->set_active_sns(std::move(active_sns));
@ -2241,10 +2241,10 @@ namespace cryptonote
"is running! It is required to run alongside the Loki daemon");
return;
}
if (!check_external_ping(m_last_oxennet_ping, OXENNET_PING_LIFETIME, "Lokinet"))
if (!check_external_ping(m_last_lokinet_ping, LOKINET_PING_LIFETIME, "Lokinet"))
{
MGINFO_RED(
"Failed to submit uptime proof: have not heard from oxennet recently. Make sure that it "
"Failed to submit uptime proof: have not heard from lokinet recently. Make sure that it "
"is running! It is required to run alongside the Loki daemon");
return;
}

View File

@ -1002,8 +1002,8 @@ namespace cryptonote
*/
bool set_storage_server_peer_reachable(crypto::public_key const &pubkey, bool value);
/// Time point at which the storage server and oxennet last pinged us
std::atomic<time_t> m_last_storage_server_ping, m_last_oxennet_ping;
/// Time point at which the storage server and lokinet last pinged us
std::atomic<time_t> m_last_storage_server_ping, m_last_lokinet_ping;
std::atomic<uint16_t> m_storage_lmq_port;
uint32_t sn_public_ip() const { return m_sn_public_ip; }

View File

@ -103,7 +103,7 @@ std::pair<std::basic_string_view<unsigned char>, std::basic_string_view<unsigned
std::string lns::mapping_value::to_readable_value(cryptonote::network_type nettype, lns::mapping_type type) const
{
std::string result;
if (is_oxennet_type(type))
if (is_lokinet_type(type))
{
result = lokimq::to_base32z(to_view()) + ".oxen";
}
@ -611,23 +611,23 @@ std::vector<mapping_type> all_mapping_types(uint8_t hf_version) {
if (hf_version >= cryptonote::network_version_15_lns)
result.push_back(mapping_type::session);
if (hf_version >= cryptonote::network_version_16_pulse)
result.push_back(mapping_type::oxennet);
result.push_back(mapping_type::lokinet);
return result;
}
std::optional<uint64_t> expiry_blocks(cryptonote::network_type nettype, mapping_type type)
{
std::optional<uint64_t> result;
if (is_oxennet_type(type))
if (is_lokinet_type(type))
{
// For testnet we shorten 1-, 2-, and 5-year renewals to 1/2/5 days with 1-day renewal, but
// leave 10 years alone to allow long-term registrations on testnet.
const bool testnet_short = nettype == cryptonote::TESTNET && type != mapping_type::oxennet_10years;
const bool testnet_short = nettype == cryptonote::TESTNET && type != mapping_type::lokinet_10years;
if (type == mapping_type::oxennet) result = BLOCKS_EXPECTED_IN_DAYS(1 * REGISTRATION_YEAR_DAYS);
else if (type == mapping_type::oxennet_2years) result = BLOCKS_EXPECTED_IN_DAYS(2 * REGISTRATION_YEAR_DAYS);
else if (type == mapping_type::oxennet_5years) result = BLOCKS_EXPECTED_IN_DAYS(5 * REGISTRATION_YEAR_DAYS);
else if (type == mapping_type::oxennet_10years) result = BLOCKS_EXPECTED_IN_DAYS(10 * REGISTRATION_YEAR_DAYS);
if (type == mapping_type::lokinet) result = BLOCKS_EXPECTED_IN_DAYS(1 * REGISTRATION_YEAR_DAYS);
else if (type == mapping_type::lokinet_2years) result = BLOCKS_EXPECTED_IN_DAYS(2 * REGISTRATION_YEAR_DAYS);
else if (type == mapping_type::lokinet_5years) result = BLOCKS_EXPECTED_IN_DAYS(5 * REGISTRATION_YEAR_DAYS);
else if (type == mapping_type::lokinet_10years) result = BLOCKS_EXPECTED_IN_DAYS(10 * REGISTRATION_YEAR_DAYS);
assert(result);
if (testnet_short)
@ -744,13 +744,13 @@ static bool check_condition(bool condition, std::string* reason, T&&... args) {
bool validate_lns_name(mapping_type type, std::string name, std::string *reason)
{
bool const is_oxennet = is_oxennet_type(type);
bool const is_lokinet = is_lokinet_type(type);
size_t max_name_len = 0;
if (is_oxennet)
if (is_lokinet)
max_name_len = name.find('-') != std::string::npos
? OXENNET_DOMAIN_NAME_MAX
: OXENNET_DOMAIN_NAME_MAX_NOHYPHEN;
? LOKINET_DOMAIN_NAME_MAX
: LOKINET_DOMAIN_NAME_MAX_NOHYPHEN;
else if (type == mapping_type::session) max_name_len = lns::SESSION_DISPLAY_NAME_MAX;
else if (type == mapping_type::wallet) max_name_len = lns::WALLET_NAME_MAX;
else
@ -772,15 +772,15 @@ bool validate_lns_name(mapping_type type, std::string name, std::string *reason)
std::string_view name_view{name}; // Will chop this down as we validate each part
// NOTE: Validate domain specific requirements
if (is_oxennet)
if (is_lokinet)
{
// OXENNET
// LOKINET
// Domain has to start with an alphanumeric, and can have (alphanumeric or hyphens) in between, the character before the suffix <char>'.oxen' must be alphanumeric followed by the suffix '.oxen'
// It's *approximately* this regex, but there are some extra restrictions below
// ^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.oxen$
// Reserved names:
// - localhost.oxen has special meaning within oxennet (it is always a CNAME to the local
// - localhost.oxen has special meaning within lokinet (it is always a CNAME to the local
// address)
// - oxen.oxen and snode.oxen are prohibited in case someone added .oxen or .snode as search
// domains (in which case the user looking up "foo.oxen" would try end up trying to resolve
@ -907,13 +907,13 @@ bool mapping_value::validate(cryptonote::network_type nettype, mapping_type type
std::memcpy(blob->buffer.data(), &addr_info, blob->len);
}
}
else if (is_oxennet_type(type))
else if (is_lokinet_type(type))
{
// We need a 52 char base32z string that decodes to a 32-byte value, which really means we need
// 51 base32z chars (=255 bits) followed by a 1-bit value ('y'=0, or 'o'=0b10000); anything else
// in the last spot isn't a valid oxennet address.
// in the last spot isn't a valid lokinet address.
if (check_condition(value.size() != 57 || !tools::ends_with(value, ".oxen") || !lokimq::is_base32z(value.substr(0, 52)) || !(value[51] == 'y' || value[51] == 'o'),
reason, "'", value, "' is not a valid oxennet address"))
reason, "'", value, "' is not a valid lokinet address"))
return false;
if (blob)
@ -955,7 +955,7 @@ bool mapping_value::validate_encrypted(mapping_type type, std::string_view value
if (blob) *blob = {};
std::stringstream err_stream;
int value_len = crypto_aead_xchacha20poly1305_ietf_ABYTES + crypto_aead_xchacha20poly1305_ietf_NPUBBYTES;
if (is_oxennet_type(type)) value_len += OXENNET_ADDRESS_BINARY_LENGTH;
if (is_lokinet_type(type)) value_len += LOKINET_ADDRESS_BINARY_LENGTH;
else if (type == mapping_type::wallet) value_len += WALLET_ACCOUNT_BINARY_LENGTH;
else if (type == mapping_type::session)
{
@ -1206,28 +1206,28 @@ bool validate_mapping_type(std::string_view mapping_type_str, uint8_t hf_version
mapping_type_ = lns::mapping_type::session;
else if (hf_version >= cryptonote::network_version_16_pulse)
{
if (tools::string_iequal(mapping, "oxennet"))
mapping_type_ = lns::mapping_type::oxennet;
if (tools::string_iequal(mapping, "lokinet"))
mapping_type_ = lns::mapping_type::lokinet;
else if (txtype == lns_tx_type::buy || txtype == lns_tx_type::renew)
{
if (tools::string_iequal_any(mapping, "oxennet_1y", "oxennet_1years")) // Can also specify "oxennet"
mapping_type_ = lns::mapping_type::oxennet;
else if (tools::string_iequal_any(mapping, "oxennet_2y", "oxennet_2years"))
mapping_type_ = lns::mapping_type::oxennet_2years;
else if (tools::string_iequal_any(mapping, "oxennet_5y", "oxennet_5years"))
mapping_type_ = lns::mapping_type::oxennet_5years;
else if (tools::string_iequal_any(mapping, "oxennet_10y", "oxennet_10years"))
mapping_type_ = lns::mapping_type::oxennet_10years;
if (tools::string_iequal_any(mapping, "lokinet_1y", "lokinet_1years")) // Can also specify "lokinet"
mapping_type_ = lns::mapping_type::lokinet;
else if (tools::string_iequal_any(mapping, "lokinet_2y", "lokinet_2years"))
mapping_type_ = lns::mapping_type::lokinet_2years;
else if (tools::string_iequal_any(mapping, "lokinet_5y", "lokinet_5years"))
mapping_type_ = lns::mapping_type::lokinet_5years;
else if (tools::string_iequal_any(mapping, "lokinet_10y", "lokinet_10years"))
mapping_type_ = lns::mapping_type::lokinet_10years;
}
}
if (!mapping_type_)
{
if (reason) *reason = "Unsupported LNS type \"" + std::string{mapping_type_str} + "\"; supported " + (
txtype == lns_tx_type::update ? "update types are: session, oxennet" :
txtype == lns_tx_type::renew ? "renew types are: oxennet_1y, oxennet_2y, oxennet_5y, oxennet_10y" :
txtype == lns_tx_type::buy ? "buy types are session, oxennet_1y, oxennet_2y, oxennet_5y, oxennet_10y"
: "lookup types are session, oxennet");
txtype == lns_tx_type::update ? "update types are: session, lokinet" :
txtype == lns_tx_type::renew ? "renew types are: lokinet_1y, lokinet_2y, lokinet_5y, lokinet_10y" :
txtype == lns_tx_type::buy ? "buy types are session, lokinet_1y, lokinet_2y, lokinet_5y, lokinet_10y"
: "lookup types are session, lokinet");
return false;
}
@ -1383,7 +1383,7 @@ bool mapping_value::decrypt(std::string_view name, mapping_type type, const cryp
{
switch(type) {
case mapping_type::session: dec_length = SESSION_PUBLIC_KEY_BINARY_LENGTH; break;
case mapping_type::oxennet: dec_length = OXENNET_ADDRESS_BINARY_LENGTH; break;
case mapping_type::lokinet: dec_length = LOKINET_ADDRESS_BINARY_LENGTH; break;
case mapping_type::wallet: dec_length = WALLET_ACCOUNT_BINARY_LENGTH; break;
default: MERROR("Invalid mapping_type passed to mapping_value::decrypt"); return false;
}

View File

@ -28,9 +28,9 @@ namespace lns
constexpr size_t WALLET_NAME_MAX = 97; // mainnet addresses are 95 but testnet/devnet are 97
constexpr size_t WALLET_ACCOUNT_BINARY_LENGTH = 2 * sizeof(crypto::public_key);
constexpr size_t OXENNET_DOMAIN_NAME_MAX = 63 + 5; // DNS components name must be at most 63 (+ 5 for .oxen); this limit applies if there is at least one hyphen (and thus includes punycode)
constexpr size_t OXENNET_DOMAIN_NAME_MAX_NOHYPHEN = 32 + 5; // If the name does not contain a - then we restrict it to 32 characters so that it cannot be (and is obviously not) an encoded .oxen address (52 characters)
constexpr size_t OXENNET_ADDRESS_BINARY_LENGTH = sizeof(crypto::ed25519_public_key);
constexpr size_t LOKINET_DOMAIN_NAME_MAX = 63 + 5; // DNS components name must be at most 63 (+ 5 for .oxen); this limit applies if there is at least one hyphen (and thus includes punycode)
constexpr size_t LOKINET_DOMAIN_NAME_MAX_NOHYPHEN = 32 + 5; // If the name does not contain a - then we restrict it to 32 characters so that it cannot be (and is obviously not) an encoded .oxen address (52 characters)
constexpr size_t LOKINET_ADDRESS_BINARY_LENGTH = sizeof(crypto::ed25519_public_key);
constexpr size_t SESSION_DISPLAY_NAME_MAX = 64;
constexpr size_t SESSION_PUBLIC_KEY_BINARY_LENGTH = 1 + sizeof(crypto::ed25519_public_key); // Session keys at prefixed with 0x05 + ed25519 key
@ -42,7 +42,7 @@ constexpr size_t SODIUM_ENCRYPTION_EXTRA_BYTES = 40; // crypto_aead_xchacha20pol
struct mapping_value
{
static size_t constexpr BUFFER_SIZE = std::max({WALLET_ACCOUNT_BINARY_LENGTH, OXENNET_ADDRESS_BINARY_LENGTH, SESSION_PUBLIC_KEY_BINARY_LENGTH}) + SODIUM_ENCRYPTION_EXTRA_BYTES;
static size_t constexpr BUFFER_SIZE = std::max({WALLET_ACCOUNT_BINARY_LENGTH, LOKINET_ADDRESS_BINARY_LENGTH, SESSION_PUBLIC_KEY_BINARY_LENGTH}) + SODIUM_ENCRYPTION_EXTRA_BYTES;
std::array<uint8_t, BUFFER_SIZE> buffer;
bool encrypted;
size_t len;
@ -96,7 +96,7 @@ struct mapping_value
// Validate a human readable mapping value representation in 'value' and write the binary form into 'blob'.
// value: if type is session, 66 character hex string of an ed25519 public key (with 05 prefix)
// oxennet, 52 character base32z string of an ed25519 public key
// lokinet, 52 character base32z string of an ed25519 public key
// wallet, the wallet public address string
// blob: (optional) if function returns true, validate will load the binary data into blob (ready for encryption via encrypt())
static bool validate(cryptonote::network_type nettype, mapping_type type, std::string_view value, mapping_value *blob = nullptr, std::string *reason = nullptr);
@ -110,10 +110,10 @@ inline std::string_view mapping_type_str(mapping_type type)
{
switch(type)
{
case mapping_type::oxennet: return "oxennet"sv; // general type stored in the database; 1 year when in a purchase tx
case mapping_type::oxennet_2years: return "oxennet_2years"sv; // Only used in a buy tx, not in the DB
case mapping_type::oxennet_5years: return "oxennet_5years"sv; // "
case mapping_type::oxennet_10years: return "oxennet_10years"sv; // "
case mapping_type::lokinet: return "lokinet"sv; // general type stored in the database; 1 year when in a purchase tx
case mapping_type::lokinet_2years: return "lokinet_2years"sv; // Only used in a buy tx, not in the DB
case mapping_type::lokinet_5years: return "lokinet_5years"sv; // "
case mapping_type::lokinet_10years: return "lokinet_10years"sv; // "
case mapping_type::session: return "session"sv;
case mapping_type::wallet: return "wallet"sv;
default: assert(false); return "xx_unhandled_type"sv;
@ -123,22 +123,22 @@ inline std::ostream &operator<<(std::ostream &os, mapping_type type) { return os
constexpr bool mapping_type_allowed(uint8_t hf_version, mapping_type type) {
return (type == mapping_type::session && hf_version >= cryptonote::network_version_15_lns)
|| (is_oxennet_type(type) && hf_version >= cryptonote::network_version_16_pulse);
|| (is_lokinet_type(type) && hf_version >= cryptonote::network_version_16_pulse);
}
// Returns all mapping types supported for lookup as of the given hardfork. (Note that this does
// not return the dedicated length types such as mapping_type::oxennet_5years as those are only
// not return the dedicated length types such as mapping_type::lokinet_5years as those are only
// relevant within a LNS buy tx).
std::vector<mapping_type> all_mapping_types(uint8_t hf_version);
sqlite3 *init_oxen_name_system(const fs::path& file_path, bool read_only);
/// Returns the integer value used in the database and in RPC lookup calls for the given mapping
/// type. In particularly this maps all mapping_type::oxennet_Xyears values to the underlying value
/// of mapping_type::oxennet.
/// type. In particularly this maps all mapping_type::lokinet_Xyears values to the underlying value
/// of mapping_type::lokinet.
constexpr uint16_t db_mapping_type(lns::mapping_type type) {
if (is_oxennet_type(type))
return static_cast<uint16_t>(mapping_type::oxennet);
if (is_lokinet_type(type))
return static_cast<uint16_t>(mapping_type::lokinet);
return static_cast<uint16_t>(type);
}
@ -170,7 +170,7 @@ std::string tx_extra_signature(std::string_view value, generic_owner cons
enum struct lns_tx_type { lookup, buy, update, renew };
// Converts a human readable case-insensitive string denoting the mapping type into a value suitable for storing into the LNS DB.
// Currently accepts "session" or "oxennet" for lookups, buys, updates, and renewals; for buys and renewals also accepts "oxennet_Ny[ear]" for N=2,5,10
// Currently accepts "session" or "lokinet" for lookups, buys, updates, and renewals; for buys and renewals also accepts "lokinet_Ny[ear]" for N=2,5,10
// Lookups are implied by none of buy/update/renew.
// mapping_type: (optional) if function returns true, the uint16_t value of the 'type' will be set
bool validate_mapping_type(std::string_view type, uint8_t hf_version, lns_tx_type txtype, mapping_type *mapping_type, std::string *reason);

View File

@ -212,7 +212,7 @@ namespace service_nodes {
constexpr uint64_t VOTE_OR_TX_VERIFY_HEIGHT_BUFFER = 5;
constexpr std::array<int, 3> MIN_STORAGE_SERVER_VERSION{{2, 0, 7}};
constexpr std::array<int, 3> MIN_OXENNET_VERSION{{0, 8, 0}};
constexpr std::array<int, 3> MIN_LOKINET_VERSION{{0, 8, 0}};
// The minimum accepted version number, broadcasted by Service Nodes via uptime proofs for each hardfork
struct proof_version

View File

@ -561,11 +561,11 @@ bool rpc_command_executor::show_status() {
str << "NOT RECEIVED";
str << " (storage), ";
if (*ires.last_oxennet_ping > 0)
str << get_human_time_ago(*ires.last_oxennet_ping, time(nullptr), true /*abbreviate*/);
if (*ires.last_lokinet_ping > 0)
str << get_human_time_ago(*ires.last_lokinet_ping, time(nullptr), true /*abbreviate*/);
else
str << "NOT RECEIVED";
str << " (oxennet)";
str << " (lokinet)";
tools::success_msg_writer() << str.str();
}

View File

@ -80,10 +80,10 @@ struct extra_printer {
std::cout << "LNS " << (x.is_buying() ? "registration" : x.is_updating() ? "update" : "(unknown)");
switch (x.type)
{
case lns::mapping_type::oxennet: std::cout << " - Oxennet (1y)"; break;
case lns::mapping_type::oxennet_2years: std::cout << " - Oxennet (2y)"; break;
case lns::mapping_type::oxennet_5years: std::cout << " - Oxennet (5y)"; break;
case lns::mapping_type::oxennet_10years: std::cout << " - Oxennet (10y)"; break;
case lns::mapping_type::lokinet: std::cout << " - Lokinet (1y)"; break;
case lns::mapping_type::lokinet_2years: std::cout << " - Lokinet (2y)"; break;
case lns::mapping_type::lokinet_5years: std::cout << " - Lokinet (5y)"; break;
case lns::mapping_type::lokinet_10years: std::cout << " - Lokinet (10y)"; break;
case lns::mapping_type::session: std::cout << " - Session address"; break;
case lns::mapping_type::wallet: std::cout << " - Wallet address"; break;
case lns::mapping_type::update_record_internal:

View File

@ -63,17 +63,17 @@ enum struct mapping_type : uint16_t
{
session = 0,
wallet = 1,
oxennet = 2, // the type value stored in the database; counts as 1-year when used in a buy tx.
oxennet_2years,
oxennet_5years,
oxennet_10years,
lokinet = 2, // the type value stored in the database; counts as 1-year when used in a buy tx.
lokinet_2years,
lokinet_5years,
lokinet_10years,
_count,
update_record_internal,
};
constexpr bool is_oxennet_type(mapping_type t) { return t >= mapping_type::oxennet && t <= mapping_type::oxennet_10years; }
constexpr bool is_lokinet_type(mapping_type t) { return t >= mapping_type::lokinet && t <= mapping_type::lokinet_10years; }
// How many days we add per "year" of LNS oxennet registration. We slightly extend this to the 368
// How many days we add per "year" of LNS lokinet registration. We slightly extend this to the 368
// days per registration "year" to allow for some blockchain time drift + leap years.
constexpr uint64_t REGISTRATION_YEAR_DAYS = 368;
@ -81,7 +81,7 @@ constexpr uint64_t burn_needed(uint8_t hf_version, mapping_type type)
{
uint64_t result = 0;
// The base amount for session/wallet/oxennet-1year:
// The base amount for session/wallet/lokinet-1year:
const uint64_t basic_fee = (
hf_version >= 16 ? 15*COIN : // cryptonote::network_version_16_pulse -- but don't want to add cryptonote_config.h include
20*COIN // cryptonote::network_version_15_lns
@ -92,16 +92,16 @@ constexpr uint64_t burn_needed(uint8_t hf_version, mapping_type type)
result = 0;
break;
case mapping_type::oxennet: /* FALLTHRU */
case mapping_type::lokinet: /* FALLTHRU */
case mapping_type::session: /* FALLTHRU */
case mapping_type::wallet: /* FALLTHRU */
default:
result = basic_fee;
break;
case mapping_type::oxennet_2years: result = 2 * basic_fee; break;
case mapping_type::oxennet_5years: result = 4 * basic_fee; break;
case mapping_type::oxennet_10years: result = 6 * basic_fee; break;
case mapping_type::lokinet_2years: result = 2 * basic_fee; break;
case mapping_type::lokinet_5years: result = 4 * basic_fee; break;
case mapping_type::lokinet_10years: result = 6 * basic_fee; break;
}
return result;
}

View File

@ -420,7 +420,7 @@ namespace cryptonote { namespace rpc {
res.service_node = m_core.service_node();
res.start_time = (uint64_t)m_core.get_start_time();
res.last_storage_server_ping = (uint64_t)m_core.m_last_storage_server_ping;
res.last_oxennet_ping = (uint64_t)m_core.m_last_oxennet_ping;
res.last_lokinet_ping = (uint64_t)m_core.m_last_lokinet_ping;
res.free_space = m_core.get_free_space();
res.height_without_bootstrap = res.height;
std::shared_lock lock{m_bootstrap_daemon_mutex};
@ -779,10 +779,10 @@ namespace cryptonote { namespace rpc {
lns.blocks = lns::expiry_blocks(nettype, x.type);
switch (x.type)
{
case lns::mapping_type::oxennet: [[fallthrough]];
case lns::mapping_type::oxennet_2years: [[fallthrough]];
case lns::mapping_type::oxennet_5years: [[fallthrough]];
case lns::mapping_type::oxennet_10years: lns.type = "oxennet"; break;
case lns::mapping_type::lokinet: [[fallthrough]];
case lns::mapping_type::lokinet_2years: [[fallthrough]];
case lns::mapping_type::lokinet_5years: [[fallthrough]];
case lns::mapping_type::lokinet_10years: lns.type = "lokinet"; break;
case lns::mapping_type::session: lns.type = "session"; break;
case lns::mapping_type::wallet: lns.type = "wallet"; break;
@ -3306,11 +3306,11 @@ namespace cryptonote { namespace rpc {
});
}
//------------------------------------------------------------------------------------------------------------------------------
OXENNET_PING::response core_rpc_server::invoke(OXENNET_PING::request&& req, rpc_context context)
LOKINET_PING::response core_rpc_server::invoke(LOKINET_PING::request&& req, rpc_context context)
{
return handle_ping<OXENNET_PING>(
req.version, service_nodes::MIN_OXENNET_VERSION,
"Oxennet", m_core.m_last_oxennet_ping, OXENNET_PING_LIFETIME,
return handle_ping<LOKINET_PING>(
req.version, service_nodes::MIN_LOKINET_VERSION,
"Lokinet", m_core.m_last_lokinet_ping, LOKINET_PING_LIFETIME,
[this](bool significant) { if (significant) m_core.reset_proof_interval(); });
}
//------------------------------------------------------------------------------------------------------------------------------
@ -3534,7 +3534,7 @@ namespace cryptonote { namespace rpc {
{
types.push_back(static_cast<lns::mapping_type>(type));
if (!lns::mapping_type_allowed(hf_version, types.back()))
throw rpc_error{ERROR_WRONG_PARAM, "Invalid oxennet type '" + std::to_string(type) + "'"};
throw rpc_error{ERROR_WRONG_PARAM, "Invalid lokinet type '" + std::to_string(type) + "'"};
}
// This also takes 32 raw bytes, but that is undocumented (because it is painful to pass
@ -3634,7 +3634,7 @@ namespace cryptonote { namespace rpc {
uint8_t hf_version = m_core.get_hard_fork_version(m_core.get_current_blockchain_height());
auto type = static_cast<lns::mapping_type>(req.type);
if (!lns::mapping_type_allowed(hf_version, type))
throw rpc_error{ERROR_WRONG_PARAM, "Invalid oxennet type '" + std::to_string(req.type) + "'"};
throw rpc_error{ERROR_WRONG_PARAM, "Invalid lokinet type '" + std::to_string(req.type) + "'"};
if (auto mapping = m_core.get_blockchain_storage().name_system_db().resolve(
type, *name_hash, m_core.get_current_blockchain_height()))

View File

@ -262,7 +262,7 @@ namespace cryptonote::rpc {
GET_STAKING_REQUIREMENT::response invoke(GET_STAKING_REQUIREMENT::request&& req, rpc_context context);
PERFORM_BLOCKCHAIN_TEST::response invoke(PERFORM_BLOCKCHAIN_TEST::request&& req, rpc_context context);
STORAGE_SERVER_PING::response invoke(STORAGE_SERVER_PING::request&& req, rpc_context context);
OXENNET_PING::response invoke(OXENNET_PING::request&& req, rpc_context context);
LOKINET_PING::response invoke(LOKINET_PING::request&& req, rpc_context context);
GET_CHECKPOINTS::response invoke(GET_CHECKPOINTS::request&& req, rpc_context context);
GET_SN_STATE_CHANGES::response invoke(GET_SN_STATE_CHANGES::request&& req, rpc_context context);
REPORT_PEER_SS_STATUS::response invoke(REPORT_PEER_SS_STATUS::request&& req, rpc_context context);

View File

@ -318,7 +318,7 @@ KV_SERIALIZE_MAP_CODE_BEGIN(GET_INFO::response)
KV_SERIALIZE(start_time)
KV_SERIALIZE(service_node)
KV_SERIALIZE(last_storage_server_ping)
KV_SERIALIZE(last_oxennet_ping)
KV_SERIALIZE(last_lokinet_ping)
KV_SERIALIZE(free_space)
KV_SERIALIZE(offline)
KV_SERIALIZE(untrusted)
@ -1216,7 +1216,7 @@ KV_SERIALIZE_MAP_CODE_BEGIN(STORAGE_SERVER_PING::request)
KV_SERIALIZE_MAP_CODE_END()
KV_SERIALIZE_MAP_CODE_BEGIN(OXENNET_PING::request)
KV_SERIALIZE_MAP_CODE_BEGIN(LOKINET_PING::request)
KV_SERIALIZE(version);
KV_SERIALIZE_MAP_CODE_END()

View File

@ -303,8 +303,8 @@ namespace rpc {
std::optional<bool> buy; // Provided and true iff this is an LNS buy record
std::optional<bool> update; // Provided and true iff this is an LNS record update
std::optional<bool> renew; // Provided and true iff this is an LNS record renewal
std::string type; // The LNS request type. For registrations: "oxennet", "session", "wallet"; for a record update: "update"
std::optional<uint64_t> blocks; // The registration length in blocks (only applies to oxennet registrations; session/wallet registrations do not expire)
std::string type; // The LNS request type. For registrations: "lokinet", "session", "wallet"; for a record update: "update"
std::optional<uint64_t> blocks; // The registration length in blocks (only applies to lokinet registrations; session/wallet registrations do not expire)
std::string name_hash; // The hashed name of the record being purchased/updated, in hex (the actual name is not provided on the blockchain).
std::optional<std::string> prev_txid; // For an update, this points at the txid of the previous lns update transaction.
std::optional<std::string> value; // The encrypted value of the record, in hex. Note that this is encrypted using the actual name itself (*not* the hashed name).
@ -641,7 +641,7 @@ namespace rpc {
std::optional<bool> service_node; // Will be true if the node is running in --service-node mode.
std::optional<uint64_t> start_time; // Start time of the daemon, as UNIX time.
std::optional<uint64_t> last_storage_server_ping; // Last ping time of the storage server (0 if never or not running as a service node)
std::optional<uint64_t> last_oxennet_ping; // Last ping time of oxennet (0 if never or not running as a service node)
std::optional<uint64_t> last_lokinet_ping; // Last ping time of lokinet (0 if never or not running as a service node)
std::optional<uint64_t> free_space; // Available disk space on the node.
bool offline; // States if the node is offline (`true`) or online (`false`).
bool untrusted; // States if the result is obtained using the bootstrap mode, and is therefore not trusted (`true`), or when the daemon is fully synced (`false`).
@ -2192,9 +2192,9 @@ namespace rpc {
};
OXEN_RPC_DOC_INTROSPECT
struct OXENNET_PING : RPC_COMMAND
struct LOKINET_PING : RPC_COMMAND
{
static constexpr auto names() { return NAMES("oxennet_ping"); }
static constexpr auto names() { return NAMES("lokinet_ping"); }
struct request
{
@ -2433,7 +2433,7 @@ namespace rpc {
struct request_entry
{
std::string name_hash; // The 32-byte BLAKE2b hash of the name to resolve to a public key via Loki Name Service. The value must be provided either in hex (64 hex digits) or base64 (44 characters with padding, or 43 characters without).
std::vector<uint16_t> types; // If empty, query all types. Currently supported types are 0 (session) and 2 (oxennet). In future updates more mapping types will be available.
std::vector<uint16_t> types; // If empty, query all types. Currently supported types are 0 (session) and 2 (lokinet). In future updates more mapping types will be available.
KV_MAP_SERIALIZABLE
};
@ -2449,7 +2449,7 @@ namespace rpc {
struct response_entry
{
uint64_t entry_index; // The index in request_entry's `entries` array that was resolved via Loki Name Service.
lns::mapping_type type; // The type of Loki Name Service entry that the owner owns: currently supported values are 0 (session), 2 (oxennet)
lns::mapping_type type; // The type of Loki Name Service entry that the owner owns: currently supported values are 0 (session), 2 (lokinet)
std::string name_hash; // The hash of the name that was queried, in base64
std::string owner; // The public key that purchased the Loki Name Service entry.
std::optional<std::string> backup_owner; // The backup public key that the owner specified when purchasing the Loki Name Service entry. Omitted if no backup owner.
@ -2535,7 +2535,7 @@ namespace rpc {
struct request
{
uint16_t type; // The LNS type (mandatory); currently supported values are: 0 = session, 2 = oxennet.
uint16_t type; // The LNS type (mandatory); currently supported values are: 0 = session, 2 = lokinet.
std::string name_hash; // The 32-byte BLAKE2b hash of the name to look up, encoded as 64 hex digits or 44/43 base64 characters (with/without padding).
KV_MAP_SERIALIZABLE
@ -2640,7 +2640,7 @@ namespace rpc {
GET_SERVICE_NODES,
GET_SERVICE_NODE_STATUS,
STORAGE_SERVER_PING,
OXENNET_PING,
LOKINET_PING,
GET_STAKING_REQUIREMENT,
GET_SERVICE_NODE_BLACKLISTED_KEY_IMAGES,
GET_OUTPUT_BLACKLIST,

View File

@ -255,14 +255,14 @@ namespace
const char* USAGE_REQUEST_STAKE_UNLOCK("request_stake_unlock <service_node_pubkey>");
const char* USAGE_PRINT_LOCKED_STAKES("print_locked_stakes");
const char* USAGE_LNS_BUY_MAPPING("lns_buy_mapping [index=<N1>[,<N2>,...]] [<priority>] [type=session|oxennet|oxennet_2y|oxennet_5y|oxennet_10y] [owner=<value>] [backup_owner=<value>] <name> <value>");
const char* USAGE_LNS_RENEW_MAPPING("lns_renew_mapping [index=<N1>[,<N2>,...]] [<priority>] [type=oxennet|oxennet_2y|oxennet_5y|oxennet_10y] <name>");
const char* USAGE_LNS_UPDATE_MAPPING("lns_update_mapping [index=<N1>[,<N2>,...]] [<priority>] [type=session|oxennet] [owner=<value>] [backup_owner=<value>] [value=<lns_value>] [signature=<hex_signature>] <name>");
const char* USAGE_LNS_BUY_MAPPING("lns_buy_mapping [index=<N1>[,<N2>,...]] [<priority>] [type=session|lokinet|lokinet_2y|lokinet_5y|lokinet_10y] [owner=<value>] [backup_owner=<value>] <name> <value>");
const char* USAGE_LNS_RENEW_MAPPING("lns_renew_mapping [index=<N1>[,<N2>,...]] [<priority>] [type=lokinet|lokinet_2y|lokinet_5y|lokinet_10y] <name>");
const char* USAGE_LNS_UPDATE_MAPPING("lns_update_mapping [index=<N1>[,<N2>,...]] [<priority>] [type=session|lokinet] [owner=<value>] [backup_owner=<value>] [value=<lns_value>] [signature=<hex_signature>] <name>");
const char* USAGE_LNS_ENCRYPT("lns_encrypt [type=session|oxennet] <name> <value>");
const char* USAGE_LNS_MAKE_UPDATE_MAPPING_SIGNATURE("lns_make_update_mapping_signature [type=session|oxennet] [owner=<value>] [backup_owner=<value>] [value=<encrypted_lns_value>] <name>");
const char* USAGE_LNS_ENCRYPT("lns_encrypt [type=session|lokinet] <name> <value>");
const char* USAGE_LNS_MAKE_UPDATE_MAPPING_SIGNATURE("lns_make_update_mapping_signature [type=session|lokinet] [owner=<value>] [backup_owner=<value>] [value=<encrypted_lns_value>] <name>");
const char* USAGE_LNS_PRINT_OWNERS_TO_NAMES("lns_print_owners_to_names [<owner> ...]");
const char* USAGE_LNS_PRINT_NAME_TO_OWNERS("lns_print_name_to_owners [type=session|oxennet] <name> [<name> ...]");
const char* USAGE_LNS_PRINT_NAME_TO_OWNERS("lns_print_name_to_owners [type=session|lokinet] <name> [<name> ...]");
#if defined (OXEN_ENABLE_INTEGRATION_TEST_HOOKS)
std::string input_line(const std::string &prompt, bool yesno = false)
@ -6430,7 +6430,7 @@ static std::optional<lns::mapping_type> guess_lns_type(tools::wallet2& wallet, s
if (typestr.empty())
{
if (tools::ends_with(name, ".oxen") && (tools::ends_with(value, ".oxen") || value.empty()))
return lns::mapping_type::oxennet;
return lns::mapping_type::lokinet;
if (!tools::ends_with(name, ".oxen") && tools::starts_with(value, "05") && value.length() == 2*lns::SESSION_PUBLIC_KEY_BINARY_LENGTH)
return lns::mapping_type::session;
@ -6511,13 +6511,13 @@ bool simple_wallet::lns_buy_mapping(std::vector<std::string> args)
std::cout << std::endl << tr("Buying Oxen Name System Record") << std::endl << std::endl;
if (*type == lns::mapping_type::session)
std::cout << boost::format(tr("Session Name: %s")) % name << std::endl;
else if (lns::is_oxennet_type(*type))
else if (lns::is_lokinet_type(*type))
{
std::cout << boost::format(tr("Oxennet Name: %s")) % name << std::endl;
std::cout << boost::format(tr("Lokinet Name: %s")) % name << std::endl;
int years =
*type == lns::mapping_type::oxennet_10years ? 10 :
*type == lns::mapping_type::oxennet_5years ? 5 :
*type == lns::mapping_type::oxennet_2years ? 2 :
*type == lns::mapping_type::lokinet_10years ? 10 :
*type == lns::mapping_type::lokinet_5years ? 5 :
*type == lns::mapping_type::lokinet_2years ? 2 :
1;
int blocks = BLOCKS_EXPECTED_IN_DAYS(years * lns::REGISTRATION_YEAR_DAYS);
std::cout << boost::format(tr("Registration: %d years (%d blocks)")) % years % blocks << "\n";
@ -6605,15 +6605,15 @@ bool simple_wallet::lns_renew_mapping(std::vector<std::string> args)
dsts.push_back(info);
std::cout << "\n" << tr("Renew Oxen Name System Record") << "\n\n";
if (lns::is_oxennet_type(type))
std::cout << boost::format(tr("Oxennet Name: %s")) % name << "\n";
if (lns::is_lokinet_type(type))
std::cout << boost::format(tr("Lokinet Name: %s")) % name << "\n";
else
std::cout << boost::format(tr("Name: %s")) % name << "\n";
int years = 1;
if (type == lns::mapping_type::oxennet_2years) years = 2;
else if (type == lns::mapping_type::oxennet_5years) years = 5;
else if (type == lns::mapping_type::oxennet_10years) years = 10;
if (type == lns::mapping_type::lokinet_2years) years = 2;
else if (type == lns::mapping_type::lokinet_5years) years = 5;
else if (type == lns::mapping_type::lokinet_10years) years = 10;
int blocks = BLOCKS_EXPECTED_IN_DAYS(years * lns::REGISTRATION_YEAR_DAYS);
std::cout << boost::format(tr("Renewal years: %d (%d blocks)")) % years % blocks << "\n";
std::cout << boost::format(tr("New expiry: Block %d")) % (*response[0].expiration_height + blocks) << "\n";
@ -6711,8 +6711,8 @@ bool simple_wallet::lns_update_mapping(std::vector<std::string> args)
std::cout << std::endl << tr("Updating Oxen Name System Record") << std::endl << std::endl;
if (type == lns::mapping_type::session)
std::cout << boost::format(tr("Session Name: %s")) % name << std::endl;
else if (lns::is_oxennet_type(type))
std::cout << boost::format(tr("Oxennet Name: %s")) % name << std::endl;
else if (lns::is_lokinet_type(type))
std::cout << boost::format(tr("Lokinet Name: %s")) % name << std::endl;
else
std::cout << boost::format(tr("Name: %s")) % name << std::endl;

View File

@ -1401,7 +1401,7 @@ private:
// The signature is derived from the hash of the previous txid blob and previous value blob of the mapping. By default this is signed using the wallet's spend key as an ed25519 keypair.
std::vector<pending_tx> lns_create_update_mapping_tx(lns::mapping_type type, std::string name, std::string const *value, std::string const *owner, std::string const *backup_owner, std::string const *signature, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {}, std::vector<cryptonote::rpc::LNS_NAMES_TO_OWNERS::response_entry> *response = {});
// LNS renewal (for oxennet registrations, not for session/wallet)
// LNS renewal (for lokinet registrations, not for session/wallet)
std::vector<pending_tx> lns_create_renewal_tx(lns::mapping_type type, std::string name, std::string *reason, uint32_t priority = 0, uint32_t account_index = 0, std::set<uint32_t> subaddr_indices = {}, std::vector<cryptonote::rpc::LNS_NAMES_TO_OWNERS::response_entry> *response = {});
// Generate just the signature required for putting into lns_update_mapping command in the wallet

View File

@ -3231,8 +3231,8 @@ namespace {
{
auto& entry = res.known_names.emplace_back();
auto& type = entry_types.emplace_back(details.type);
if (type > lns::mapping_type::oxennet && type <= lns::mapping_type::oxennet_10years)
type = lns::mapping_type::oxennet;
if (type > lns::mapping_type::lokinet && type <= lns::mapping_type::lokinet_10years)
type = lns::mapping_type::lokinet;
entry.type = lns::mapping_type_str(type);
entry.hashed = details.hashed_name;
entry.name = details.name;

View File

@ -2186,7 +2186,7 @@ namespace tools::wallet_rpc {
static constexpr const char *description =
R"(Buy a Loki Name System (LNS) mapping that maps a unique name to a Session ID or Lokinet address.
Currently supports Session and Lokinet registrations. Lokinet registrations can be for 1, 2, 5, or 10 years by specifying a type value of "oxennet", "oxennet_2y", "oxennet_5y", "oxennet_10y". Session registrations do not expire.
Currently supports Session and Lokinet registrations. Lokinet registrations can be for 1, 2, 5, or 10 years by specifying a type value of "lokinet", "lokinet_2y", "lokinet_5y", "lokinet_10y". Session registrations do not expire.
The owner of the LNS entry (by default, the purchasing wallet) will be permitted to submit LNS update transactions to the Loki blockchain (for example to update a Session pubkey or the target Lokinet address). You may change the primary owner or add a backup owner in the registration and can change them later with update transactions. Owner addresses can be either Loki wallets, or generic ed25519 pubkeys (for advanced uses).
@ -2198,7 +2198,7 @@ For more information on updating and signing see the LNS_UPDATE_MAPPING document
struct request
{
std::string type; // The mapping type: "session", "oxennet", "oxennet_2y", "oxennet_5y", "oxennet_10y".
std::string type; // The mapping type: "session", "lokinet", "lokinet_2y", "lokinet_5y", "lokinet_10y".
std::string owner; // (Optional): The ed25519 public key or wallet address that has authority to update the mapping.
std::string backup_owner; // (Optional): The secondary, backup public key that has authority to update the mapping.
std::string name; // The name to purchase via Loki Name Service
@ -2231,19 +2231,19 @@ For more information on updating and signing see the LNS_UPDATE_MAPPING document
};
OXEN_RPC_DOC_INTROSPECT
// Renew an active oxennet LNS registration
// Renew an active lokinet LNS registration
struct LNS_RENEW_MAPPING : RESTRICTED
{
static constexpr auto names() { return NAMES("lns_renew_mapping"); }
static constexpr const char *description =
R"(Renews a Loki Name System oxennet mapping by adding to the existing expiry time.
R"(Renews a Loki Name System lokinet mapping by adding to the existing expiry time.
The renewal can be for 1, 2, 5, or 10 years by specifying a `type` value of "oxennet_2y", "oxennet_10y", etc.)";
The renewal can be for 1, 2, 5, or 10 years by specifying a `type` value of "lokinet_2y", "lokinet_10y", etc.)";
struct request
{
std::string type; // The mapping type, "oxennet" (1-year), or "oxennet_2y", "oxennet_5y", "oxennet_10y" for multi-year registrations.
std::string type; // The mapping type, "lokinet" (1-year), or "lokinet_2y", "lokinet_5y", "lokinet_10y" for multi-year registrations.
std::string name; // The name to update
uint32_t account_index; // (Optional) Transfer from this account index. (Defaults to 0)
@ -2277,7 +2277,7 @@ If signing is performed externally then you must first encrypt the `value` (if b
struct request
{
std::string type; // The mapping type, "session" or "oxennet".
std::string type; // The mapping type, "session" or "lokinet".
std::string name; // The name to update via Loki Name Service
std::string value; // (Optional): The new value that the name maps to via Loki Name Service. If not specified or given the empty string "", then the mapping's value remains unchanged. If using a `signature` then this value (if non-empty) must be already encrypted.
std::string owner; // (Optional): The new owner of the mapping. If not specified or given the empty string "", then the mapping's owner remains unchanged.
@ -2323,7 +2323,7 @@ This command is only required if the open wallet is one of the owners of a LNS r
struct request
{
std::string type; // The mapping type, currently we only support "session". In future "oxennet" and "blockchain" mappings will be available.
std::string type; // The mapping type, currently we only support "session". In future "lokinet" and "blockchain" mappings will be available.
std::string name; // The desired name to update via Loki Name Service
std::string encrypted_value; // (Optional): The new encrypted value that the name maps to via Loki Name Service. If not specified or given the empty string "", then the mapping's value remains unchanged.
std::string owner; // (Optional): The new owner of the mapping. If not specified or given the empty string "", then the mapping's owner remains unchanged.
@ -2349,7 +2349,7 @@ This command is only required if the open wallet is one of the owners of a LNS r
struct request
{
std::string type; // The mapping type, "session" or "oxennet".
std::string type; // The mapping type, "session" or "lokinet".
std::string name; // The desired name to hash
KV_MAP_SERIALIZABLE
@ -2373,7 +2373,7 @@ This command is only required if the open wallet is one of the owners of a LNS r
struct known_record
{
std::string type; // The mapping type, "session" or "oxennet".
std::string type; // The mapping type, "session" or "lokinet".
std::string hashed; // The hashed name (in base64)
std::string name; // The plaintext name
std::string owner; // The public key that purchased the Loki Name Service entry.
@ -2411,7 +2411,7 @@ This command is only required if the open wallet is one of the owners of a LNS r
struct record
{
std::string type; // The LNS type (mandatory); currently support values are: "session", "oxennet"
std::string type; // The LNS type (mandatory); currently support values are: "session", "lokinet"
std::string name; // The (unhashed) name of the record
KV_MAP_SERIALIZABLE
@ -2436,7 +2436,7 @@ This command is only required if the open wallet is one of the owners of a LNS r
struct request
{
std::string name; // The LNS name with which to encrypt the value.
std::string type; // The mapping type: "session" or "oxennet".
std::string type; // The mapping type: "session" or "lokinet".
std::string value; // The value to be encrypted.
KV_MAP_SERIALIZABLE
@ -2459,7 +2459,7 @@ This command is only required if the open wallet is one of the owners of a LNS r
struct request
{
std::string name; // The LNS name of the given encrypted value.
std::string type; // The mapping type: "session" or "oxennet".
std::string type; // The mapping type: "session" or "lokinet".
std::string encrypted_value; // The encrypted value represented in hex.
KV_MAP_SERIALIZABLE

View File

@ -1073,7 +1073,7 @@ struct lns_keys_t
{
lns::generic_owner owner;
lns::mapping_value wallet_value; // NOTE: this field is the binary (value) part of the name -> (value) mapping
lns::mapping_value oxennet_value;
lns::mapping_value lokinet_value;
lns::mapping_value session_value;
};
@ -1083,22 +1083,22 @@ static lns_keys_t make_lns_keys(cryptonote::account_base const &src)
result.owner = lns::make_monero_owner(src.get_keys().m_account_address, false /*is_subaddress*/);
result.session_value.len = lns::SESSION_PUBLIC_KEY_BINARY_LENGTH;
result.wallet_value.len = sizeof(src.get_keys().m_account_address);
result.oxennet_value.len = sizeof(result.owner.wallet.address.m_spend_public_key);
result.lokinet_value.len = sizeof(result.owner.wallet.address.m_spend_public_key);
memcpy(&result.session_value.buffer[0] + 1, &result.owner.wallet.address.m_spend_public_key, result.oxennet_value.len);
memcpy(&result.session_value.buffer[0] + 1, &result.owner.wallet.address.m_spend_public_key, result.lokinet_value.len);
memcpy(&result.wallet_value.buffer[0], (char *)&src.get_keys().m_account_address, result.wallet_value.len);
// NOTE: Just needs a 32 byte key. Reuse spend key
memcpy(&result.oxennet_value.buffer[0], (char *)&result.owner.wallet.address.m_spend_public_key, result.oxennet_value.len);
memcpy(&result.lokinet_value.buffer[0], (char *)&result.owner.wallet.address.m_spend_public_key, result.lokinet_value.len);
result.session_value.buffer[0] = 5; // prefix with 0x05
return result;
}
// Lokinet FAKECHAIN LNS expiry blocks
uint64_t oxennet_expiry(lns::mapping_type type) {
uint64_t lokinet_expiry(lns::mapping_type type) {
auto exp = lns::expiry_blocks(cryptonote::FAKECHAIN, type);
if (!exp) throw std::logic_error{"test suite bug: oxennet_expiry called with non-oxennet mapping type"};
if (!exp) throw std::logic_error{"test suite bug: lokinet_expiry called with non-lokinet mapping type"};
return *exp;
}
@ -1112,19 +1112,19 @@ bool oxen_name_system_expiration::generate(std::vector<test_event_entry> &events
gen.add_mined_money_unlock_blocks();
lns_keys_t miner_key = make_lns_keys(miner);
for (auto mapping_type = lns::mapping_type::oxennet;
mapping_type <= lns::mapping_type::oxennet_10years;
for (auto mapping_type = lns::mapping_type::lokinet;
mapping_type <= lns::mapping_type::lokinet_10years;
mapping_type = static_cast<lns::mapping_type>(static_cast<uint16_t>(mapping_type) + 1))
{
std::string const name = "mydomain.oxen";
if (lns::mapping_type_allowed(gen.hardfork(), mapping_type))
{
cryptonote::transaction tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), mapping_type, name, miner_key.oxennet_value);
cryptonote::transaction tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), mapping_type, name, miner_key.lokinet_value);
gen.create_and_add_next_block({tx});
crypto::hash tx_hash = cryptonote::get_transaction_hash(tx);
uint64_t height_of_lns_entry = gen.height();
uint64_t expected_expiry_block = height_of_lns_entry + oxennet_expiry(mapping_type);
uint64_t expected_expiry_block = height_of_lns_entry + lokinet_expiry(mapping_type);
std::string name_hash = lns::name_to_base64_hash(name);
oxen_register_callback(events, "check_lns_entries", [=](cryptonote::core &c, size_t ev_index)
@ -1139,7 +1139,7 @@ bool oxen_name_system_expiration::generate(std::vector<test_event_entry> &events
<< " == " << owner.address.to_string(cryptonote::FAKECHAIN));
lns::mapping_record record = lns_db.get_mapping(mapping_type, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, name, miner_key.oxennet_value, height_of_lns_entry, height_of_lns_entry + oxennet_expiry(mapping_type), tx_hash, miner_key.owner, {} /*backup_owner*/));
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, name, miner_key.lokinet_value, height_of_lns_entry, height_of_lns_entry + lokinet_expiry(mapping_type), tx_hash, miner_key.owner, {} /*backup_owner*/));
return true;
});
@ -1160,14 +1160,14 @@ bool oxen_name_system_expiration::generate(std::vector<test_event_entry> &events
<< " == " << owner.address.to_string(cryptonote::FAKECHAIN));
lns::mapping_record record = lns_db.get_mapping(mapping_type, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, name, miner_key.oxennet_value, height_of_lns_entry, height_of_lns_entry + oxennet_expiry(mapping_type), tx_hash, miner_key.owner, {} /*backup_owner*/));
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, name, miner_key.lokinet_value, height_of_lns_entry, height_of_lns_entry + lokinet_expiry(mapping_type), tx_hash, miner_key.owner, {} /*backup_owner*/));
CHECK_EQ(record.active(blockchain_height), false);
return true;
});
}
else
{
cryptonote::transaction tx = gen.create_oxen_name_system_tx(miner, gen.hardfork(), mapping_type, name, miner_key.oxennet_value);
cryptonote::transaction tx = gen.create_oxen_name_system_tx(miner, gen.hardfork(), mapping_type, name, miner_key.lokinet_value);
gen.add_tx(tx, false /*can_be_added_to_blockchain*/, "Can not add LNS TX that uses disallowed type");
}
}
@ -1213,20 +1213,20 @@ bool oxen_name_system_get_mappings_by_owner::generate(std::vector<test_event_ent
uint64_t session_height = gen.height();
// NOTE: Register some Lokinet names
std::string oxennet_name1 = "Lorem.oxen";
std::string oxennet_name_hash1 = "GsM6OUk5E5D9keBIK2PlA4kjwiPe+/UB0nUurjKvFJQ=";
std::string oxennet_name2 = "ipSum.oxen";
std::string oxennet_name_hash2 = "p8IYR3ZWr0KSU4ZPazYxTkwvXsm0dzq5dmour7VmIDY=";
crypto::hash oxennet_name1_txid = {}, oxennet_name2_txid = {};
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet))
std::string lokinet_name1 = "Lorem.oxen";
std::string lokinet_name_hash1 = "GsM6OUk5E5D9keBIK2PlA4kjwiPe+/UB0nUurjKvFJQ=";
std::string lokinet_name2 = "ipSum.oxen";
std::string lokinet_name_hash2 = "p8IYR3ZWr0KSU4ZPazYxTkwvXsm0dzq5dmour7VmIDY=";
crypto::hash lokinet_name1_txid = {}, lokinet_name2_txid = {};
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet))
{
cryptonote::transaction tx1 = gen.create_and_add_oxen_name_system_tx(bob, gen.hardfork(), lns::mapping_type::oxennet, oxennet_name1, bob_key.oxennet_value);
cryptonote::transaction tx2 = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::oxennet_5years, oxennet_name2, bob_key.oxennet_value, &bob_key.owner);
cryptonote::transaction tx1 = gen.create_and_add_oxen_name_system_tx(bob, gen.hardfork(), lns::mapping_type::lokinet, lokinet_name1, bob_key.lokinet_value);
cryptonote::transaction tx2 = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::lokinet_5years, lokinet_name2, bob_key.lokinet_value, &bob_key.owner);
gen.create_and_add_next_block({tx1, tx2});
oxennet_name1_txid = get_transaction_hash(tx1);
oxennet_name2_txid = get_transaction_hash(tx2);
lokinet_name1_txid = get_transaction_hash(tx1);
lokinet_name2_txid = get_transaction_hash(tx2);
}
uint64_t oxennet_height = gen.height();
uint64_t lokinet_height = gen.height();
// NOTE: Register some wallet names
std::string wallet_name1 = "Wallet1";
@ -1254,7 +1254,7 @@ bool oxen_name_system_get_mappings_by_owner::generate(std::vector<test_event_ent
size_t expected_size = 0;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::session)) expected_size += 2;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::wallet)) expected_size += 2;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::oxennet)) expected_size += 2;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::lokinet)) expected_size += 2;
CHECK_EQ(records.size(), expected_size);
std::sort(records.begin(), records.end(), [](const auto& a, const auto& b) {
@ -1270,12 +1270,12 @@ bool oxen_name_system_get_mappings_by_owner::generate(std::vector<test_event_ent
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, records[1], lns::mapping_type::session, session_name2, bob_key.session_value, session_height, std::nullopt, session_name2_txid, bob_key.owner, {} /*backup_owner*/));
}
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::lokinet))
{
CHECK_EQ(records[2].name_hash, oxennet_name_hash1);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, records[2], lns::mapping_type::oxennet, oxennet_name1, bob_key.oxennet_value, oxennet_height, oxennet_height + oxennet_expiry(lns::mapping_type::oxennet), oxennet_name1_txid, bob_key.owner, {} /*backup_owner*/));
CHECK_EQ(records[3].name_hash, oxennet_name_hash2);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, records[3], lns::mapping_type::oxennet, oxennet_name2, bob_key.oxennet_value, oxennet_height, oxennet_height + oxennet_expiry(lns::mapping_type::oxennet_5years), oxennet_name2_txid, bob_key.owner, {} /*backup_owner*/));
CHECK_EQ(records[2].name_hash, lokinet_name_hash1);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, records[2], lns::mapping_type::lokinet, lokinet_name1, bob_key.lokinet_value, lokinet_height, lokinet_height + lokinet_expiry(lns::mapping_type::lokinet), lokinet_name1_txid, bob_key.owner, {} /*backup_owner*/));
CHECK_EQ(records[3].name_hash, lokinet_name_hash2);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, records[3], lns::mapping_type::lokinet, lokinet_name2, bob_key.lokinet_value, lokinet_height, lokinet_height + lokinet_expiry(lns::mapping_type::lokinet_5years), lokinet_name2_txid, bob_key.owner, {} /*backup_owner*/));
}
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::wallet))
@ -1421,9 +1421,9 @@ bool oxen_name_system_handles_duplicate_in_lns_db::generate(std::vector<test_eve
lns_keys_t miner_key = make_lns_keys(miner);
lns_keys_t bob_key = make_lns_keys(bob);
std::string session_name = "myfriendlydisplayname.oxen";
std::string oxennet_name = session_name;
std::string lokinet_name = session_name;
auto custom_type = static_cast<lns::mapping_type>(3928);
crypto::hash session_tx_hash = {}, oxennet_tx_hash = {};
crypto::hash session_tx_hash = {}, lokinet_tx_hash = {};
{
// NOTE: Allow duplicates with the same name but different type
cryptonote::transaction bar = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::session, session_name, bob_key.session_value);
@ -1432,11 +1432,11 @@ bool oxen_name_system_handles_duplicate_in_lns_db::generate(std::vector<test_eve
std::vector<cryptonote::transaction> txs;
txs.push_back(bar);
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet))
{
cryptonote::transaction bar3 = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::oxennet_2years, session_name, miner_key.oxennet_value);
cryptonote::transaction bar3 = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::lokinet_2years, session_name, miner_key.lokinet_value);
txs.push_back(bar3);
oxennet_tx_hash = get_transaction_hash(bar3);
lokinet_tx_hash = get_transaction_hash(bar3);
}
gen.create_and_add_next_block(txs);
@ -1465,10 +1465,10 @@ bool oxen_name_system_handles_duplicate_in_lns_db::generate(std::vector<test_eve
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record1, lns::mapping_type::session, session_name, bob_key.session_value, height_of_lns_entry, std::nullopt, session_tx_hash, miner_key.owner, {} /*backup_owner*/));
CHECK_EQ(record1.owner_id, owner.id);
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::lokinet))
{
lns::mapping_record record2 = lns_db.get_mapping(lns::mapping_type::oxennet, session_name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record2, lns::mapping_type::oxennet, oxennet_name, miner_key.oxennet_value, height_of_lns_entry, height_of_lns_entry + oxennet_expiry(lns::mapping_type::oxennet_2years), oxennet_tx_hash, miner_key.owner, {} /*backup_owner*/));
lns::mapping_record record2 = lns_db.get_mapping(lns::mapping_type::lokinet, session_name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record2, lns::mapping_type::lokinet, lokinet_name, miner_key.lokinet_value, height_of_lns_entry, height_of_lns_entry + lokinet_expiry(lns::mapping_type::lokinet_2years), lokinet_tx_hash, miner_key.owner, {} /*backup_owner*/));
CHECK_EQ(record2.owner_id, owner.id);
CHECK_EQ(record2.active(blockchain_height), true);
}
@ -1586,21 +1586,21 @@ bool oxen_name_system_invalid_tx_extra_params::generate(std::vector<test_event_e
}
}
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet))
{
valid_data.type = lns::mapping_type::oxennet;
valid_data.type = lns::mapping_type::lokinet;
// Lokinet name empty
{
cryptonote::tx_extra_oxen_name_system data = valid_data;
data.name_hash = {};
data.encrypted_value = miner_key.oxennet_value.make_encrypted("").to_string();
data.encrypted_value = miner_key.lokinet_value.make_encrypted("").to_string();
make_lns_tx_with_custom_extra(gen, events, miner, data, false, "(Lokinet) Empty domain name in LNS is invalid");
}
// Lokinet value too short
{
cryptonote::tx_extra_oxen_name_system data = valid_data;
data.encrypted_value = miner_key.oxennet_value.make_encrypted(name).to_string();
data.encrypted_value = miner_key.lokinet_value.make_encrypted(name).to_string();
data.encrypted_value.resize(data.encrypted_value.size() - 1);
make_lns_tx_with_custom_extra(gen, events, miner, data, false, "(Lokinet) Domain value in LNS too long");
}
@ -1608,7 +1608,7 @@ bool oxen_name_system_invalid_tx_extra_params::generate(std::vector<test_event_e
// Lokinet value too long
{
cryptonote::tx_extra_oxen_name_system data = valid_data;
data.encrypted_value = miner_key.oxennet_value.make_encrypted(name).to_string();
data.encrypted_value = miner_key.lokinet_value.make_encrypted(name).to_string();
data.encrypted_value.resize(data.encrypted_value.size() + 1);
make_lns_tx_with_custom_extra(gen, events, miner, data, false, "(Lokinet) Domain value in LNS too long");
}
@ -1665,10 +1665,10 @@ bool oxen_name_system_large_reorg::generate(std::vector<test_event_entry> &event
// NOTE: Generate the first round of LNS transactions belonging to miner
uint64_t first_lns_height = 0;
std::string const oxennet_name1 = "website.oxen";
std::string const lokinet_name1 = "website.oxen";
std::string const wallet_name1 = "MyWallet";
std::string const session_name1 = "I-Like-Loki";
crypto::hash session_tx_hash1 = {}, wallet_tx_hash1 = {}, oxennet_tx_hash1 = {};
crypto::hash session_tx_hash1 = {}, wallet_tx_hash1 = {}, lokinet_tx_hash1 = {};
{
// NOTE: Generate and add the (transactions + block) to the blockchain
{
@ -1684,11 +1684,11 @@ bool oxen_name_system_large_reorg::generate(std::vector<test_event_entry> &event
wallet_tx_hash1 = get_transaction_hash(wallet_tx);
}
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet_10years))
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet_10years))
{
cryptonote::transaction oxennet_tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::oxennet_10years, oxennet_name1, miner_key.oxennet_value);
txs.push_back(oxennet_tx);
oxennet_tx_hash1 = get_transaction_hash(oxennet_tx);
cryptonote::transaction lokinet_tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::lokinet_10years, lokinet_name1, miner_key.lokinet_value);
txs.push_back(lokinet_tx);
lokinet_tx_hash1 = get_transaction_hash(lokinet_tx);
}
gen.create_and_add_next_block(txs);
}
@ -1703,15 +1703,15 @@ bool oxen_name_system_large_reorg::generate(std::vector<test_event_entry> &event
size_t expected_size = 1;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::wallet)) expected_size += 1;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::oxennet)) expected_size += 1;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::lokinet)) expected_size += 1;
CHECK_EQ(records.size(), expected_size);
for (lns::mapping_record const &record : records)
{
if (record.type == lns::mapping_type::session)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::session, session_name1, miner_key.session_value, first_lns_height, std::nullopt, session_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::oxennet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, oxennet_name1, miner_key.oxennet_value, first_lns_height, first_lns_height + oxennet_expiry(lns::mapping_type::oxennet_10years), oxennet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::lokinet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, lokinet_name1, miner_key.lokinet_value, first_lns_height, first_lns_height + lokinet_expiry(lns::mapping_type::lokinet_10years), lokinet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::wallet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::wallet, wallet_name1, miner_key.wallet_value, first_lns_height, std::nullopt, wallet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else
@ -1723,22 +1723,22 @@ bool oxen_name_system_large_reorg::generate(std::vector<test_event_entry> &event
});
}
// NOTE: Generate and add the second round of (transactions + block) to the blockchain, renew oxennet and add bob's session, update miner's session value to other's session value
// NOTE: Generate and add the second round of (transactions + block) to the blockchain, renew lokinet and add bob's session, update miner's session value to other's session value
cryptonote::account_base const other = gen.add_account();
lns_keys_t const other_key = make_lns_keys(other);
uint64_t second_lns_height = 0;
{
std::string const bob_session_name1 = "I-Like-Session";
crypto::hash session_tx_hash2 = {}, oxennet_tx_hash2 = {}, session_tx_hash3;
crypto::hash session_tx_hash2 = {}, lokinet_tx_hash2 = {}, session_tx_hash3;
{
std::vector<cryptonote::transaction> txs;
txs.push_back(gen.create_and_add_oxen_name_system_tx(bob, gen.hardfork(), lns::mapping_type::session, bob_session_name1, bob_key.session_value));
session_tx_hash2 = cryptonote::get_transaction_hash(txs[0]);
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet))
{
txs.push_back(gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::oxennet_5years, oxennet_name1));
oxennet_tx_hash2 = cryptonote::get_transaction_hash(txs.back());
txs.push_back(gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::lokinet_5years, lokinet_name1));
lokinet_tx_hash2 = cryptonote::get_transaction_hash(txs.back());
}
txs.push_back(gen.create_and_add_oxen_name_system_tx_update(miner, gen.hardfork(), lns::mapping_type::session, session_name1, &other_key.session_value));
@ -1761,8 +1761,8 @@ bool oxen_name_system_large_reorg::generate(std::vector<test_event_entry> &event
{
if (record.type == lns::mapping_type::session)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::session, session_name1, other_key.session_value, second_lns_height, std::nullopt, session_tx_hash3, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::oxennet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, oxennet_name1, miner_key.oxennet_value, second_lns_height, first_lns_height + oxennet_expiry(lns::mapping_type::oxennet_5years) + oxennet_expiry(lns::mapping_type::oxennet_10years), oxennet_tx_hash2, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::lokinet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, lokinet_name1, miner_key.lokinet_value, second_lns_height, first_lns_height + lokinet_expiry(lns::mapping_type::lokinet_5years) + lokinet_expiry(lns::mapping_type::lokinet_10years), lokinet_tx_hash2, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::wallet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::wallet, wallet_name1, miner_key.wallet_value, first_lns_height, std::nullopt, wallet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else
@ -1809,15 +1809,15 @@ bool oxen_name_system_large_reorg::generate(std::vector<test_event_entry> &event
std::vector<lns::mapping_record> records = lns_db.get_mappings_by_owner(miner_key.owner);
size_t expected_size = 1;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::wallet)) expected_size += 1;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::oxennet)) expected_size += 1;
if (lns::mapping_type_allowed(c.get_blockchain_storage().get_current_hard_fork_version(), lns::mapping_type::lokinet)) expected_size += 1;
CHECK_EQ(records.size(), expected_size);
for (lns::mapping_record const &record : records)
{
if (record.type == lns::mapping_type::session)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::session, session_name1, miner_key.session_value, first_lns_height, std::nullopt, session_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::oxennet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, oxennet_name1, miner_key.oxennet_value, first_lns_height, first_lns_height + oxennet_expiry(lns::mapping_type::oxennet_10years), oxennet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::lokinet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, lokinet_name1, miner_key.lokinet_value, first_lns_height, first_lns_height + lokinet_expiry(lns::mapping_type::lokinet_10years), lokinet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else if (record.type == lns::mapping_type::wallet)
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::wallet, wallet_name1, miner_key.wallet_value, first_lns_height, std::nullopt, wallet_tx_hash1, miner_key.owner, {} /*backup_owner*/));
else
@ -1861,7 +1861,7 @@ bool oxen_name_system_name_renewal::generate(std::vector<test_event_entry> &even
oxen_chain_generator gen(events, hard_forks);
cryptonote::account_base miner = gen.first_miner_;
if (!lns::mapping_type_allowed(hard_forks.back().first, lns::mapping_type::oxennet))
if (!lns::mapping_type_allowed(hard_forks.back().first, lns::mapping_type::lokinet))
return true;
{
@ -1871,7 +1871,7 @@ bool oxen_name_system_name_renewal::generate(std::vector<test_event_entry> &even
lns_keys_t miner_key = make_lns_keys(miner);
std::string const name = "mydomain.oxen";
cryptonote::transaction tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::oxennet, name, miner_key.oxennet_value);
cryptonote::transaction tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::lokinet, name, miner_key.lokinet_value);
gen.create_and_add_next_block({tx});
crypto::hash prev_txid = get_transaction_hash(tx);
@ -1890,21 +1890,21 @@ bool oxen_name_system_name_renewal::generate(std::vector<test_event_entry> &even
<< " == " << owner.address.to_string(cryptonote::FAKECHAIN));
std::string name_hash = lns::name_to_base64_hash(name);
lns::mapping_record record = lns_db.get_mapping(lns::mapping_type::oxennet, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, name, miner_key.oxennet_value, height_of_lns_entry, height_of_lns_entry + oxennet_expiry(lns::mapping_type::oxennet), prev_txid, miner_key.owner, {} /*backup_owner*/));
lns::mapping_record record = lns_db.get_mapping(lns::mapping_type::lokinet, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, name, miner_key.lokinet_value, height_of_lns_entry, height_of_lns_entry + lokinet_expiry(lns::mapping_type::lokinet), prev_txid, miner_key.owner, {} /*backup_owner*/));
return true;
});
gen.create_and_add_next_block();
// Renew the oxennet entry a few times
cryptonote::transaction renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::oxennet_5years, name);
// Renew the lokinet entry a few times
cryptonote::transaction renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::lokinet_5years, name);
gen.create_and_add_next_block({renew_tx});
renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::oxennet_10years, name);
renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::lokinet_10years, name);
gen.create_and_add_next_block({renew_tx});
renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::oxennet_2years, name);
renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::lokinet_2years, name);
gen.create_and_add_next_block({renew_tx});
renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::oxennet, name);
renew_tx = gen.create_and_add_oxen_name_system_tx_renew(miner, gen.hardfork(), lns::mapping_type::lokinet, name);
gen.create_and_add_next_block({renew_tx});
crypto::hash txid = cryptonote::get_transaction_hash(renew_tx);
uint64_t renewal_height = gen.height();
@ -1922,15 +1922,15 @@ bool oxen_name_system_name_renewal::generate(std::vector<test_event_entry> &even
<< " == " << owner.address.to_string(cryptonote::FAKECHAIN));
std::string name_hash = lns::name_to_base64_hash(name);
lns::mapping_record record = lns_db.get_mapping(lns::mapping_type::oxennet, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, name, miner_key.oxennet_value, renewal_height,
lns::mapping_record record = lns_db.get_mapping(lns::mapping_type::lokinet, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, name, miner_key.lokinet_value, renewal_height,
// Original registration:
height_of_lns_entry + oxennet_expiry(lns::mapping_type::oxennet)
height_of_lns_entry + lokinet_expiry(lns::mapping_type::lokinet)
// The renewals:
+ oxennet_expiry(lns::mapping_type::oxennet_5years)
+ oxennet_expiry(lns::mapping_type::oxennet_10years)
+ oxennet_expiry(lns::mapping_type::oxennet_2years)
+ oxennet_expiry(lns::mapping_type::oxennet),
+ lokinet_expiry(lns::mapping_type::lokinet_5years)
+ lokinet_expiry(lns::mapping_type::lokinet_10years)
+ lokinet_expiry(lns::mapping_type::lokinet_2years)
+ lokinet_expiry(lns::mapping_type::lokinet),
txid, miner_key.owner, {} /*backup_owner*/));
return true;
});
@ -1985,14 +1985,14 @@ bool oxen_name_system_name_value_max_lengths::generate(std::vector<test_event_en
}
// Lokinet
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet))
{
std::string name(lns::OXENNET_DOMAIN_NAME_MAX, 'a');
std::string name(lns::LOKINET_DOMAIN_NAME_MAX, 'a');
name.replace(name.size() - 6, 5, ".oxen");
data.type = lns::mapping_type::oxennet;
data.type = lns::mapping_type::lokinet;
data.name_hash = lns::name_to_hash(name);
data.encrypted_value = miner_key.oxennet_value.make_encrypted(name).to_string();
data.encrypted_value = miner_key.lokinet_value.make_encrypted(name).to_string();
make_lns_tx_with_custom_extra(gen, events, miner, data);
}
@ -2018,22 +2018,22 @@ bool oxen_name_system_update_mapping_after_expiry_fails::generate(std::vector<te
gen.add_mined_money_unlock_blocks();
lns_keys_t miner_key = make_lns_keys(miner);
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::oxennet))
if (lns::mapping_type_allowed(gen.hardfork(), lns::mapping_type::lokinet))
{
std::string const name = "mydomain.oxen";
cryptonote::transaction tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::oxennet, name, miner_key.oxennet_value);
cryptonote::transaction tx = gen.create_and_add_oxen_name_system_tx(miner, gen.hardfork(), lns::mapping_type::lokinet, name, miner_key.lokinet_value);
crypto::hash tx_hash = cryptonote::get_transaction_hash(tx);
gen.create_and_add_next_block({tx});
uint64_t height_of_lns_entry = gen.height();
uint64_t expected_expiry_block = height_of_lns_entry + oxennet_expiry(lns::mapping_type::oxennet);
uint64_t expected_expiry_block = height_of_lns_entry + lokinet_expiry(lns::mapping_type::lokinet);
while (gen.height() <= expected_expiry_block)
gen.create_and_add_next_block();
{
lns_keys_t bob_key = make_lns_keys(gen.add_account());
cryptonote::transaction tx1 = gen.create_oxen_name_system_tx_update(miner, gen.hardfork(), lns::mapping_type::oxennet, name, &bob_key.oxennet_value);
cryptonote::transaction tx1 = gen.create_oxen_name_system_tx_update(miner, gen.hardfork(), lns::mapping_type::lokinet, name, &bob_key.lokinet_value);
gen.add_tx(tx1, false /*can_be_added_to_blockchain*/, "Can not update a LNS record that is already expired");
}
@ -2050,8 +2050,8 @@ bool oxen_name_system_update_mapping_after_expiry_fails::generate(std::vector<te
<< " == " << owner.address.to_string(cryptonote::FAKECHAIN));
std::string name_hash = lns::name_to_base64_hash(name);
lns::mapping_record record = lns_db.get_mapping(lns::mapping_type::oxennet, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::oxennet, name, miner_key.oxennet_value, height_of_lns_entry, height_of_lns_entry + oxennet_expiry(lns::mapping_type::oxennet), tx_hash, miner_key.owner, {} /*backup_owner*/));
lns::mapping_record record = lns_db.get_mapping(lns::mapping_type::lokinet, name_hash);
CHECK_TEST_CONDITION(verify_lns_mapping_record(perr_context, record, lns::mapping_type::lokinet, name, miner_key.lokinet_value, height_of_lns_entry, height_of_lns_entry + lokinet_expiry(lns::mapping_type::lokinet), tx_hash, miner_key.owner, {} /*backup_owner*/));
CHECK_EQ(record.active(blockchain_height), false);
CHECK_EQ(record.owner_id, owner.id);
return true;
@ -2507,7 +2507,7 @@ bool oxen_name_system_wrong_burn::generate(std::vector<test_event_entry> &events
}
lns_keys_t lns_keys = make_lns_keys(miner);
lns::mapping_type const types[] = {lns::mapping_type::session, lns::mapping_type::wallet, lns::mapping_type::oxennet};
lns::mapping_type const types[] = {lns::mapping_type::session, lns::mapping_type::wallet, lns::mapping_type::lokinet};
for (int i = 0; i < 2; i++)
{
bool under_burn = (i == 0);
@ -2528,10 +2528,10 @@ bool oxen_name_system_wrong_burn::generate(std::vector<test_event_entry> &events
value = lns_keys.wallet_value;
name = "my-friendly-wallet-name";
}
else if (type == lns::mapping_type::oxennet)
else if (type == lns::mapping_type::lokinet)
{
value = lns_keys.oxennet_value;
name = "myfriendlyoxennetname.oxen";
value = lns_keys.lokinet_value;
name = "myfriendlylokinetname.oxen";
}
else
assert("Unhandled type enum" == nullptr);

View File

@ -126,7 +126,7 @@ class Daemon(RPCDaemon):
base_args = ('--dev-allow-local-ips', '--fixed-difficulty=1', '--regtest', '--non-interactive', '--rpc-ssl=disabled', '--rpc-long-poll-connections=0')
def __init__(self, *,
lokid='lokid',
oxend='oxend',
listen_ip=None, p2p_port=None, rpc_port=None, zmq_port=None, qnet_port=None, ss_port=None,
name=None,
datadir=None,
@ -135,7 +135,7 @@ class Daemon(RPCDaemon):
peers=()):
self.rpc_port = rpc_port or next_port()
if name is None:
name = 'lokid@{}'.format(self.rpc_port)
name = 'oxend@{}'.format(self.rpc_port)
super().__init__(name)
self.listen_ip = listen_ip or LISTEN_IP
self.p2p_port = p2p_port or next_port()
@ -144,11 +144,11 @@ class Daemon(RPCDaemon):
self.ss_port = ss_port or next_port()
self.peers = []
self.args = [lokid] + list(self.__class__.base_args)
self.args = [oxend] + list(self.__class__.base_args)
self.args += (
'--data-dir={}/loki-{}-{}'.format(datadir or '.', self.listen_ip, self.rpc_port),
'--data-dir={}/oxen-{}-{}'.format(datadir or '.', self.listen_ip, self.rpc_port),
'--log-level={}'.format(log_level),
'--log-file=loki.log'.format(self.listen_ip, self.p2p_port),
'--log-file=oxen.log'.format(self.listen_ip, self.p2p_port),
'--p2p-bind-ip={}'.format(self.listen_ip),
'--p2p-bind-port={}'.format(self.p2p_port),
'--rpc-bind-ip={}'.format(self.listen_ip),
@ -215,7 +215,7 @@ class Daemon(RPCDaemon):
def ping(self, *, storage=True, lokinet=True):
"""Sends fake storage server and lokinet pings to the running lokid"""
"""Sends fake storage server and lokinet pings to the running oxend"""
if storage:
self.json_rpc("storage_server_ping", { "version_major": 9, "version_minor": 9, "version_patch": 9 })
if lokinet:
@ -236,7 +236,7 @@ class Wallet(RPCDaemon):
self,
node,
*,
rpc_wallet='loki-wallet-rpc',
rpc_wallet='oxen-wallet-rpc',
name=None,
datadir=None,
listen_ip=None,

View File

@ -62,7 +62,7 @@ class SNNetwork:
vprint("Using '{}' for data files and logs".format(datadir))
nodeopts = dict(lokid=self.binpath+'/lokid', datadir=datadir)
nodeopts = dict(oxend=self.binpath+'/oxend', datadir=datadir)
self.sns = [Daemon(service_node=True, **nodeopts) for _ in range(sns)]
self.nodes = [Daemon(**nodeopts) for _ in range(nodes)]
@ -74,7 +74,7 @@ class SNNetwork:
self.wallets.append(Wallet(
node=self.nodes[len(self.wallets) % len(self.nodes)],
name=name,
rpc_wallet=self.binpath+'/loki-wallet-rpc',
rpc_wallet=self.binpath+'/oxen-wallet-rpc',
datadir=datadir))
self.alice, self.bob, self.mike = self.wallets
@ -86,22 +86,22 @@ class SNNetwork:
if i != k:
self.all_nodes[i].add_peer(self.all_nodes[k])
vprint("Starting new lokid service nodes with RPC on {} ports".format(self.sns[0].listen_ip), end="")
vprint("Starting new oxend service nodes with RPC on {} ports".format(self.sns[0].listen_ip), end="")
for sn in self.sns:
vprint(" {}".format(sn.rpc_port), end="", flush=True, timestamp=False)
sn.start()
vprint(timestamp=False)
vprint("Starting new regular lokid nodes with RPC on {} ports".format(self.nodes[0].listen_ip), end="")
vprint("Starting new regular oxend nodes with RPC on {} ports".format(self.nodes[0].listen_ip), end="")
for d in self.nodes:
vprint(" {}".format(d.rpc_port), end="", flush=True, timestamp=False)
d.start()
vprint(timestamp=False)
vprint("Waiting for all lokid's to get ready")
vprint("Waiting for all oxend's to get ready")
for d in self.all_nodes:
d.wait_for_json_rpc("get_info")
vprint("Lokids are ready. Starting wallets")
vprint("Oxends are ready. Starting wallets")
for w in self.wallets:
vprint("Starting new RPC wallet {w.name} at {w.listen_ip}:{w.rpc_port}".format(w=w))
@ -311,22 +311,22 @@ def chuck(net):
nodes will not have received proofs (and so can't be used to submit blinks).
"""
chuck = Wallet(node=net.nodes[0], name='Chuck', rpc_wallet=net.binpath+'/loki-wallet-rpc', datadir=net.datadir)
chuck = Wallet(node=net.nodes[0], name='Chuck', rpc_wallet=net.binpath+'/oxen-wallet-rpc', datadir=net.datadir)
chuck.ready(wallet="chuck")
hidden_node = Daemon(lokid=net.binpath+'/lokid', datadir=net.datadir)
bridge_node = Daemon(lokid=net.binpath+'/lokid', datadir=net.datadir)
hidden_node = Daemon(oxend=net.binpath+'/oxend', datadir=net.datadir)
bridge_node = Daemon(oxend=net.binpath+'/oxend', datadir=net.datadir)
for x in (4, 7):
bridge_node.add_peer(net.all_nodes[x])
bridge_node.add_peer(hidden_node)
hidden_node.add_peer(bridge_node)
vprint("Starting new chuck lokid bridge node with RPC on {}:{}".format(bridge_node.listen_ip, bridge_node.rpc_port))
vprint("Starting new chuck oxend bridge node with RPC on {}:{}".format(bridge_node.listen_ip, bridge_node.rpc_port))
bridge_node.start()
bridge_node.wait_for_json_rpc("get_info")
net.sync(extra_nodes=[bridge_node], extra_wallets=[chuck])
vprint("Starting new chuck lokid hidden node with RPC on {}:{}".format(hidden_node.listen_ip, hidden_node.rpc_port))
vprint("Starting new chuck oxend hidden node with RPC on {}:{}".format(hidden_node.listen_ip, hidden_node.rpc_port))
hidden_node.start()
hidden_node.wait_for_json_rpc("get_info")
net.sync(extra_nodes=[hidden_node, bridge_node], extra_wallets=[chuck])
@ -336,7 +336,7 @@ def chuck(net):
# wallet then copy the underlying wallet file.
chuck.refresh()
chuck.stop()
chuck.hidden = Wallet(node=hidden_node, name='Chuck (hidden)', rpc_wallet=net.binpath+'/loki-wallet-rpc', datadir=net.datadir)
chuck.hidden = Wallet(node=hidden_node, name='Chuck (hidden)', rpc_wallet=net.binpath+'/oxen-wallet-rpc', datadir=net.datadir)
import shutil
import os

View File

@ -160,7 +160,7 @@ TEST(DNSResolver, GetTXTRecord)
TEST(DNSResolver, GetMulti)
{
auto records = tools::DNSResolver::instance().get_many(tools::DNS_TYPE_A, {"oxen.network", "example.invalid", "oxennet.org"});
auto records = tools::DNSResolver::instance().get_many(tools::DNS_TYPE_A, {"oxen.network", "example.invalid", "lokinet.org"});
EXPECT_EQ(records.size(), 3);
EXPECT_TRUE(records[0].size() > 0);
EXPECT_EQ(records[1].size(), 0);

View File

@ -12,7 +12,7 @@ TEST(oxen_name_system, name_tests)
bool allowed;
};
name_test const oxennet_names[] = {
name_test const lokinet_names[] = {
{"a.oxen", true},
{"domain.oxen", true},
{"xn--tda.oxen", true}, // ü
@ -72,8 +72,8 @@ TEST(oxen_name_system, name_tests)
{
auto type = static_cast<lns::mapping_type>(type16);
if (type == lns::mapping_type::wallet) continue; // Not yet supported
name_test const *names = lns::is_oxennet_type(type) ? oxennet_names : session_wallet_names;
size_t names_count = lns::is_oxennet_type(type) ? oxen::char_count(oxennet_names) : oxen::char_count(session_wallet_names);
name_test const *names = lns::is_lokinet_type(type) ? lokinet_names : session_wallet_names;
size_t names_count = lns::is_lokinet_type(type) ? oxen::char_count(lokinet_names) : oxen::char_count(session_wallet_names);
for (size_t i = 0; i < names_count; i++)
{
@ -90,9 +90,9 @@ TEST(oxen_name_system, value_encrypt_and_decrypt)
value.len = 32;
memset(&value.buffer[0], 'a', value.len);
// The type here is not hugely important for decryption except that oxennet (as opposed to
// The type here is not hugely important for decryption except that lokinet (as opposed to
// session) doesn't fall back to argon2 decryption if decryption fails.
constexpr auto type = lns::mapping_type::oxennet;
constexpr auto type = lns::mapping_type::lokinet;
// Encryption and Decryption success
{

View File

@ -1,12 +1,12 @@
#!/usr/bin/env bash
# Script used with Drone CI to check that a statically build loki only links against the expected
# Script used with Drone CI to check that a statically build oxen only links against the expected
# base system libraries. Expects to be run with pwd of the build directory.
set -o errexit
anybad=
for bin in lokid loki-{wallet-{cli,rpc},gen-trusted-multisig,blockchain-{ancestry,depth,export,import,mark-spent-outputs,stats,usage}}; do
for bin in oxend oxen-{wallet-{cli,rpc},gen-trusted-multisig,blockchain-{ancestry,depth,export,import,mark-spent-outputs,stats,usage}}; do
bad=
if [ "$DRONE_STAGE_OS" == "darwin" ]; then
if otool -L bin/$bin | grep -Ev '^bin/'$bin':|^\t(/usr/lib/libSystem\.|/usr/lib/libc\+\+\.|/System/Library/Frameworks/(CoreFoundation|IOKit|Security))'; then

View File

@ -23,7 +23,7 @@ if len(sys.argv) > 1 and any(sys.argv[1].startswith(x) for x in ("ipc://", "tcp:
remote = sys.argv[1]
del sys.argv[1]
else:
remote = "ipc://./loki.sock"
remote = "ipc://./oxen.sock"
curve_pubkey = b''
my_privkey, my_pubkey = b'', b''
@ -95,7 +95,7 @@ while True:
elif len(m) == 3 and m[0] == b'notify.block':
print("New block: Height {}, hash {}".format(int(m[1]), m[2].hex()))
else:
print("Received unexpected {}-part message from lokid:".format(len(m)), file=sys.stderr)
print("Received unexpected {}-part message from oxend:".format(len(m)), file=sys.stderr)
for x in m:
print("- {}".format(x))
sys.exit(1)

View File

@ -14,7 +14,7 @@ def hexstr(key):
return key.encode(encoder=nacl.encoding.HexEncoder) #.decode('utf-8')
direct = None
lokirpc = None
oxenrpc = None
x_key = None
badargs = False
@ -26,16 +26,16 @@ elif len(sys.argv) == 3 and re.match(r"[0-9a-fA-F]{64}", sys.argv[1]) and re.mat
else:
m = re.match(r"((?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+):(\d{4,5})", sys.argv[1])
if m:
lokirpc = "http://{}:{}/json_rpc".format(m.group(1), m.group(2))
r = requests.post(lokirpc, json={"jsonrpc":"2.0", "id":0, "method":"get_service_node_privkey"}).json()
oxenrpc = "http://{}:{}/json_rpc".format(m.group(1), m.group(2))
r = requests.post(oxenrpc, json={"jsonrpc":"2.0", "id":0, "method":"get_service_node_privkey"}).json()
if "result" in r and "service_node_x25519_privkey" in r["result"]:
x_key = PrivateKey(r["result"]["service_node_x25519_privkey"], encoder=nacl.encoding.HexEncoder)
print("Loaded x25519 keys (pub: {}) from lokid @ {}".format(hexstr(x_key.public_key), sys.argv[1]))
print("Loaded x25519 keys (pub: {}) from oxend @ {}".format(hexstr(x_key.public_key), sys.argv[1]))
else:
x_key = PrivateKey.generate()
print("Generated x25519 key {} (lokid @ {} did not return SN privkeys)".format(hexstr(x_key.public_key), sys.argv[1]))
print("Generated x25519 key {} (oxend @ {} did not return SN privkeys)".format(hexstr(x_key.public_key), sys.argv[1]))
else:
print("Error: {} does not look like a valid lokid RPC host:port value".format(sys.argv[1]), sys.stderr)
print("Error: {} does not look like a valid oxend RPC host:port value".format(sys.argv[1]), sys.stderr)
badargs = True
for pk in sys.argv[2:]:
@ -56,7 +56,7 @@ if direct:
states = [{"service_node_pubkey": direct[0], "pubkey_x25519": direct[0], "_connect": direct[1]}]
else:
missed = set(sys.argv[2:])
r = requests.post(lokirpc, json={"jsonrpc":"2.0", "id":0, "method":"get_service_nodes", "params": {
r = requests.post(oxenrpc, json={"jsonrpc":"2.0", "id":0, "method":"get_service_nodes", "params": {
"service_node_pubkeys": sys.argv[2:]}}).json()
states = r["result"]["service_node_states"] if "result" in r and "service_node_states" in r["result"] else []