This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from HelixNetwork/dev
0.6.3
- Loading branch information
Showing
22 changed files
with
302 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
# Helix | ||
|
||
A Quorum based Tangle implementation forked from [**IRI**](https://github.com/iotaledger/iri/). | ||
- **Latest release:** 0.6.1 pre-release | ||
- **Latest release:** 0.6.3 pre-release | ||
- **License:** GPLv3 | ||
|
||
Special thanks to all of the [IOTA Contributors](https://github.com/iotaledger/iri/graphs/contributors)! | ||
|
@@ -38,6 +38,76 @@ Build an executable jar at the `target` directory using maven. | |
Launching a node as a nominee first requires to generate a 64 character hex string, that is used as a seed for key generation. You will find the public key in the last line of the `nominee.key` file contained in the resources directory. If you wish to act as a nominee, please send a request to [email protected] containing your public key. | ||
|
||
java -jar target/helix-<VERSION>.jar -p 8085 --nominee <pathToNomineeSeed> | ||
|
||
|
||
### Nginx cluster sample config | ||
|
||
For production-level applications we recommend exposing a single public API endpoint reverse-proxing multiple fullnode instances. Additionally, we highly recommend obtaining an SSL certificate from a trusted authority (e.g. from Let’s Encrypt). | ||
|
||
Below is a sample configuration file for the popular Nginx webserver (typically put into `/etc/nginx/conf.d/` ). For more information please consult the official Nginx [documentation](https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/) | ||
|
||
``` | ||
upstream helix { | ||
ip_hash; | ||
Server fullnode1.ip.address:8085; | ||
Server fullnode2.ip.address:8085; | ||
} | ||
server { | ||
listen 443 ssl; | ||
listen [::]:443 ssl; | ||
server_name my.api.endpoint.com; | ||
server_tokens off; | ||
ssl_certificate /path/to/cert.pem; | ||
ssl_certificate_key /path/to/key.pem; | ||
ssl_session_timeout 5m; | ||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | ||
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH'; | ||
ssl_prefer_server_ciphers on; | ||
ssl_ecdh_curve secp384r1; | ||
ssl_session_tickets off; | ||
# OCSP stapling | ||
ssl_stapling on; | ||
ssl_stapling_verify on; | ||
resolver 8.8.8.8; | ||
location / { | ||
## CORS | ||
proxy_hide_header Access-Control-Allow-Origin; | ||
add_header 'Access-Control-Allow-Origin' '*' always; | ||
add_header 'Access-Control-Allow-Credentials' 'true'; | ||
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; | ||
if ($request_method = 'OPTIONS') { | ||
add_header 'Access-Control-Allow-Origin' '*'; | ||
add_header 'Access-Control-Allow-Credentials' 'true'; | ||
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range'; | ||
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH'; | ||
add_header 'Access-Control-Max-Age' 1728000; | ||
add_header 'Content-Type' 'text/plain charset=UTF-8'; | ||
add_header 'Content-Length' 0; | ||
return 204; | ||
} | ||
proxy_redirect off; | ||
proxy_set_header host $host; | ||
proxy_set_header X-real-ip $remote_addr; | ||
proxy_set_header X-forward-for $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_pass http://helix; | ||
} | ||
} | ||
``` | ||
|
||
|
||
## Configuration | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 12 additions & 23 deletions
35
src/main/java/net/helix/hlx/model/persistables/Round.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,26 @@ | ||
package net.helix.hlx.model.persistables; | ||
|
||
import net.helix.hlx.model.Hash; | ||
import net.helix.hlx.model.HashFactory; | ||
import net.helix.hlx.model.IntegerIndex; | ||
import net.helix.hlx.utils.Serializer; | ||
|
||
import org.apache.commons.lang3.ArrayUtils; | ||
|
||
import java.util.LinkedHashSet; | ||
|
||
/** | ||
* The Round model class consists of a set of milestone hashes and a corresponding index. | ||
*/ | ||
public class Round extends Hashes { | ||
public IntegerIndex index; | ||
public IntegerIndex index; | ||
|
||
@Override | ||
public byte[] bytes() { | ||
byte[] hashes = set.parallelStream() | ||
.map(Hash::bytes) | ||
.reduce((a,b) -> ArrayUtils.addAll(ArrayUtils.add(a, delimiter), b)) | ||
.orElse(new byte[0]); | ||
return ArrayUtils.addAll(index.bytes(), hashes); | ||
} | ||
@Override | ||
public byte[] bytes() { | ||
return ArrayUtils.addAll(index.bytes(), super.bytes()); | ||
} | ||
|
||
@Override | ||
public void read(byte[] bytes) { | ||
if(bytes != null) { | ||
index = new IntegerIndex(Serializer.getInteger(bytes)); | ||
set = new LinkedHashSet<>((bytes.length - Integer.BYTES) / (1 + Hash.SIZE_IN_BYTES) + 1); | ||
for (int i = Integer.BYTES; i < bytes.length; i += 1 + Hash.SIZE_IN_BYTES) { | ||
set.add(HashFactory.TRANSACTION.create(bytes, i, Hash.SIZE_IN_BYTES)); | ||
} | ||
} | ||
} | ||
@Override | ||
public void read(byte[] bytes) { | ||
if (bytes != null) { | ||
index = new IntegerIndex(Serializer.getInteger(bytes)); | ||
read(bytes, Integer.BYTES); | ||
} | ||
} | ||
} |
Oops, something went wrong.