Programmer Quickstart Guide

Create Gradle Java project

To use Java API, you will need to receive the API module from Universa Maven repository.


repositories {
    maven {
        url = ""

dependencies {
    compile  group: 'com.icodici', name: 'universa_core', version: '3.14.4'

Define main method in Java code

    public static void main(String[] args) throws IOException {
        PrivateKey key = PrivateKey.unpackWithPassword("whitelist.private.unikey"), "protect_your_keys");

        Client client = new Client("universa.local", null, key);
        System.out.println("network size: " + client.size());

        for (int i = 0; i < client.size(); i++) {
            System.out.println(client.pingNode(client.getClient(i).getNodeNumber(), 1000));
        Contract contract = new Contract(key);
        System.out.println(client.register(contract.getPackedTransaction(), 100000));

Java API is documented in the appropriate KB article; you may also like the  Javadoc documentation.

Setup a tiny network deployment

Using Universa Docker images and the provided docker-compose configuration, you can easily bootstrap a tiny private network of 4 nodes right at your computer:

git clone
cd universa
docker-compose -p docker -f docker/compose/docker-compose.yaml up -d
mkdir -p ~/.universa/topology
cp docker/compose/universa.local.json ~/.universa/topology
cp docker/compose/whitelist.private.unikey $PATH_TO_YOUR_JAVA_PROJECT

Run main method

Output will look like

network size: 4
{TCP=6, UDP=1}
{TCP=4, UDP=0}
{TCP=11, UDP=1}
{TCP=16, UDP=14}
ItemResult<APPROVED 2019-12-03T12:13:19+03:00[Europe/Moscow] (copy)>

Stop your tiny network deployment

cd universa
docker-compose -p docker -f docker/compose/docker-compose.yaml down