From db50658823ebd8bfa736819caea1b79cc93ceede Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Sun, 22 May 2016 12:32:52 -0500 Subject: [PATCH] Adding parent trait for individual blockchains called ChainParams --- .../protocol/blockchain/ChainParams.scala | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/main/scala/org/bitcoins/core/protocol/blockchain/ChainParams.scala diff --git a/src/main/scala/org/bitcoins/core/protocol/blockchain/ChainParams.scala b/src/main/scala/org/bitcoins/core/protocol/blockchain/ChainParams.scala new file mode 100644 index 0000000000..3187b63100 --- /dev/null +++ b/src/main/scala/org/bitcoins/core/protocol/blockchain/ChainParams.scala @@ -0,0 +1,53 @@ +package org.bitcoins.core.protocol.blockchain + +/** + * Created by chris on 5/22/16. + * CChainParams defines various tweakable parameters of a given instance of the + * Bitcoin system. There are three: the main network on which people trade goods + * and services, the public test network which gets reset from time to time and + * a regression test mode which is intended for private networks only. It has + * minimal difficulty to ensure that blocks can be found instantly. + * Mimics this C++ interface + * https://github.com/bitcoin/bitcoin/blob/master/src/chainparams.h#L42 + */ +trait ChainParams { + + sealed trait Base58Type + case object PubKeyAddress extends Base58Type + case object ScriptAddress extends Base58Type + case object SecretKey extends Base58Type + case object ExtPublicKey extends Base58Type + case object ExtSecretKey extends Base58Type + + /** + * The gensis block in the blockchain + * @return + */ + def genesisBlock: Block + + /** + * Filter transactions that do not match well-defined patterns + * inside of Policy + * @return + */ + def requireStandardTransaction: Boolean + + /** + * Takes in a Base58Type and returns its base58 prefix + * @param base58 + * @return + */ + def base58Prefix(base58 : Base58Type) : String = base58Prefix(base58) + + /** + * The mapping from a Base58Type to a String + * @return + */ + def base58Prefixes : Map[Base58Type,String] + + /** + * The seeds used to bootstrap the network + * @return + */ + def dnsSeeds : Seq[String] +} \ No newline at end of file