This file contains hidden or 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
| def reemissionBoxProp(s: MonetarySettings): ErgoTree = { | |
| val rewardOut = ByIndex(Outputs, IntConstant(0)) | |
| val heightCorrect = EQ(boxCreationHeight(rewardOut), Height) | |
| val heightIncreased = GT(Height, boxCreationHeight(Self)) | |
| val validPeriod = GE(Height, IntConstant(2080800)) | |
| val coinsToIssue = s.oneEpochReduction // 3 ERG | |
| val correctCoinsIssued = EQ(coinsToIssue, Minus(ExtractAmount(Self), ExtractAmount(rewardOut))) | |
| val sponsored = GT(ExtractAmount(rewardOut), ExtractAmount(Self)) |
This file contains hidden or 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
| package org.ergoplatform.wallet.serialization | |
| import org.ergoplatform.{ErgoLikeTransactionSerializer, JsonCodecs} | |
| import scorex.util.encode.Base16 | |
| object TransactionParser extends App { | |
| val bytes = Base16.decode("...").get | |
| val tx = ErgoLikeTransactionSerializer.fromBytes(bytes) | |
| JsonCodecsWrapper.ergoLikeTransactionDecoder.decodeJson(j) |
This file contains hidden or 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
| object MiningAddresses extends App { | |
| val address = "9fAuYCJ9pCfL8cNn2nsoUhYqmjkjP78Y2KzSptu769nYHGSXVir" | |
| val enc = new ErgoAddressEncoder(ErgoAddressEncoder.MainnetNetworkPrefix) | |
| val addr = enc.fromString(address).get.asInstanceOf[P2PKAddress] | |
| val script = ErgoScriptPredef.rewardOutputScript(720, addr.pubkey) | |
| println(Pay2SAddress(script)(enc)) | |
| } |
This file contains hidden or 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
| object ValueEncoder extends App { | |
| val pd = ErgoAddressEncoder | |
| .apply(ErgoAddressEncoder.MainnetNetworkPrefix) | |
| .fromString("9gmNsqrqdSppLUBqg2UzREmmivgqh1r3jmNcLAc53hk3YCvAGWE") | |
| .get | |
| .asInstanceOf[P2PKAddress] | |
| .pubkey | |
| val s = SigmaPropConstant(pd) |
This file contains hidden or 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
| import scalaj.http.{Http, HttpOptions} | |
| import scala.util.Try | |
| object Connector extends App { | |
| var prevPoolDatapoint = 0L | |
| (1 to 10000000).foreach {_ => | |
| val t = Try { |
This file contains hidden or 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
| ergo { | |
| node { | |
| stateType = "digest" | |
| blocksToKeep = 2880 | |
| mining = false | |
| } | |
| } | |
| scorex { |
This file contains hidden or 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
| package org.ergoplatform.wallet; | |
| import org.ergoplatform.*; | |
| import org.ergoplatform.wallet.interface4j.crypto.ErgoUnsafeProver; | |
| import org.ergoplatform.wallet.secrets.ExtendedSecretKey; | |
| import scorex.util.Random; | |
| public class CreateTransactionDemo { | |
| /** |
This file contains hidden or 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
| package org.ergoplatform.wallet; | |
| import org.ergoplatform.ErgoAddressEncoder; | |
| import org.ergoplatform.P2PKAddress; | |
| import org.ergoplatform.wallet.mnemonic.Mnemonic; | |
| import org.ergoplatform.wallet.secrets.DerivationPath; | |
| import org.ergoplatform.wallet.secrets.ExtendedPublicKey; | |
| import org.ergoplatform.wallet.secrets.ExtendedSecretKey; | |
| import scala.Option; |
This file contains hidden or 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
| object v2testing extends App { | |
| implicit val ec: scala.concurrent.ExecutionContext = scala.concurrent.ExecutionContext.global | |
| private val ergoSettings: ErgoSettings = ErgoSettings.read(Args(Some("/home/kushti/ergo/mainnet/mainnet.conf"), Some(NetworkType.MainNet))) | |
| val ntp = new NetworkTimeProvider(ergoSettings.scorexSettings.ntp) | |
| val ldc = new LinearDifficultyControl(ergoSettings.chainSettings) | |
| val eh = ErgoHistory.readOrGenerate(ergoSettings, ntp) |
This file contains hidden or 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
| property("testvectors from WP") { | |
| val msg = Base16.decode("82dbfccc40aa9919d21dd2bad90935ec44db013738592466e5dad1fa051cb4ff").get | |
| val nonce = Base16.decode("E8F2800001A12388").get | |
| val height = 5090 | |
| val h = Ints.toByteArray(height) | |
| val pow = new AutolykosPowScheme(32, 26) |