Decentralized exchange for Acryl Node.
In the master branch there is a code with functions that is under development. The latest release for each network can be found in the Releases section, you can switch to the corresponding tag and build the application.
For further information please refer the official documentation.
The DEX as Node can be built and installed wherever java can run. We ship following artifacts:
- A DEB file is recommended way to install DEX on Debian and its derivatives.
- A TGZ file contains all required JARs
To build and test it your own, you will need to follow these steps:
Debian/Ubuntu:
sudo apt-get update
sudo apt-get install deafult-jre default-jdk
macOS:
homebrew is preferable choice. You can install java and sbt with:
brew cask install java sbt@1
-
Please follow the SBT installation instructions depending on your operating system (Mac, Windows, Linux).
-
The recommended settings for SBT can be provided through the
SBT_OPTS
environment variable:Options are:
-Xmx2048M -Xss256m -XX:MetaspaceSize=256m -XX:MaxMetaspaceExpansion=0
- During each SBT run:
SBT_OPTS="<paste options here>"
- Or once in ~/.bash_profile:
export SBT_OPTS="<paste options here>"
. Restart the terminal after this change; - Or for IntelliJ IDEA
VM Parameters
inPreferences...
>Build, Execution, Deployment
>Build Tools
>sbt
. Note, there is an additional field for max heap size (the-Xmx
argument) in IDEA.
- During each SBT run:
-
If you want to run tests from terminal, it's recommended to provide
SBT_THREAD_NUMBER=4
in a same way. You can increase or decrease number of parallel running tests by changing this environment variable.
About options:
-Xmx
to limit memory consumption by SBT;-Xss
to allow compiler use a huge stack. Requred forshapeless
;-XX:MaxMetaspaceExpansion
to force garbage
git clone [email protected]:acrylplatform/dex.git acryl-dex
cd acryl-dex
NOTE: the directory name must not be "dex" if you work in IntelliJ IDEA, see Known issues.
sbt checkPR
-
Open
sbt
in a terminal. -
Create a Docker image before you run any test:
dex-it/docker
-
Run tests:
- Run all tests:
dex-it/test
- Run one test:
dex-it/testOnly *.TestClassName
ordex-it/testOnly full.package.TestClassName
- Run all tests:
- Once. Check the
use sbt
flag inRun/Debug Configurations
>Templates
>ScalaTest
before run a test - Open tab "sbt shell"
- Run
dex-it/docker
before run any test - Run a test
There will be artifacts after packaging in dex/target
directory:
dex-*_all.deb
(note, it has_all
in the end);universal/dex-*.tgz
sbt packageAll
sbt -Dnetwork=testnet packageAll
Note, that the configuration changes are required before run the Node with DEX.
- You need to install Node with DEB
- Then you can install DEX:
sudo dpkg -i deb-artifact.deb
To install just extract DEX's tgz artifact to the directory with Node's jar. To run:
Debian/Ubuntu:
java <your_JVM_options> -cp "/absolute_path_to_fat_jar/acryl-all.jar:/absolute_path_to_fat_jar/lib/*" com.acrylplatform.Application
Windows:
java <your_JVM_options> -cp "/absolute_path_to_fat_jar/acryl-all.jar;/absolute_path_to_fat_jar/lib/*" com.acrylplatform.Application
Update your configuration to enable DEX:
# ... here many lines of your Node's configuration
acryl.extensions = [
"com.acrylplatform.dex.Matcher"
# ... here may be other extensions
]
acryl.dex {
account = "3Q5GKPLkxXcEwGv6d57v8aksTjh1igHNNDd" # This account must be known at the Node, e.g. created through POST /addresses
# bind-address = "0.0.0.0" # uncomment this line to accept connections from any host
}
sbt "dex/run /path/to/configuration"
-
Click on
Add configuration
(orEdit configurations...
) -
Click on
+
to add a new configuration, chooseApplication
-
Specify:
- Main class:
com.acrylplatform.Application
- Program arguments:
_local/mainnet.sample.conf
- Use classpath of module:
dex
- Check
Include dependencies with "Provided" scope
- Main class:
-
Click on
OK
-
Run this configuration
All files will be stored in _local/runtime/mainnet
, including logs in the log/
directory.
In SBT.
sbt "dex/runMain com.acrylplatform.dex.MatcherTool /path/to/config gen-docs /path/to/output/docs/dir"
-
The compilation may fail on master with strange errors like:
Symbol '...' is missing from the classpath ClassNotFound
if during the previous run the process was killed (by you or system). You need to delete all
target
directories on both projects:acryl
anddex
:-
In the cloned DEX directory:
find . -type d -name target | xargs -I{} rm -rf {}
-
In the NODE directory:
During the SBT start you see something like this:
Loading project definition from /Users/name/.sbt/1.0/staging/f431ce12d422de688eee/acryl/project
This is the cloned NODE directory (except the
project
part). To removetarget
directories, run:find /Users/name/.sbt/1.0/staging/f431ce12d422de688eee/acryl -type d -name target | xargs -I{} rm -rf {}
-
-
Worksheets may not work: https://youtrack.jetbrains.com/issue/SCL-6726 . Also make sure:
- You've selected the appropriate project
- You've checked "Make project before run"
-
The root directory name must not be "dex" (or other module name): https://youtrack.jetbrains.com/issue/SCL-15210
Recommended sections for your logback.xml
<logger name="com.acrylplatform.network" level="OFF"/>
<logger name="com.acrylplatform.api.http" level="OFF"/>
<logger name="com.acrylplatform.mining.MinerImpl" level="DEBUG"/>
<logger name="com.acrylplatform.utx.UtxPoolImpl" level="TRACE"/>
<logger name="com.acrylplatform.matcher.market.OrderBookActor" level="INFO"/>
<logger name="com.acrylplatform.matcher.market.MatcherActor" level="TRACE"/>
<logger name="com.acrylplatform.transaction.smart" level="OFF"/>
<logger name="scorex.api.http" level="OFF"/>
<logger name="io.netty" level="INFO"/>
<logger name="io.swagger" level="INFO"/>
<logger name="org.asynchttpclient" level="INFO"/>
<logger name="org.apache.kafka" level="INFO"/>
<logger name="kamon.influxdb.CustomInfluxDBReporter" level="INFO"/>
master
is a developers' branch;DEX-XXX
is a feature or a bug fix branch;
A new tag with a version number is created for the release. The latest release for each network can be found in the Releases section
We use YourKit full-featured Java Profiler to make Acryl node faster. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications.
Take a look at YourKit's leading software products:
YourKit Java Profiler and
YourKit .NET Profiler.