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 #2 from Lunes-platform/attachment
Version 0.0.5 : Mainnet signature.
- Loading branch information
Showing
19 changed files
with
84 additions
and
186 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 |
---|---|---|
@@ -1,62 +1,36 @@ | ||
# Lunes node settings | ||
lunes { | ||
directory = "LUNES" | ||
blockchain.type = MAINNET | ||
|
||
network { | ||
known-peers = ["35.190.160.211:5550"] | ||
|
||
# Network address | ||
known-peers = ["52.6.200.147:7770", "54.164.234.204:7770"] | ||
# declared-address = "127.0.0.1:7770" | ||
bind-address = "0.0.0.0" | ||
|
||
# Port number | ||
port = 5550 | ||
port = 7770 | ||
} | ||
|
||
# Wallet settings | ||
wallet { | ||
# Password to protect wallet file | ||
password = "LunesNode" | ||
|
||
# Wallet seed as BASE58 string | ||
# seed = "" | ||
password = "LocalPasswordWallet" | ||
seed = "" | ||
} | ||
|
||
|
||
# Node's REST API settings | ||
rest-api { | ||
# Enable/disable node's REST API | ||
enable = yes | ||
|
||
# Network address to bind to | ||
bind-address = "0.0.0.0" | ||
|
||
# Port to listen to REST API requests | ||
bind-address = "127.0.0.1" | ||
port = 5555 | ||
|
||
# Hash of API key string: "lunes_apikey" | ||
# api-key-hash = "" | ||
# api-key-hash = " | ||
} | ||
|
||
upnp { | ||
enable = yes | ||
enable = no | ||
gateway-timeout = 47s | ||
discover-timeout = 43s | ||
} | ||
|
||
miner { | ||
# Enable/disable block generation | ||
enable = no | ||
|
||
# Required number of connections (both incoming and outgoing) to attempt block generation. Setting this value to 0 | ||
# enables "offline generation". | ||
enable = yes | ||
quorum = 1 | ||
|
||
# Enable block generation only in the last block is not older the given period of time | ||
interval-after-last-block-then-generation-is-allowed = 111d | ||
interval-after-last-block-then-generation-is-allowed = 1d | ||
} | ||
|
||
features { | ||
supported = [2] # NG | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
package io.lunes.transaction | ||
|
||
|
||
import io.lunes.crypto | ||
import io.lunes.transaction.ValidationError.GenericError | ||
import io.lunes.state2.reader.SnapshotStateReader | ||
|
||
/** | ||
* | ||
*/ | ||
object Verifier { | ||
|
||
def apply(s: SnapshotStateReader, currentBlockHeight: Int)(tx: Transaction): Either[ValidationError, Transaction] = tx match { | ||
case _: GenesisTransaction => Right(tx) | ||
case stx: SignedTransaction => stx.signaturesValid() | ||
case pt: ProvenTransaction => (pt, None) match { | ||
case (stx: SignedTransaction, None) => stx.signaturesValid() | ||
case _ => verifyAsEllipticCurveSignature(pt) | ||
} | ||
} | ||
|
||
def verifyAsEllipticCurveSignature[T <: ProvenTransaction](pt: T): Either[ValidationError, T] = | ||
Either.cond( | ||
crypto.verify(pt.proofs.proofs(0).arr, pt.bodyBytes(), pt.sender.publicKey), | ||
pt, | ||
GenericError(s"proof doesn't validate as signature for $pt")) | ||
|
||
} | ||
|
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
Oops, something went wrong.