-
Notifications
You must be signed in to change notification settings - Fork 10
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 #125 from excelsia/mainnetRelease
Release 0.1.0
- Loading branch information
Showing
14 changed files
with
210 additions
and
52 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
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
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
112 changes: 112 additions & 0 deletions
112
src/test/scala/tools/MainnetGenesisBlockGenerator.scala
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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package tools | ||
|
||
import vee.settings.{GenesisSettings, GenesisTransactionSettings} | ||
import com.wavesplatform.state2.ByteStr | ||
import scorex.account.{Address, AddressScheme, PrivateKeyAccount} | ||
import scorex.block.Block | ||
import vee.consensus.spos.SposConsensusBlockData | ||
import scorex.transaction.{GenesisTransaction, Transaction} | ||
import vee.transaction.{TransactionStatus, ProcessedTransaction} | ||
import scorex.transaction.TransactionParser.SignatureLength | ||
import com.wavesplatform.settings.Constants._ | ||
|
||
import scala.concurrent.duration._ | ||
|
||
object MainnetGenesisBlockGenerator extends App { | ||
|
||
val genesisSigner = PrivateKeyAccount(Array.empty) | ||
val reference = ByteStr(Array.fill(SignatureLength)(-1: Byte)) | ||
val balanceDistributions = Seq(360000060L * UnitsInVee, | ||
154285740L * UnitsInVee, | ||
250971470L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
123428592L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
390857208L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
360000060L * UnitsInVee, | ||
263314330L * UnitsInVee, | ||
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L | ||
) | ||
|
||
// add wallet address | ||
val wallet_addresses = Array ( | ||
"ARMxPV8puShq49KzPoQb5XGttxghvLdMFg1", | ||
"ARFHdvqddPNfMXNt9fgH7Lw1aGRgL29wTKY", | ||
"ARQSe9A3DLryBqN4Y1NV1PhERnuWaDLheza", | ||
"ARHY8cocXeGnH3q4bkLpU56sCg28fF5hSWV", | ||
"ARCry9n7JvHF8rooXiEMhesAHP8zv3sBLDr", | ||
"AR7M83ZypZc5WRzdZHjhULnQ7xzoMM8udJt", | ||
"ARPdpZ9PT5kDbi2U6ZUgxoFwJzFchz7Fcsw", | ||
"ARCK84TwkqzQEksj8pQTxbsCuRY9YGsAbSU", | ||
"ARKbFz4N3f8Rgonf1Afd2aix2QtkCUjnWqW", | ||
"ARRo5K1rfLk9wjXhUjAqxdZjK7LTjx7Y7ki", | ||
"ARBLnj5P9XNspGRGj8UjS1Fny3pkvxJUqJV", | ||
"AR5c7ibqGhkyjzYu143E171TiFdmPFHofKb", | ||
"ARJukkvk47P9JKpdpjbvPQFr8Lv4D8Qsqnn", | ||
"ARBD7fqPGPq5stYKyk3EbZe1w1FDYhh2KnZ", | ||
"ARH6GEvr8FV12HN4rZ969K885sukp5qdNJY", | ||
"AR2pa1RW5jvKV4b7PNnZG7Az6emz5WtiE4r", // with non-zero balance | ||
"ARKMDAveps99s5k9ESiXjcXM9Ddp8p3GGAm", | ||
"ARKM1PkMevWdBjyEeMPAb7vrWWsJptDj891", | ||
"ARCmPJxYBkYAtxnu8qpoLA2iQbf7aJFRX2c", | ||
"ARNP2wJbehKh5Ck4Z2iR4pmnWiwgdsYh6Fw", | ||
"ARQiW9ckRc1GbbuEN3h4s18H8YH8mke15qB", | ||
"ARMfFAXxGZoFpQ7BwSKqjz9u2nxAtBRYXQ5", | ||
"ARM1o54Hdo3hHy83NE4BcmJHEdVUdeULZyZ", | ||
"ARDVLTDWf9Hwe3PBk16SNW7HCZXJPjJ43qE", | ||
"ARNNKhgFhW8ctmQYvckgf81PyHjsxDEzySd", | ||
"AR87ef8yc2Ldt1FGrJi85HW479TVeBCgS5V" //minters | ||
) | ||
|
||
val genesis_slots = Array ( | ||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | ||
0, 4, 12, 16, 24, 28, 36, 40, 48, 52 | ||
) | ||
|
||
def generate(networkByte: Char, averageBlockDelay: FiniteDuration) :(IndexedSeq[(Int, Address)], GenesisSettings) = { | ||
scorex.account.AddressScheme.current = new AddressScheme { | ||
override val chainId: Byte = networkByte.toByte | ||
} | ||
|
||
val timestamp = System.currentTimeMillis() * 1000000L + System.nanoTime() % 1000000L | ||
val initialBalance = balanceDistributions.reduceLeft(_ + _) | ||
|
||
val mt = timestamp/ 4L * 4L / 1000000000L * 1000000000L | ||
|
||
val accounts = wallet_addresses.indices.map(n => n -> Address.fromString(wallet_addresses(n)).right.get) | ||
val genesisTxs = accounts.map { case (n, address) => GenesisTransaction(address, balanceDistributions(n), genesis_slots(n), timestamp, ByteStr.empty) } | ||
|
||
// set the genesisblock's minting Balance to 0 | ||
val genesisBlock = Block.buildAndSign(1, timestamp, reference, SposConsensusBlockData(mt, 0L), | ||
genesisTxs.map{tx: Transaction => ProcessedTransaction(TransactionStatus.Success, tx.transactionFee, tx)}, genesisSigner) | ||
val signature = genesisBlock.signerData.signature | ||
|
||
(accounts, GenesisSettings(timestamp, timestamp, initialBalance, Some(signature), | ||
genesisTxs.map(tx => GenesisTransactionSettings(tx.recipient.stringRepr, tx.amount, tx.slotId)), mt, averageBlockDelay)) | ||
|
||
} | ||
|
||
def print(accs: Seq[(Int, Address)], settings: GenesisSettings): Unit = { | ||
println( | ||
s"""GenesisSettings: | ||
| timestamp: ${settings.timestamp} | ||
| blockTimestamp: ${settings.blockTimestamp} | ||
| averageBlockDelay: ${settings.averageBlockDelay} | ||
| initialBalance: ${settings.initialBalance} | ||
| initialMintTime: ${settings.initialMintTime} | ||
| signature: ${settings.signature} | ||
| transactions: ${settings.transactions.mkString("\n ", "\n ", "")} | ||
""".stripMargin) | ||
} | ||
|
||
val (a, s) = generate('M', 60.seconds) | ||
print(a, s) | ||
|
||
} |
Oops, something went wrong.