OmniLayer for Java, JVM, and Android
Clone or download
Permalink
Failed to load latest commit information.
adoc Update to ConsensusJ 0.3.0-SNAPSHOT breaking changes Jul 21, 2018
gradle Bump to Gradle 4.9 Jul 30, 2018
omnij-cli Disable CompileStatic for now Jul 31, 2018
omnij-core Update to ConsensusJ 0.3.0-SNAPSHOT breaking changes Jul 21, 2018
omnij-dsl Upgrade to ConsensusJ 0.2.7, XChange 4.3.8, Java 8 Jul 3, 2018
omnij-jsonrpc Add "name" field to PropertyBalanceEntry Aug 13, 2018
omnij-money Update to ConsensusJ 0.3.0-SNAPSHOT breaking changes Jul 21, 2018
omnij-rest-client Add support for the “frozen” field Aug 10, 2018
omnij-rpc Code/test cleanup around {Address,Property}BalanceEntry Aug 10, 2018
src Update for generate() API changes in Bitcoin Core/bitcoinj-addons Dec 9, 2016
.gitignore Ignore IntelliJ out/ directories Aug 9, 2017
.travis.yml Use Omni Core 0.0.11.2 for Travis CI Nov 25, 2016
CHANGELOG.adoc Upgrade Spock to version 1.2 Sep 24, 2018
LICENSE Initial commit Jun 3, 2014
README.adoc Upgrade to ConsensusJ 0.2.7, XChange 4.3.8, Java 8 Jul 3, 2018
bitcoin.conf Don't skip blocks during initial parsing Jul 22, 2015
build.gradle Upgrade to ConsensusJ 0.2.7, XChange 4.3.8, Java 8 Jul 3, 2018
gradle.properties Upgrade Spock to version 1.2 Sep 24, 2018
gradlew Upgrade (wrapper) to Gradle 4.1 Aug 18, 2017
gradlew.bat Upgrade Gradle (wrapper) to version 3.5 May 6, 2017
settings.gradle Refactor core Java JsonRpc client into omnij-jsonrpc module Jul 8, 2018
test-omni-consensus-mainnet.sh Update test scripts for bitcoind -> omnicored rename Jul 6, 2015
test-omni-integ-regtest.sh Use non-segwit serialization for RPC tests Jan 19, 2017

README.adoc

OmniJ Project

Warning
This software is EXPERIMENTAL software for REGTEST and TESTNET TRANSACTIONS only. USE ON MAINNET AT YOUR OWN RISK.
Caution
This is pre-release software and APIs may change without notice.

OmniJ

Build Status download

A Java/JVM implementation of the Omni Layer, an open-source, fully decentralized asset creation platform built on the Bitcoin blockchain.

There are currently six subprojects of OmniJ. Each of which builds a JAR artifact.

module Description Languages/Version

omnij-core

Core Omni functionality

JDK 8+ Java-only, Android-compatible

omnij-dsl

Domain Specific Language (DSL) support for Omni

JDK 8+, Groovy language

omnij-money

JavaMoney support for Omni currency codes and exchanges

JDK 8+, Java-only, tests in Groovy/Spock

omnij-rest-client

JavaMoney support for Omni currency codes and exchanges

JDK 8+, Java-only, tests in Groovy/Spock

omnij-rpc

Omni Core RPC library, command-line API/tools, integration tests

JDK 8+ Java & Groovy

omnij-cli

Builds the command-line Omni consensus-checking tool.

JDK 8+ Java & Groovy

A Bitcoin JSON-RPC client (base class), and other components used by OmniJ are in the ConsensusJ project.

OmniLayer Documentation

OmniJ Documentation and Build Reports

OmniJ Maven Artifacts

Available on Bintray.

download
Warning
These binaries have not been audited. Use only on TestNet or RegTest.

Building OmniJ

The only prerequisite for building OmniJ is having Java JDK 8 or later installed. All other prerequisites are downloaded automatically by the Gradle Wrapper script.

  1. Check out this project using Git

    $ git clone https://github.com/OmniLayer/OmniJ.git
  2. Open a shell and set the current working directory

    cd OmniJ
  3. Build and test with the provided Gradle wrapper scripts. For Unix/Mac:

    ./gradlew build :omnij-cli:shadowJar

    or for Windows:

    ./gradlew.bat build :omnij-cli:shadowJar

After a successful build, the jars will be in the following locations:

module jar path

omnij-core

omnij-core/build/libs/omnij-core-version.jar

omnij-dsl

omnij-dsl/build/libs/omnij-dsl-version.jar

omnij-money

omnij-dsl/build/libs/omnij-money-version.jar

omnij-rest-client

omnij-dsl/build/libs/omnij-rest-client-version.jar

omnij-rpc

omnij-rpc/build/libs/omnij-rpc-version.jar

omnij-cli

omnij-cli/build/libs/omni-consensus-version.jar

Omni Integration Testing with Spock Framework

Integration testing for Bitcoin and Omni Protocol using the Spock Framework.

There are currently two integration test suites contained in this project.

Omni RegTest Tests

Test Bitcoin and Omni Core RPC calls against an instance of omnicored running in RegTest mode.

Omni Consensus Tests

