Skip to content

Commit c57dff1

Browse files
authored
* initial commit * some additions
1 parent 0a78fb5 commit c57dff1

File tree

8 files changed

+186
-40
lines changed

8 files changed

+186
-40
lines changed

README.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ At first, you should download latest release from [this page](https://github.com
1616

1717
`$ java -jar EncryCore.jar`
1818

19-
#### 2) From container.Docker Container
20-
Make sure you have docker installed for documentation and guide check [this page](https://docs.docker.com/install/). Once docker is installed, run in terminal following commands:
19+
To run this app with additional configurations you should execute the following command:
2120

22-
`$ docker pull encryfoundation/encry-core`
21+
`$ java -jar EncryCore.jar file_with_your_configurations.conf`
2322

24-
`$ docker run -i --log-driver=none -a stdin -a stdout -a stderr -p 9001:9001 encry-core`
23+
List of default configs you can find in:
2524

26-
#### 3) Compiling from source
25+
`EncryCore/srs/main/resources/configs/`
26+
27+
#### 2) Compiling from source
2728
To run EncryCore node you need JRE 1.8 or later (64-bit version, you can find official [guide here](https://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html)) and sbt(Simple build tool for scala and java applications, [official guide](https://www.scala-sbt.org/1.0/docs/Setup.html)) to be installed. If you running a Windows machine, please make sure, that you have git client installed.
2829

2930
Configuration file is `src/main/resources/application.conf`.
@@ -53,17 +54,21 @@ If you just have installed node, to check that everything is fine you can run :
5354

5455
Here is list of the other valid commands:
5556

56-
Group name | Command | Argument | Description
57-
--- | ---| --- | --- |
58-
node| shutdown| None| Shutdown the node
59-
node| stopMining| None| Node stops mining
60-
node| startMining| None| Node starts mining
61-
wallet| pubKeys| None| Print available public keys
62-
wallet| addrs| None| Print available addresses
63-
wallet| createKey| None| Add key to storage
64-
wallet| balance| None| Show balance of current wallet
65-
wallet| transfer| addr, amount| Transfer `amount` to `addr`ess
66-
app| help| None| Show all supported commands
57+
| Group name | Command | Argument | Meaning
58+
|------------|-----------------|-----------------|--------------------------------
59+
| node | shutdown | None | Shutdown the node
60+
| node | stopMining | None | Node stops mining
61+
| node | startMining | None | Node starts mining
62+
| settings | addPeer | host, port | Add peer to 'knownPeers'
63+
| wallet | pubKeys | None | Print available public keys
64+
| wallet | privKeys | None | Print available private keys
65+
| wallet | addrs | None | Print available addresses
66+
| wallet | createKey | None | Add key to storage
67+
| wallet | balance | None | Show balance of current wallet
68+
| wallet | transfer | addr, amount | Transfer `amount` to `addr`ess
69+
| app | help | None | Show all supported commands
70+
71+
6772

6873
## Running tests
6974

src/main/resources/application.conf

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,76 +12,101 @@
1212
# Number of last blocks to keep with transactions and ADproofs, for all other blocks only header will be stored.
1313
# Keep all blocks from genesis if negative
1414
blocksToKeep = -1
15+
# Maximum number of received from network modifiers, expecting applying
1516
modifiersCacheSize = 3000
1617
# Is the node is doing mining
1718
mining = true
18-
# Number of threads should be used for mining
19+
# Number of actors should be used for mining
1920
numberOfMiningWorkers = 3
2021
# If true, a node generates blocks being offline. The only really useful case for it probably is to start a new
2122
# blockchain
2223
offlineGeneration = false
2324
# Delay for miner after succesful block creation
2425
miningDelay = 5s
26+
# The time during which the transaction is considered valid
2527
utxMaxAge = 1000m
28+
# Period of cleaning memory pool from expired transactions
2629
mempoolCleanupInterval = 180m
30+
# Maximum number of unconfirmed transactions, stored in memory pool
2731
mempoolMaxCapacity = 10000
32+
# Period of sending transactions from memory pool to miner
2833
mempoolTxSendingInterval = 10s
34+
# Period of cleaning bloom filter in memory pool
2935
bloomFilterCleanupInterval = 60m
36+
# Maximum number of elements in bloom filter
3037
bloomFilterCapacity = 10000
38+
# Bloom filter's failure probability
3139
bloomFilterFailureProbability = 0.01
40+
# Is CLI available
3241
useCli = true
33-
loggingMode = "file"
3442
}
35-
// Set main db to node componet. Now avaliable iodb or LevelDb
43+
# Set main db to node componet. Now avaliable iodb or LevelDb
3644
storage {
37-
state = "iodb"
45+
state = "iodb"
3846
auxHistory = "iodb"
39-
history = "iodb"
47+
history = "iodb"
4048
}
49+
# Set password to local wallet and mnemonic key
4150
wallet {
4251
password = "encry"
52+
#seed = ""
4353
}
4454
levelDB {
55+
# Rollback max height
4556
maxVersions = 100
4657
}
4758
network {
59+
# Optional parameter. Used to display custom node name on api. Default node name is network address.
60+
// nodeName = ""
61+
# Address which node will use for network communication
4862
bindAddress = "0.0.0.0:9001"
4963
networkChunkSize = 1000
5064
localOnly = false
65+
# List of peers we will connecting to
5166
knownPeers = ["172.16.11.11:9001", "172.16.11.12:9001", "172.16.11.13:9001", "172.16.11.14:9001",
5267
"172.16.11.15:9001", "172.16.11.16:9001", "172.16.11.17:9001", "172.16.11.18:9001",
5368
"172.16.11.19:9001", "172.16.11.20:9001"]
69+
# Maximum number of connected peers
5470
maxConnections = 20
71+
# Time, after which connection will be closed
5572
connectionTimeout = 1s
73+
# Time of waiting handshake from other peer
5674
handshakeTimeout = 30s
75+
# Will we connect to peers, which are not in 'knownPeers'
5776
connectOnlyWithKnownPeers = false
77+
# Period of sending sync message
5878
syncInterval = 15s
79+
# Time of waiting peers on PeerSynchronizer from PeerManager
5980
syncTimeout = 5s
81+
# Number of modifiers in sync message
6082
syncPacketLength = 1000
83+
# Time of waiting requested modifier
6184
deliveryTimeout = 120s
85+
# Maximum number of re-ask requested modiifer
6286
maxDeliveryChecks = 5
87+
# Version of app
6388
appVersion = 0.9.3
89+
# Maximum number of modifiers in Inv network message
6490
maxInvObjects = 1000
91+
# Time of asking new modifiers
6592
modifierDeliverTimeCheck = 60s
6693
}
6794
restApi {
95+
# Is api available
6896
enabled = true
97+
# Address which node will use for http communication
6998
bindAddress = "0.0.0.0:9051"
7099
corsAllowed = true
100+
# Period, during which node must give response on http request
71101
timeout = 5s
72102
}
103+
# NTP settings
73104
ntp {
74105
server = "pool.ntp.org"
75106
updateEvery = 30m
76107
timeout = 30s
77108
}
78-
testing {
79-
defaultRecipientAddress = "3jSD9fwHEHJwHq99ARqhnNhqGXeKnkJMyX4FZjHV6L3PjbCmjG"
80-
minimalFee = 100
81-
amount = 100
82-
# Maximum number of transaction generated per one epoch, set to -1 to avoid limiting
83-
limitPerEpoch = 100
84-
}
109+
# Kamon settings
85110
monitoringSettings {
86111
kamonEnabled = false
87112
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
encry {
3+
# Directory to keep data
4+
directory = ${user.dir}"/encry/data"
5+
node {
6+
# Possible options are:
7+
# "utxo" - keep full utxo set, that allows to validate arbitrary block and generate ADProofs
8+
# "digest" - keep state root hash only and validate transactions via ADProofs
9+
stateMode = "utxo"
10+
# Download block transactions and verify them (requires BlocksToKeep == 0 if disabled)
11+
verifyTransactions = true
12+
# Number of last blocks to keep with transactions and ADproofs, for all other blocks only header will be stored.
13+
# Keep all blocks from genesis if negative
14+
blocksToKeep = -1
15+
# Maximum number of received from network modifiers, expecting applying
16+
modifiersCacheSize = 3000
17+
# Is the node is doing mining
18+
mining = true
19+
# Number of actors should be used for mining
20+
numberOfMiningWorkers = 3
21+
# If true, a node generates blocks being offline. The only really useful case for it probably is to start a new
22+
# blockchain
23+
offlineGeneration = true
24+
# Delay for miner after succesful block creation
25+
miningDelay = 5s
26+
# The time during which the transaction is considered valid
27+
utxMaxAge = 1000m
28+
# Period of cleaning memory pool from expired transactions
29+
mempoolCleanupInterval = 180m
30+
# Maximum number of unconfirmed transactions, stored in memory pool
31+
mempoolMaxCapacity = 10000
32+
# Period of sending transactions from memory pool to miner
33+
mempoolTxSendingInterval = 10s
34+
# Period of cleaning bloom filter in memory pool
35+
bloomFilterCleanupInterval = 60m
36+
# Maximum number of elements in bloom filter
37+
bloomFilterCapacity = 10000
38+
# Bloom filter's failure probability
39+
bloomFilterFailureProbability = 0.01
40+
# Is CLI available
41+
useCli = true
42+
}
43+
# Set main db to node componet. Now avaliable iodb or LevelDb
44+
storage {
45+
state = "iodb"
46+
auxHistory = "iodb"
47+
history = "iodb"
48+
}
49+
# Set password to local wallet and mnemonic key
50+
wallet {
51+
password = "encry"
52+
#seed = ""
53+
}
54+
levelDB {
55+
# Rollback max height
56+
maxVersions = 100
57+
}
58+
network {
59+
# Optional parameter. Used to display custom node name on api. Default node name is network address.
60+
// nodeName = ""
61+
# Address which node will use for network communication
62+
bindAddress = "0.0.0.0:9001"
63+
networkChunkSize = 1000
64+
localOnly = false
65+
# List of peers we will connecting to
66+
knownPeers = []
67+
# Maximum number of connected peers
68+
maxConnections = 20
69+
# Time, after which connection will be closed
70+
connectionTimeout = 1s
71+
# Time of waiting handshake from other peer
72+
handshakeTimeout = 30s
73+
# Will we connect to peers, which are not in 'knownPeers'
74+
connectOnlyWithKnownPeers = false
75+
# Period of sending sync message
76+
syncInterval = 15s
77+
# Time of waiting peers on PeerSynchronizer from PeerManager
78+
syncTimeout = 5s
79+
# Number of modifiers in sync message
80+
syncPacketLength = 1000
81+
# Time of waiting requested modifier
82+
deliveryTimeout = 120s
83+
# Maximum number of re-ask requested modiifer
84+
maxDeliveryChecks = 5
85+
# Version of app
86+
appVersion = 0.9.3
87+
# Maximum number of modifiers in Inv network message
88+
maxInvObjects = 1000
89+
# Time of asking new modifiers
90+
modifierDeliverTimeCheck = 60s
91+
}
92+
restApi {
93+
# Is api available
94+
enabled = true
95+
# Address which node will use for http communication
96+
bindAddress = "0.0.0.0:9051"
97+
corsAllowed = true
98+
# Period, during which node must give response on http request
99+
timeout = 5s
100+
}
101+
# NTP settings
102+
ntp {
103+
server = "pool.ntp.org"
104+
updateEvery = 30m
105+
timeout = 30s
106+
}
107+
# Kamon settings
108+
monitoringSettings {
109+
kamonEnabled = false
110+
}
111+
}
112+
}

src/main/scala/encry/cli/ConsoleListener.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ object ConsoleListener {
3939
def getCommand(cat: String, cmd: String): Option[Command] = cmdDictionary.get(cat).flatMap(_.get(cmd))
4040

4141
private val nodeCmds = Map("node" -> Map(
42-
"shutdown" -> NodeShutdown,
43-
"stopMining" -> StopMine,
42+
"shutdown" -> NodeShutdown,
43+
"stopMining" -> StopMine,
4444
"startMining" -> StartMine,
4545
))
4646

@@ -53,12 +53,12 @@ object ConsoleListener {
5353
))
5454

5555
private val walletCmds = Map("wallet" -> Map(
56-
"addrs" -> PrintAddresses,
56+
"addrs" -> PrintAddresses,
5757
"createKey" -> CreateKey,
58-
"pubKeys" -> PrintPubKeys,
59-
"balance" -> GetBalance,
60-
"transfer" -> Transfer,
61-
"privKey" -> PrintPrivKeys //Todo delete
58+
"pubKeys" -> PrintPubKeys,
59+
"balance" -> GetBalance,
60+
"transfer" -> Transfer,
61+
"privKeys" -> PrintPrivKeys //Todo delete
6262
))
6363

6464
val cmdDictionary: Map[String, Map[String, Command]] =

src/main/scala/encry/cli/commands/AddPeer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import encry.settings.EncryAppSettings
77
import scala.concurrent.Future
88

99
/**
10-
* Command "app peer add -host=<addr[String]> -port=<addr[String]>"
11-
* settings addPeer -host='10.101.0.30' -port=53648
10+
* Command "settings addPeer -host=<addr[String]> -port=<addr[String]>"
11+
* Example: settings addPeer -host='10.101.0.30' -port=53648
1212
*/
1313
object AddPeer extends Command {
1414
override def execute(args: Command.Args, settings: EncryAppSettings): Future[Option[Response]] = {

src/main/scala/encry/cli/commands/Help.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ object Help extends Command {
1717
|node shutdown None Shutdown the node
1818
|node stopMining None Node stops mining
1919
|node startMining None Node starts mining
20+
|settings addPeer host, port Add peer to 'knownPeers'
2021
|wallet pubKeys None Print available public keys
22+
|wallet privKeys None Print available private keys
2123
|wallet addrs None Print available addresses
22-
|wallet createKey None Add key to storage
24+
|wallet createKey None Add key to storage
2325
|wallet balance None Show balance of current wallet
2426
|wallet transfer addr, amount Transfer `amount` to `addr`ess
2527
|app help None Show all supported commands

src/main/scala/encry/cli/commands/PrintPrivKeys.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ object PrintPrivKeys extends Command {
1919
implicit val timeout: Timeout = Timeout(settings.restApi.timeout)
2020
(nodeViewHolder ?
2121
GetDataFromCurrentView[EncryHistory, UtxoState, EncryWallet, Option[Response]] { view =>
22-
Some(Response(view.vault.accountManager.accounts.foldLeft("")((str, k) => str + Algos.encode(k.privKeyBytes)) + "\n"))
22+
Some(Response(view.vault.accountManager.accounts.foldLeft("")((str, k) =>
23+
str + Algos.encode(k.privKeyBytes) + "\n"))
24+
)
2325
}).mapTo[Option[Response]]
2426
}
2527
}

src/main/scala/encry/cli/commands/PrintPubKeys.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object PrintPubKeys extends Command {
1818
implicit val timeout: Timeout = Timeout(settings.restApi.timeout)
1919
(nodeViewHolder ?
2020
GetDataFromCurrentView[EncryHistory, UtxoState, EncryWallet, Option[Response]] { view =>
21-
Some(Response(view.vault.publicKeys.foldLeft("")((str, k) => str + Algos.encode(k.pubKeyBytes)) + "\n"))
21+
Some(Response(view.vault.publicKeys.foldLeft("")((str, k) => str + Algos.encode(k.pubKeyBytes) + "\n")))
2222
}).mapTo[Option[Response]]
2323
}
2424
}

0 commit comments

Comments
 (0)