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 fromSnapshot(prover: BatchAVLProver[Digest32, HF], | |
| settings: ErgoSettings) = { | |
| val stateDir = ErgoState.stateDir(settings) | |
| stateDir.mkdirs() | |
| val constants = StateConstants(settings) | |
| val store = new LDBVersionedStore(stateDir, initialKeepVersions = constants.keepVersions) | |
| val version = store.get(bestVersionKey).map(w => bytesToVersion(w)) | |
| .getOrElse(ErgoState.genesisStateVersion) | |
| val persistentProver: PersistentBatchAVLProver[Digest32, HF] = { |
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 { | |
| keepVersions = 32 | |
| } | |
| } | |
| scorex { | |
| network { | |
| maxConnections = 10 | |
| } |
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 LeifHelp extends App { | |
| val etBytes = Base16.decode("0008cd03e98b0082050a0878b6d1136f2d8cf5e24f7b6d025b2961bffaf5ca3a537a4f52").get | |
| val v = Value.liftByteArray(etBytes) | |
| val bs = ValueSerializer.serialize(v) | |
| println("bs: " + Base16.encode(bs)) | |
| } |
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 { | |
| /** |