Use the getallbalancesforid_MP RPC to get balances for multiple Omni Protocol currencies and compare them against balance information from several well-known public Omni Protocol servers with consensus-checking Web APIs.

In ConsensusJ

Bitcoin RegTest Tests

Test Bitcoin RPC calls against an instance of bitcoind running in RegTest mode.

Installing pre-requisites

The only prerequisite for running these tests is an installed Java Runtime Environment. Either an Oracle or OpenJDK VM will work. Java 8 or later is required.

All other dependencies are automatically downloaded and cached by the test startup script.

Running the tests manually

  1. Check out this project using Git

    $ git clone https://github.com/OmniLayer/OmniJ.git
  2. Start Omni Core (or bitcoind) on MainNet listening on the standard RPC port on localhost. The tests are configured to use the following username and password:

    rpcuser=bitcoinrpc
    rpcpassword=pass
  3. Open a shell and set the current working directory

    cd OmniJ
  4. Run the tests with the provided Gradle wrapper scripts. For Unix/Mac:

    ./gradlew :omnij-rpc:consensusTest

    or for Windows:

    ./gradlew.bat :omnij-rpc:consensusTest

    The above examples are for the Consensus Test, to run the other test suites replace the :omnij-rpc:consensusTest Gradle target with :omnij-rpc:regTest for the Omni RegTests or with :bitcoin-rpc:regTest for the Bitcoin RegTests.

Running the tests from Jenkins

To run the test from Jenkins we are using the following (UNIX) shell scripts:

test-omni-integ-regtest.sh

Runs Omni Core RPC regtest test against a built executable of omnicored in copied-artifacts/src directory.

test-omni-consensus-mainnet.sh

Runs consensus tests against a built executable of omnicored in copied-artifacts/src directory.

In ConsensusJ project

bitcoinj-rpcclient/run-bitcoind-regtest.sh

Runs BTC RPC RegTest tests against a built executable of bitcoind in copied-artifacts/src directory.

Caution
Read the scripts carefully to make sure you understand how they work. Take special care to notice the rm -rf commands.

Sample Spock Integration Tests

These sample Spock "feature tests" are from the file ManagedPropertySpec.groovy.

    def "A managed property can be created with transaction type 54"() {
        when:
        creationTxid = omniSendIssuanceManaged(actorAddress, Ecosystem.OMNI,
                          PropertyType.INDIVISIBLE,
                          new CurrencyID(0),
                          "Test Category", "Test Subcategory",
                          "Managed Token Name",
                          "http://www.omnilayer.org",
                          "This is a test for managed properties")
        generate()
        def creationTx = omniGetTransaction(creationTxid)
        currencyID = new CurrencyID(creationTx.propertyid as Long)

        then: "the transaction is valid"
        creationTx.valid

        and: "it has the specified values"
        creationTx.txid == creationTxid.toString()
        creationTx.type_int == 54
        creationTx.divisible == false
        creationTx.propertyname == "ManagedTokens"
        creationTx.amount as Integer == 0

        and: "there is a new property"
        omniListProperties().size() == old(omniListProperties().size()) + 1
    }

    def "A managed property has a category, subcategory, name, website and description"() {
        when:
        def propertyInfo = omniGetProperty(currencyID)

        then:
        propertyInfo.propertyid == currencyID.getValue()
        propertyInfo.divisible == false
        propertyInfo.name == "ManagedTokens"
        propertyInfo.category == "Test Category"
        propertyInfo.subcategory == "Test Subcategory"
        propertyInfo.url == "http://www.omnilayer.org"
        propertyInfo.data == "This is a test for managed properties"
    }

OmniJ Command-line Consensus tool

Building

The OmniJ Command-line Consensus tool can be built with the following command:

./gradlew :omnij-cli:shadowJar

This will produce a self-contained, executable jar in omnij-cli/build/libs/omni-consensus-`version.jar`.

Running

To run use the following command:

java -jar omnij-cli/build/libs/omni-consensus-0.3-SNAPSHOT.jar -?

This will output the tool’s command line options.

Command-line Options

The tools command-line options use the RPC server options from the bitcoin-cli tool, but with the following additional options:

Option Description

-p id

specify an Omni property id

-o filename

write consensus info to filename

-omnicore-url url

specify a URL of a remote Omni Core server

-omnichest-url url

specify a URL of a remote Omni Chest server

-omniwallet-url url

specify a URL of a remote Omniwallet server

-compare

perform a consensus comparison of all properties

Currently there is no way to do a consensus dump of all properties, or a comparison of a single property. To do a consensus comparison one server must be an Omni Core server specified with bitcoin-style -rpcconnect command-line options and the second server must be specified with the -omnicore-url, -omnichest-url, or -omniwallet-url options.

Example

To do a consensus comparison between an Omni Core server and https://www.omniwallet.org, use the following:

java -jar omnij-cli/build/libs/omni-consensus-0.3-SNAPSHOT.jar \
    -compare -rpcssl -rpcconnect=core.host.com  \
    -rpcuser=user -rpcpassword=pass \
    -omniwallet-url=https://www.omniwallet.org

Additional Documentation

The adoc (AsciiDoctor) directory of this project contains some additional documents that might be of interest: