mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-25 07:17:32 +01:00
Merge branch 'master' into blockchain_package_and_base_traits
This commit is contained in:
commit
a2cf7d7b81
4 changed files with 26 additions and 37 deletions
34
README.md
34
README.md
|
@ -20,17 +20,17 @@ Here is an example scala console session with bitcoin-core-s
|
||||||
```scala
|
```scala
|
||||||
chris@chris:~/dev/bitcoins-core-chris$ sbt console
|
chris@chris:~/dev/bitcoins-core-chris$ sbt console
|
||||||
|
|
||||||
scala> import org.bitcoins.protocol.transaction._
|
scala> import org.bitcoins.core.protocol.transaction._
|
||||||
import org.bitcoins.protocol.transaction._
|
import org.bitcoins.protocol.transaction._
|
||||||
|
|
||||||
scala> import org.bitcoins.protocol.script._
|
scala> import org.bitcoins.core.protocol.script._
|
||||||
import org.bitcoins.protocol.script._
|
import org.bitcoins.protocol.script._
|
||||||
|
|
||||||
scala> val simpleRawTransaction = "0100000001ccf318f0cbac588a680bbad075aebdda1f211c94ba28125b0f627f9248310db3000000006b4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353ffffffff0210335d05000000001976a914b1d7591b69e9def0feb13254bace942923c7922d88ac48030000000000001976a9145e690c865c2f6f7a9710a474154ab1423abb5b9288ac00000000"
|
scala> val simpleRawTransaction = "0100000001ccf318f0cbac588a680bbad075aebdda1f211c94ba28125b0f627f9248310db3000000006b4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353ffffffff0210335d05000000001976a914b1d7591b69e9def0feb13254bace942923c7922d88ac48030000000000001976a9145e690c865c2f6f7a9710a474154ab1423abb5b9288ac00000000"
|
||||||
simpleRawTransaction: String = 0100000001ccf318f0cbac588a680bbad075aebdda1f211c94ba28125b0f627f9248310db3000000006b4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353ffffffff0210335d05000000001976a914b1d7591b69e9def0feb13254bace942923c7922d88ac48030000000000001976a9145e690c865c2f6f7a9710a474154ab1423abb5b9288ac00000000
|
simpleRawTransaction: String = 0100000001ccf318f0cbac588a680bbad075aebdda1f211c94ba28125b0f627f9248310db3000000006b4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353ffffffff0210335d05000000001976a914b1d7591b69e9def0feb13254bace942923c7922d88ac48030000000000001976a9145e690c865c2f6f7a9710a474154ab1423abb5b9288ac00000000
|
||||||
|
|
||||||
scala> val tx = Transaction(simpleRawTransaction)
|
scala> val tx = Transaction(simpleRawTransaction)
|
||||||
tx: org.bitcoins.protocol.transaction.Transaction = TransactionImpl(1,List(TransactionInputImpl(TransactionOutPointImpl(b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc,0),P2PKHScriptSignatureImpl(4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353,List(BytesToPushOntoStackImpl(72), ScriptConstantImpl(30450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01), BytesToPushOntoStackImpl(33), ScriptConstantImpl(0241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353))),4294967295)),List(TransactionOutputImpl(89994000 ...
|
tx: org.bitcoins.core.protocol.transaction.Transaction = TransactionImpl(1,List(TransactionInputImpl(TransactionOutPointImpl(b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc,0),P2PKHScriptSignatureImpl(4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353,List(BytesToPushOntoStackImpl(72), ScriptConstantImpl(30450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01), BytesToPushOntoStackImpl(33), ScriptConstantImpl(0241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353))),4294967295)),List(TransactionOutputImpl(89994000 ...
|
||||||
```
|
```
|
||||||
|
|
||||||
This gives us an example of a bitcoin transaction that is encoded in hex format that is deserialized to a native Scala object called a Transaction.
|
This gives us an example of a bitcoin transaction that is encoded in hex format that is deserialized to a native Scala object called a Transaction.
|
||||||
|
@ -53,33 +53,33 @@ Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_9
|
||||||
Type in expressions to have them evaluated.
|
Type in expressions to have them evaluated.
|
||||||
Type :help for more information.
|
Type :help for more information.
|
||||||
|
|
||||||
scala> import org.bitcoins.protocol.script._
|
scala> import org.bitcoins.core.protocol.script._
|
||||||
import org.bitcoins.protocol.script._
|
import org.bitcoins.core.protocol.script._
|
||||||
|
|
||||||
scala> import org.bitcoins.protocol.transaction._
|
scala> import org.bitcoins.core.protocol.transaction._
|
||||||
import org.bitcoins.protocol.transaction._
|
import org.bitcoins.core.protocol.transaction._
|
||||||
|
|
||||||
scala> import org.bitcoins.script._
|
scala> import org.bitcoins.core.script._
|
||||||
import org.bitcoins.script._
|
import org.bitcoins.core.script._
|
||||||
|
|
||||||
scala> import org.bitcoins.script.interpreter._
|
scala> import org.bitcoins.core.script.interpreter._
|
||||||
import org.bitcoins.script.interpreter._
|
import org.bitcoins.core.script.interpreter._
|
||||||
|
|
||||||
scala> import org.bitcoins.policy._
|
scala> import org.bitcoins.core.policy._
|
||||||
import org.bitcoins.policy._
|
import org.bitcoins.core.policy._
|
||||||
|
|
||||||
scala> val spendingTx = Transaction("0100000001ccf318f0cbac588a680bbad075aebdda1f211c94ba28125b0f627f9248310db3000000006b4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353ffffffff0210335d05000000001976a914b1d7591b69e9def0feb13254bace942923c7922d88ac48030000000000001976a9145e690c865c2f6f7a9710a474154ab1423abb5b9288ac00000000")
|
scala> val spendingTx = Transaction("0100000001ccf318f0cbac588a680bbad075aebdda1f211c94ba28125b0f627f9248310db3000000006b4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353ffffffff0210335d05000000001976a914b1d7591b69e9def0feb13254bace942923c7922d88ac48030000000000001976a9145e690c865c2f6f7a9710a474154ab1423abb5b9288ac00000000")
|
||||||
spendingTx: org.bitcoins.protocol.transaction.Transaction = TransactionImpl(1,List(TransactionInputImpl(TransactionOutPointImpl(b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc,0),P2PKHScriptSignatureImpl(4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353,List(BytesToPushOntoStackImpl(72), ScriptConstantImpl(30450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01), BytesToPushOntoStackImpl(33), ScriptConstantImpl(0241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353))),4294967295)),List(TransactionOutputImpl(8...
|
spendingTx: org.bitcoins.core.protocol.transaction.Transaction = TransactionImpl(1,List(TransactionInputImpl(TransactionOutPointImpl(b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc,0),P2PKHScriptSignatureImpl(4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353,List(BytesToPushOntoStackImpl(72), ScriptConstantImpl(30450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01), BytesToPushOntoStackImpl(33), ScriptConstantImpl(0241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353))),4294967295)),List(TransactionOutputImpl(8...
|
||||||
scala> val scriptPubKey = ScriptPubKey("76a91431a420903c05a0a7de2de40c9f02ebedbacdc17288ac")
|
scala> val scriptPubKey = ScriptPubKey("76a91431a420903c05a0a7de2de40c9f02ebedbacdc17288ac")
|
||||||
scriptPubKey: org.bitcoins.protocol.script.ScriptPubKey = P2PKHScriptPubKeyImpl(76a91431a420903c05a0a7de2de40c9f02ebedbacdc17288ac,List(OP_DUP, OP_HASH160, BytesToPushOntoStackImpl(20), ScriptConstantImpl(31a420903c05a0a7de2de40c9f02ebedbacdc172), OP_EQUALVERIFY, OP_CHECKSIG))
|
scriptPubKey: org.bitcoins.core.protocol.script.ScriptPubKey = P2PKHScriptPubKeyImpl(76a91431a420903c05a0a7de2de40c9f02ebedbacdc17288ac,List(OP_DUP, OP_HASH160, BytesToPushOntoStackImpl(20), ScriptConstantImpl(31a420903c05a0a7de2de40c9f02ebedbacdc172), OP_EQUALVERIFY, OP_CHECKSIG))
|
||||||
|
|
||||||
scala> val inputIndex = 0
|
scala> val inputIndex = 0
|
||||||
inputIndex: Int = 0
|
inputIndex: Int = 0
|
||||||
|
|
||||||
scala> val program = ScriptProgram(spendingTx,scriptPubKey,inputIndex, Policy.standardScriptVerifyFlags)
|
scala> val program = ScriptProgram(spendingTx,scriptPubKey,inputIndex, Policy.standardScriptVerifyFlags)
|
||||||
program: org.bitcoins.script.PreExecutionScriptProgram = PreExecutionScriptProgramImpl(TransactionSignatureComponentImpl(TransactionImpl(1,List(TransactionInputImpl(TransactionOutPointImpl(b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc,0),P2PKHScriptSignatureImpl(4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353,List(BytesToPushOntoStackImpl(72), ScriptConstantImpl(30450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01), BytesToPushOntoStackImpl(33), ScriptConstantImpl(0241d746ca08da0a668735c3e01c1fa02045f2f399c5937079...
|
program: org.bitcoins.core.script.PreExecutionScriptProgram = PreExecutionScriptProgramImpl(TransactionSignatureComponentImpl(TransactionImpl(1,List(TransactionInputImpl(TransactionOutPointImpl(b30d3148927f620f5b1228ba941c211fdabdae75d0ba0b688a58accbf018f3cc,0),P2PKHScriptSignatureImpl(4830450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01210241d746ca08da0a668735c3e01c1fa02045f2f399c5937079b6434b5a31dfe353,List(BytesToPushOntoStackImpl(72), ScriptConstantImpl(30450221008337ce3ce0c6ac0ab72509f889c1d52701817a2362d6357457b63e3bdedc0c0602202908963b9cf1a095ab3b34b95ce2bc0d67fb0f19be1cc5f7b3de0b3a325629bf01), BytesToPushOntoStackImpl(33), ScriptConstantImpl(0241d746ca08da0a668735c3e01c1fa02045f2f399c5937079...
|
||||||
scala> ScriptInterpreter.run(program)
|
scala> ScriptInterpreter.run(program)
|
||||||
res0: org.bitcoins.script.result.ScriptResult = ScriptOk
|
res0: org.bitcoins.core.script.result.ScriptResult = ScriptOk
|
||||||
```
|
```
|
||||||
# Running tests
|
# Running tests
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,14 @@ trait NetworkParameters {
|
||||||
def network : org.bitcoinj.core.NetworkParameters
|
def network : org.bitcoinj.core.NetworkParameters
|
||||||
def p2pkhNetworkByte : Byte
|
def p2pkhNetworkByte : Byte
|
||||||
def p2shNetworkByte : Byte
|
def p2shNetworkByte : Byte
|
||||||
|
def port : Int
|
||||||
}
|
}
|
||||||
|
|
||||||
trait MainNet extends NetworkParameters {
|
trait MainNet extends NetworkParameters {
|
||||||
override def network = MainNetParams.get
|
override def network = MainNetParams.get
|
||||||
override def p2pkhNetworkByte = 0x00
|
override def p2pkhNetworkByte = 0x00
|
||||||
override def p2shNetworkByte = 0x05
|
override def p2shNetworkByte = 0x05
|
||||||
|
override def port = 8333
|
||||||
}
|
}
|
||||||
|
|
||||||
object MainNet extends MainNet
|
object MainNet extends MainNet
|
||||||
|
@ -23,6 +25,7 @@ trait TestNet3 extends NetworkParameters {
|
||||||
override def network = TestNet3Params.get
|
override def network = TestNet3Params.get
|
||||||
override def p2pkhNetworkByte = 0x6F
|
override def p2pkhNetworkByte = 0x6F
|
||||||
override def p2shNetworkByte = 196.toByte
|
override def p2shNetworkByte = 196.toByte
|
||||||
|
override def port = 18333
|
||||||
}
|
}
|
||||||
|
|
||||||
object TestNet3 extends TestNet3
|
object TestNet3 extends TestNet3
|
||||||
|
@ -31,6 +34,7 @@ trait RegTest extends NetworkParameters {
|
||||||
override def network = RegTestParams.get
|
override def network = RegTestParams.get
|
||||||
override def p2pkhNetworkByte = TestNet3.p2pkhNetworkByte
|
override def p2pkhNetworkByte = TestNet3.p2pkhNetworkByte
|
||||||
override def p2shNetworkByte = TestNet3.p2shNetworkByte
|
override def p2shNetworkByte = TestNet3.p2shNetworkByte
|
||||||
|
override def port = 18444
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input is hashed twice: first with SHA-256 and then with RIPEMD-160.
|
* The input is hashed twice: first with SHA-256 and then with RIPEMD-160.
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +30,7 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input is hashed using RIPEMD-160.
|
* The input is hashed using RIPEMD-160.
|
||||||
*
|
* @param program
|
||||||
* @param program
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
def opRipeMd160(program : ScriptProgram) : ScriptProgram = {
|
def opRipeMd160(program : ScriptProgram) : ScriptProgram = {
|
||||||
|
@ -42,8 +40,7 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input is hashed using SHA-256.
|
* The input is hashed using SHA-256.
|
||||||
*
|
* @param program
|
||||||
* @param program
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
def opSha256(program : ScriptProgram) : ScriptProgram = {
|
def opSha256(program : ScriptProgram) : ScriptProgram = {
|
||||||
|
@ -53,8 +50,7 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input is hashed two times with SHA-256.
|
* The input is hashed two times with SHA-256.
|
||||||
*
|
* @param program
|
||||||
* @param program
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
def opHash256(program : ScriptProgram) : ScriptProgram = {
|
def opHash256(program : ScriptProgram) : ScriptProgram = {
|
||||||
|
@ -64,8 +60,7 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The input is hashed using SHA-1.
|
* The input is hashed using SHA-1.
|
||||||
*
|
* @param program
|
||||||
* @param program
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
def opSha1(program : ScriptProgram) : ScriptProgram = {
|
def opSha1(program : ScriptProgram) : ScriptProgram = {
|
||||||
|
@ -79,7 +74,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
* The signature used by OP_CHECKSIG must be a valid signature for this hash and public key.
|
* The signature used by OP_CHECKSIG must be a valid signature for this hash and public key.
|
||||||
* If it is, 1 is returned, 0 otherwise.
|
* If it is, 1 is returned, 0 otherwise.
|
||||||
* https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L818
|
* https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp#L818
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -139,7 +133,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs OP_CHECKSIG with an OP_VERIFY afterwards
|
* Runs OP_CHECKSIG with an OP_VERIFY afterwards
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -165,7 +158,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
/**
|
/**
|
||||||
* All of the signature checking words will only match signatures to the data
|
* All of the signature checking words will only match signatures to the data
|
||||||
* after the most recently-executed OP_CODESEPARATOR.
|
* after the most recently-executed OP_CODESEPARATOR.
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -194,7 +186,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
* signatures must be placed in the scriptSig using the same order as their corresponding public keys
|
* signatures must be placed in the scriptSig using the same order as their corresponding public keys
|
||||||
* were placed in the scriptPubKey or redeemScript. If all signatures are valid, 1 is returned, 0 otherwise.
|
* were placed in the scriptPubKey or redeemScript. If all signatures are valid, 1 is returned, 0 otherwise.
|
||||||
* Due to a bug, one extra unused value is removed from the stack.
|
* Due to a bug, one extra unused value is removed from the stack.
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -315,7 +306,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs OP_CHECKMULTISIG with an OP_VERIFY afterwards
|
* Runs OP_CHECKMULTISIG with an OP_VERIFY afterwards
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -342,7 +332,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
* This is a higher order function designed to execute a hash function on the stack top of the program
|
* This is a higher order function designed to execute a hash function on the stack top of the program
|
||||||
* For instance, we could pass in CryptoUtil.sha256 function as the 'hashFunction' argument, which would then
|
* For instance, we could pass in CryptoUtil.sha256 function as the 'hashFunction' argument, which would then
|
||||||
* apply sha256 to the stack top
|
* apply sha256 to the stack top
|
||||||
*
|
|
||||||
* @param program the script program whose stack top needs to be hashed
|
* @param program the script program whose stack top needs to be hashed
|
||||||
* @param hashFunction the hash function which needs to be used on the stack top (sha256,ripemd160,etc..)
|
* @param hashFunction the hash function which needs to be used on the stack top (sha256,ripemd160,etc..)
|
||||||
* @return
|
* @return
|
||||||
|
@ -362,7 +351,6 @@ trait CryptoInterpreter extends ControlOperationsInterpreter with BitcoinSLogger
|
||||||
/**
|
/**
|
||||||
* Removes the OP_CODESEPARATOR in the original script according to
|
* Removes the OP_CODESEPARATOR in the original script according to
|
||||||
* the last code separator index in the script
|
* the last code separator index in the script
|
||||||
*
|
|
||||||
* @param program
|
* @param program
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -70,9 +70,6 @@ case object OP_NOP1 extends NOP {
|
||||||
override def opCode = 176
|
override def opCode = 176
|
||||||
}
|
}
|
||||||
|
|
||||||
case object OP_NOP3 extends NOP {
|
|
||||||
override def opCode = 178
|
|
||||||
}
|
|
||||||
case object OP_NOP4 extends NOP {
|
case object OP_NOP4 extends NOP {
|
||||||
override def opCode = 179
|
override def opCode = 179
|
||||||
}
|
}
|
||||||
|
@ -100,5 +97,5 @@ case class UndefinedOP_NOP(opCode : Int) extends ReservedOperation
|
||||||
object ReservedOperation extends ScriptOperationFactory[ReservedOperation] {
|
object ReservedOperation extends ScriptOperationFactory[ReservedOperation] {
|
||||||
lazy val undefinedOpCodes = for {i <- 0xba to 0xff} yield UndefinedOP_NOP(i)
|
lazy val undefinedOpCodes = for {i <- 0xba to 0xff} yield UndefinedOP_NOP(i)
|
||||||
def operations = Seq(OP_RESERVED,OP_VER,OP_VERIF,OP_VERNOTIF,OP_RESERVED, OP_RESERVED1, OP_RESERVED2,
|
def operations = Seq(OP_RESERVED,OP_VER,OP_VERIF,OP_VERNOTIF,OP_RESERVED, OP_RESERVED1, OP_RESERVED2,
|
||||||
OP_NOP, OP_NOP1,OP_NOP3,OP_NOP4,OP_NOP5,OP_NOP6,OP_NOP7,OP_NOP8, OP_NOP9, OP_NOP10) ++ undefinedOpCodes
|
OP_NOP, OP_NOP1,OP_NOP4,OP_NOP5,OP_NOP6,OP_NOP7,OP_NOP8, OP_NOP9, OP_NOP10) ++ undefinedOpCodes
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue