mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-18 05:13:29 +01:00
Adding transaction case classes
This commit is contained in:
parent
f58df358da
commit
226bc0d43d
14
src/main/scala/org/scalacoin/protocol/CommonStructures.scala
Normal file
14
src/main/scala/org/scalacoin/protocol/CommonStructures.scala
Normal file
@ -0,0 +1,14 @@
|
||||
package org.scalacoin.protocol
|
||||
|
||||
/**
|
||||
* Created by chris on 7/14/15.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Variable length integer
|
||||
* Integer can be encoded depending on the represented value to save space.
|
||||
* Variable length integers always precede an array/vector of a type of data that may vary in length.
|
||||
* Longer numbers are encoded in little endian.
|
||||
* @param value
|
||||
*/
|
||||
case class VarInt( value : String)
|
15
src/main/scala/org/scalacoin/protocol/Tx.scala
Normal file
15
src/main/scala/org/scalacoin/protocol/Tx.scala
Normal file
@ -0,0 +1,15 @@
|
||||
package org.scalacoin.protocol
|
||||
|
||||
|
||||
/**
|
||||
* Created by chris on 7/14/15.
|
||||
*/
|
||||
case class Tx(version : Long, txInCount : VarInt, txIn : Seq[TxIn], txOutCount : VarInt, txOut : TxOut, lockTime : Long)
|
||||
|
||||
|
||||
case class TxIn(prevousOutput : OutPoint, scriptLength : VarInt, scriptSignature : Seq[Char], sequence : Long)
|
||||
|
||||
case class OutPoint(hash : Seq[Char], index : Long)
|
||||
|
||||
case class TxOut(value : Long, pkScriptLength : VarInt, pkScript : Seq[Char])
|
||||
|
14
src/test/scala/org/scalacoin/protocol/TxTest.scala
Normal file
14
src/test/scala/org/scalacoin/protocol/TxTest.scala
Normal file
@ -0,0 +1,14 @@
|
||||
package org.scalacoin.protocol
|
||||
|
||||
import org.scalatest.FlatSpec
|
||||
import org.scalatest.MustMatchers
|
||||
|
||||
/**
|
||||
* Created by chris on 7/14/15.
|
||||
*/
|
||||
class TxTest extends FlatSpec with MustMatchers {
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user