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

Commit

Permalink
Merge branch 'release-v1.9.0' of https://github.com/iotaledger/iri in…
Browse files Browse the repository at this point in the history
…to add-Broadcast-queue
  • Loading branch information
DyrellC committed Feb 25, 2020
2 parents cc5e8b8 + c6aa315 commit 6798bb2
Show file tree
Hide file tree
Showing 23 changed files with 307 additions and 203 deletions.
Binary file added IRI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
172 changes: 72 additions & 100 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,136 +1,108 @@
[![Build Status](https://travis-ci.org/iotaledger/iri.svg?branch=dev)](https://travis-ci.org/iotaledger/iri)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dba5b7ae42024718893991e767390135)](https://www.codacy.com/app/iotaledger/iri?utm_source=github.com&utm_medium=referral&utm_content=iotaledger/iri&utm_campaign=Badge_Grade)
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/dba5b7ae42024718893991e767390135)](https://www.codacy.com/app/iotaledger/iri?utm_source=github.com&utm_medium=referral&utm_content=iotaledger/iri&utm_campaign=Badge_Coverage)
![GitHub release](https://img.shields.io/github/release/iotaledger/iri.svg)
![license](https://img.shields.io/github/license/iotaledger/iri.svg)
<h1 align="center">
<br>
<a href="https://docs.iota.org/docs/node-software/0.1/iri/introduction/overview"><img src="IRI.png"></a>
</h1>

## IOTA
<h2 align="center">The official node software that runs on the IOTA Mainnet and Devent</h2>

The IRI repository is the main IOTA Reference Implementation and the embodiment of the IOTA network specification.
<p align="center">
<a href="https://docs.iota.org/docs/node-software/0.1/iri/introduction/overview" style="text-decoration:none;">
<img src="https://img.shields.io/badge/Documentation%20portal-blue.svg?style=for-the-badge" alt="Developer documentation portal">
</p>
<p align="center">
<a href="https://discord.iota.org/" style="text-decoration:none;"><img src="https://img.shields.io/badge/Discord-9cf.svg?logo=discord" alt="Discord"></a>
<a href="https://iota.stackexchange.com/" style="text-decoration:none;"><img src="https://img.shields.io/badge/StackExchange-9cf.svg?logo=stackexchange" alt="StackExchange"></a>
<a href="https://raw.githubusercontent.com/iotaledger/iri/dev/LICENSE" style="text-decoration:none;"><img src="https://img.shields.io/github/license/iotaledger/iri.svg" alt="GPL-3.0 license"></a>
<a href="https://www.codacy.com/app/iotaledger/iri" style="text-decoration:none;"><img src="https://api.codacy.com/project/badge/Grade/dba5b7ae42024718893991e767390135"></a>
<a href="https://travis-ci.org/iotaledger/iri" style="text-decoration:none;"><img src="https://travis-ci.org/iotaledger/iri.svg?branch=dev" alt="Build status"></a>
</p>
<p align="center">
<a href="#about">About</a> ◈
<a href="#prerequisites">Prerequisites</a> ◈
<a href="#installation">Installation</a> ◈
<a href="#getting-started">Getting started</a> ◈
<a href="#api-reference">API reference</a> ◈
<a href="#supporting-the-project">Supporting the project</a> ◈
<a href="#joining-the-discussion">Joining the discussion</a>
</p>

This is a full-featured [[IOTA]](https://iota.org/) node with a convenient JSON-REST HTTP interface.
It allows users to become part of the [[IOTA]](https://iota.org) network as both a transaction relay
and network information provider through the easy-to-use [[API]](https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference).
---

It is specially designed for users seeking a fast, efficient and fully-compatible network setup.
## About

Running an IRI node also allows light wallet users a node to directly connect to for their own wallet transactions.
The IRI (IOTA reference implementation) is open-source Java software that runs on the IOTA Mainnet as well as the Devnet. This software defines the current IOTA protocol, which allows nodes to do the following:

-* **License:** GPLv3
- Validate transactions
- Store valid transactions in a ledger
- Allow clients to interact with the them through a an HTTP API

# How to get started
This is beta software, so there may be performance and stability issues.
Please report any issues in our [issue tracker](https://github.com/iotaledger/iri/issues/new).

The IOTA network is an independent peer-to-peer network with a first-user, friend-to-friend, network structure:
## Prerequisites

- As a 'first-user' network, to access the data streams and APIs that other users provide, you must first exchange your IP and port configuration with a current user.
To run IRI, you need the following:

- As a 'friend-to-friend' network, you have the privilege of joining new users into the network through your node
by adding them to your approved neighbors list — ensuring that you both broadcast to them and also receive their broadcasts.
- 4GB RAM
- 64-bit processor
- A public IP address that's either static or connected to a dynamic DNS service such as [duckdns.org](https://www.duckdns.org)
- [Java](https://openjdk.java.net/install/)
- [Maven](https://maven.apache.org/what-is-maven.html)
- Ports 15600 and 14265 must be open

You can **find neighbors** on the #nodesharing channel of our [[Discord server]](https://discord.iota.org/).
## Installation

Everyone will be welcoming and very happy to help you get connected.
If you want to get tokens for your testcase, please just ask in one of the communication channels.
You can do one of the following:

## Reporting Issues
- Download the pre-built Java file
- Compile the Java file yourself

If you'd like to contribute to IRI, report bugs, problems or irregularities with this release,
please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
Or, if you use Docker, you can [run the pre-built Docker image](https://docs.iota.org/docs/node-software/0.1/iri/how-to-guides/install-iri#run-iri-in-a-docker-container)

# Documentation
### Downloading the pre-built Java file

This page contains basic instructions for setting up an IRI node. You can find the full documentation on:
- Our [documentation website](https://docs.iota.org/docs/node-software/0.1/iri/introduction/overview)
- [IRI API reference](https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference)
After every release, we upload a pre-built Java file onto the [GitHub Releases page](https://github.com/iotaledger/iri/releases).

You can also use one of these great community guides:
- [IOTA Partners guide](https://iota.partners/)
- [IRI Playbook](https://iri-playbook.readthedocs.io/en/master/index.html)
You can simply download the latest `.jar` file.

# Installing
### Compiling the Java file

The preferred option is that you compile yourself.
The second option is that you utilize the provided jar,
which is released whenever there is a new update here: [Github Releases](https://github.com/iotaledger/iri/releases).
To compile the Java file yourself, do the following on a Linux operating system:

### Compiling yourself

Make sure to have Maven and Java 8 installed on your computer.

#### To compile & package
```
$ git clone https://github.com/iotaledger/iri
$ cd iri
$ mvn clean compile
$ mvn package
```bash
git clone https://github.com/iotaledger/iri
cd iri
mvn clean package
```

This will create a `target` directory in which you will find the executable jar file that you can use.
Your `.jar` file is in the `target` directory.

### How to run IRI
# Getting started

#### Locally
For instructions on running IRI, see the [documentation portal](https://docs.iota.org/docs/node-software/0.1/iri/how-to-guides/install-iri).

Running IRI is quick and easy, and you can usually run it without admin rights.
Below is a list of command line options.
## API reference

At a minimum, the port must be specified on the command-line — e.g., '`-p 14265`'
or in the `iota.ini` file — e.g., '`PORT = 14265`'.
For an API reference, see the [documentation portal](https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference).

If the '`iota.ini`' file exists, it will be read.
The port and all the command line options below take precedence over values specified in the ini config file.
## Supporting the project

Here is an example script that specifies only the port, with all other settings to be read from the ini file **if it exists**:

```
java -jar iri.jar -p 14265
```
If the IOTA JavaScript client library has been useful to you and you feel like contributing, consider posting a [bug report](https://github.com/iotaledger/iri/issues/new), [feature request](https://github.com/iotaledger/iri/issues/new) or a [pull request](https://github.com/iotaledger/iri/pulls/).

### Docker
Please read the following before contributing:

Create an iota.ini file with all of your configuration variables set in it.
Any that you don't provide in here will be assumed to be default or taken from
command line arguments.
- [Contributing guidelines](CONTRIBUTING.md)
- [Code styleguide](STYLEGUIDE.md)
- [Responsible disclosure policy](SECURITY.MD)

`docker run -d --net=host --name iota-node -v iota.ini:/iri/iota.ini iotaledger/iri:latest`
## Joining the discussion

### Command Line Options
A complete list can be found [here](https://docs.iota.org/docs/node-software/0.1/iri/references/iri-configuration-options). The following table are the most frequently used arguments:

Option | Shortened version | Description | Example Input
--- | --- | --- | ---
`--port` | `-p` | This is a *mandatory* option that defines the port to be used to send API commands to your node | `-p 14265`
`--neighbors` | `-n` | Neighbors that you are connected with will be added via this option. | `-n "tcp://148.148.148.148:15600 tcp://[2001:db8:a0b:12f0::1]:15600"`
`--config` | `-c` | Config INI file that can be used instead of CLI options. See more below | `-c iri.ini`
`--neighboring-socket-port` | `-t` | TCP receiver port | `-t 15600`
`--testnet` | | Makes it possible to run IRI with the IOTA testnet | `--testnet true`
`--remote` | | Remotely access your node and send API commands | `--remote true`
`--remote-auth` | | Require authentication password for accessing remotely. Requires a correct `username:hashedpassword` combination | `--remote-auth iotatoken:LL9EZFNCHZCMLJLVUBCKJSWKFEXNYRHHMYS9XQLUZRDEKUUDOCMBMRBWJEMEDDXSDPHIGQULENCRVEYMO`
`--remote-limit-api` | | Exclude certain API calls from being able to be accessed remotely | `--remote-limit-api "attachToTangle, addNeighbors"`
`--send-limit`| | Limit the outbound bandwidth consumption. Limit is set to mbit/s | `--send-limit 1.0`
`--max-peers` | | Limit the number of max accepted peers. Default is set to 0 (mutual tethering) | `--max-peers 8`
`--dns-resolution` | | Toggle DNS resolution refreshing | `--dns-resolution false`
### INI File

You can also provide a .ini file to store all of your command line options and easily update (especially neighbors) if needed. You can enable it via the `--config` or the `-c` flag. If no flag is supplied, IRI attempts to load from the `iota.ini` file.
Every command line option can be used as a configuration field by replacing the `-` with a `_` (Snake case) and removing the initial `--`. They are case insensitive but it is good habit to make the fields upper case to prevent mixing configuration and command line.

Here is an example INI file:
```
[IRI]
PORT = 14265
NEIGHBORING_SOCKET_PORT = 15600
NEIGHBORS = tcp://my.favorite.com:15600 tcp://my.other.favorite.com:15600
IXI_DIR = ixi
DEBUG = false
DB_PATH = mainnetdb
```
If you want to get involved in the community, need help with getting set up, have any issues related to IRI, or just want to discuss IOTA, Distributed Registry Technology (DRT) and IoT with other people, feel free to join our [Discord](https://discord.iota.org/).

### Special Thanks To
## Special thanks

### ![alt text](https://www.yourkit.com/images/yklogo.png)

YourKit supports open source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a>
and <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>,
innovative and intelligent tools for profiling Java and .NET applications.
YourKit supports open-source projects with its full-featured Java Profiler.
YourKit, LLC is the creator of <a href="https://www.yourkit.com/java/profiler/">YourKit Java Profiler</a> and <a href="https://www.yourkit.com/.net/profiler/">YourKit .NET Profiler</a>, innovative and intelligent tools for profiling Java and .NET applications.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.iota</groupId>
<artifactId>iri</artifactId>
<version>1.8.4</version>
<version>1.9.0</version>
<name>IRI</name>
<description>IOTA Reference Implementation</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Feature: Test API calls on Machine 1
|tips |
|transactionsToRequest |
|coordinatorAddress |
|dbSizeInBytes |


Scenario: GetNeighbors is called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: Test transaction confirmation
|transactions |evaluate_and_send |responseValue |

#Give the node 10 seconds to solidify the milestone
And we wait "10" second/seconds
And we wait "15" second/seconds

Then "getInclusionStates" is called on "nodeA-m2" with:
|keys |values |type |
Expand Down Expand Up @@ -62,7 +62,7 @@ Feature: Test transaction confirmation
|transactions |evaluate_and_send |responseValue |

#Give the node time to solidify the milestone
And we wait "10" second/seconds
And we wait "15" second/seconds

Then "getInclusionStates" is called on "nodeA-m2" with:
|keys |values |type |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void initializeCaches() {
new CacheConfigurationImpl(dbConfig.getTxCacheSize(), dbConfig.getTxCacheReleaseCount()));
add(ApproveeViewModel.class,
new CacheConfigurationImpl(dbConfig.getTxCacheSize(), dbConfig.getTxCacheReleaseCount()));
add(MilestoneViewModel.class, new CacheConfigurationImpl(dbConfig.getMilestoneBatchWrite(),
add(MilestoneViewModel.class, new CacheConfigurationImpl(dbConfig.getMilestoneCacheSize(),
dbConfig.getMilestoneCacheReleaseCount()));
}

Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/iota/iri/conf/BaseIotaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public abstract class BaseIotaConfig implements IotaConfig {

// Cache
protected int txCacheSize = Defaults.TX_CACHE_SIZE;
protected int milestoneBatchWrite = Defaults.MILESTONE_CACHE_SIZE;
protected int milestoneCacheSize = Defaults.MILESTONE_CACHE_SIZE;
protected int txCacheReleaseCount = Defaults.TX_CACHE_RELEASE_COUNT;
protected int milestoneCacheReleaseCount = Defaults.MILESTONE_CACHE_RELEASE_COUNT;

Expand Down Expand Up @@ -462,18 +462,18 @@ protected void setTxCacheSize(int txCacheSize) {
}

@Override
public int getMilestoneBatchWrite() {
return milestoneBatchWrite;
public int getMilestoneCacheSize() {
return milestoneCacheSize;
}

@JsonProperty
@Parameter(names = { "--milestone-cache-size" }, description = DbConfig.Descriptions.MILESTONE_CACHE_SIZE)
protected void setMilestoneBatchWrite(int milestoneBatchWrite) {
if (milestoneBatchWrite < 1 || milestoneBatchWrite > Defaults.MAX_MILESTONE_CACHE_SIZE) {
protected void setMilestoneCacheSize(int milestoneCacheSize) {
if (milestoneCacheSize < 1 || milestoneCacheSize > Defaults.MAX_MILESTONE_CACHE_SIZE) {
throw new ParameterException("MILESTONE_CACHE_SIZE should be between 1 and "
+ Defaults.MAX_MILESTONE_CACHE_SIZE + ". (found " + milestoneBatchWrite + ")");
+ Defaults.MAX_MILESTONE_CACHE_SIZE + ". (found " + milestoneCacheSize + ")");
}
this.milestoneBatchWrite = milestoneBatchWrite;
this.milestoneCacheSize = milestoneCacheSize;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/iota/iri/conf/DbConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public interface DbConfig extends Config {
*
* @return {@value DbConfig.Descriptions#MILESTONE_CACHE_SIZE}
*/
int getMilestoneBatchWrite();
int getMilestoneCacheSize();

/**
* Default Value: {@value BaseIotaConfig.Defaults#TX_CACHE_RELEASE_COUNT}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/iota/iri/conf/SnapshotConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ interface Descriptions {
String LOCAL_SNAPSHOTS_INTERVAL_SYNCED = "Take local snapshots every n milestones if the node is fully synced.";
String LOCAL_SNAPSHOTS_INTERVAL_UNSYNCED = "Take local snapshots every n milestones if the node is syncing.";
String LOCAL_SNAPSHOTS_DEPTH = "Number of milestones to keep.";
String LOCAL_SNAPSHOTS_DB_MAX_SIZE = "The maximum size this database should be on disk. Human readable format (GB, GiB, MB, MiB)";
String LOCAL_SNAPSHOTS_DB_MAX_SIZE = "The maximum size this database should be on disk. Human readable format (GB, GiB, MB, MiB)."
+ "If set to -1, the database size will not affect the node.";
String SNAPSHOT_TIME = "Epoch time of the last snapshot.";
String SNAPSHOT_FILE = "Path of the file that contains the state of the ledger at the last snapshot.";
String SNAPSHOT_SIGNATURE_FILE = "Path to the file that contains a signature for the snapshot file.";
Expand Down
24 changes: 0 additions & 24 deletions src/main/java/com/iota/iri/controllers/AddressViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@
import com.iota.iri.storage.Persistable;
import com.iota.iri.storage.Tangle;
import com.iota.iri.utils.Pair;
import pl.touk.throwing.ThrowingFunction;
import pl.touk.throwing.ThrowingPredicate;

import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
* Acts as a controller interface for an {@link Address} set. This controller is used within a
Expand Down Expand Up @@ -43,25 +38,6 @@ private AddressViewModel(Address hashes, Indexable hash) {
this.hash = hash;
}

/**
* Loads all transaction that mutate a certain address. It sorts them by the attachment timestamp. Sorting by
* attachmentTimeStamp is an arbitrary choice.
*
*
* @param tangle The tangle reference for the database to find the {@link Address} set in
* @param hash hash The address we are loading the transactions for
* @return The list of {@link AddressViewModel} controllers generated
* @throws Exception Thrown if the database cannot load an {@link Address} set from the reference {@link Hash}
*/
public static List<TransactionViewModel> loadAsSortedList(Tangle tangle, Indexable hash) throws Exception {
Address hashes = (Address) tangle.load(Address.class, hash);
return hashes.set.stream()
.filter(ThrowingPredicate.unchecked(hash1 -> TransactionViewModel.exists(tangle, hash1)))
.map(ThrowingFunction.unchecked(item -> TransactionViewModel.fromHash(tangle, item)))
.sorted(Comparator.comparing(TransactionViewModel::getAttachmentTimestamp))
.collect(Collectors.toList());
}

/**
* Creates a new {@link Address} set controller. This controller is created by extracting the {@link Address} set
* from the database using the provided {@link Hash} identifier.
Expand Down
Loading

0 comments on commit 6798bb2

Please sign in to comment.