diff --git a/src/main/scala/org/scalacoin/protocol/CommonStructures.scala b/src/main/scala/org/scalacoin/protocol/CommonStructures.scala new file mode 100644 index 0000000000..80bf91eed8 --- /dev/null +++ b/src/main/scala/org/scalacoin/protocol/CommonStructures.scala @@ -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) diff --git a/src/main/scala/org/scalacoin/protocol/Tx.scala b/src/main/scala/org/scalacoin/protocol/Tx.scala new file mode 100644 index 0000000000..76e54ff5c4 --- /dev/null +++ b/src/main/scala/org/scalacoin/protocol/Tx.scala @@ -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]) + diff --git a/src/test/scala/org/scalacoin/protocol/TxTest.scala b/src/test/scala/org/scalacoin/protocol/TxTest.scala new file mode 100644 index 0000000000..34cda8a72b --- /dev/null +++ b/src/test/scala/org/scalacoin/protocol/TxTest.scala @@ -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 { + + + + +}