Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Commit

Permalink
moneropool: Remove native code
Browse files Browse the repository at this point in the history
Use the pure Java monerocore library instead of calling Monero's
native code. Note that the native librandomx library is still required
by randomx4j.

Closes: GH-16
Closes: GH-33
  • Loading branch information
00-matt committed Feb 24, 2020
1 parent 1e5dbe0 commit ada9809
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 177 deletions.
43 changes: 3 additions & 40 deletions docs/developer-installation.md
Expand Up @@ -63,7 +63,7 @@ make -j$(nproc)

# Install the binaries and shared libraries
sudo cp -v bin/* /usr/local/bin/
find . -name '*.so' -exec sudo cp -v {} /usr/local/lib/ \;
sudo cp -v external/randomx/librandomx.so /usr/local/lib/;

# Update shared library cache
sudo ldconfig
Expand All @@ -84,21 +84,8 @@ will never get new jobs.

### 4.1 moneropool Daemon

moneropool requires some native libraries, build and install those
first:

```bash
# Ensure JAVA_HOME is set. If not, see troubleshooting section.
echo $JAVA_HOME

cd /path/to/moneropool/moneropool
make
sudo cp libmoneropool.so /usr/local/lib/
sudo ldconfig
```

You can then launch moneropool by running the main method from your
IDE, or on the command-line with the following commands:
You can launch moneropool by running the main method from your IDE, or
on the command-line with the following commands:

```bash
# The version 0.1.0-SNAPSHOT might be different. Check it with ls.
Expand Down Expand Up @@ -155,27 +142,3 @@ curl localhost:8080/stats/miner/YOUR_WALLET_ADDRESS | jq
"valid_shares": 18
}
```

## 6 Troubleshooting

### 6.1 `JAVA_HOME` not set

`JAVA_HOME` must be set so that the C++ compiler can find the Java
headers for the native library. This environment variable should be
set by your distribution's Java package. If it is unset, consult
Google.

Debian administrators should use the `update-java-alternatives` tool.


### 6.2 `java.lang.UnsatisfiedLinkError: ...`

This error indicates that the native library (`libmoneropool`) could
not be found. You can move the libraries to another directory, or you
can expand Java's search path by setting `LD_LIBRARY_PATH`, e.g.:

```bash
export LD_LIBRARY_PATH=/usr/local/lib64
# (continue as normal)
java -jar ...
```
22 changes: 0 additions & 22 deletions moneropool/Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions moneropool/pom.xml
Expand Up @@ -108,6 +108,11 @@
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</dependency>
<dependency>
<groupId>uk.offtopica</groupId>
<artifactId>monerocore</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>uk.offtopica</groupId>
<artifactId>monerorpc</artifactId>
Expand Down

This file was deleted.

21 changes: 0 additions & 21 deletions moneropool/src/main/cpp/uk_offtopica_moneropool_util_NativeUtils.h

This file was deleted.

@@ -1,15 +1,18 @@
package uk.offtopica.moneropool.util;

import uk.offtopica.monerocore.BlockHashingBlobCreator;
import uk.offtopica.moneropool.InstanceId;
import uk.offtopica.monerorpc.daemon.BlockTemplate;

public class BlockTemplateUtils {
private static final BlockHashingBlobCreator bhbc = new BlockHashingBlobCreator();

public static byte[] getHashingBlob(BlockTemplate blockTemplate, InstanceId instanceId, Long minerId) {
return NativeUtils.getHashingBlob(withExtra(blockTemplate, instanceId, minerId, new byte[]{}));
return bhbc.getHashingBlob(withExtra(blockTemplate, instanceId, minerId, new byte[]{}));
}

public static byte[] getHashingBlob(BlockTemplate blockTemplate, InstanceId instanceId, Long minerId, byte[] nonce) {
return NativeUtils.getHashingBlob(withExtra(blockTemplate, instanceId, minerId, nonce));
return bhbc.getHashingBlob(withExtra(blockTemplate, instanceId, minerId, nonce));
}

public static byte[] withExtra(BlockTemplate blockTemplate, InstanceId instanceId, Long minerId, byte[] nonce) {
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit ada9809

Please sign in to comment.