Adding transaction case classes

This commit is contained in:
Chris Stewart 2015-07-15 11:47:46 -05:00
parent 7962f829dc
commit 235ece9111
3 changed files with 43 additions and 0 deletions

View 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)

View 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])

View 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 {
}