Skip to content

Instantly share code, notes, and snippets.

@noroutine
Last active February 26, 2016 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noroutine/284103fb82dd7404a7e5 to your computer and use it in GitHub Desktop.
Save noroutine/284103fb82dd7404a7e5 to your computer and use it in GitHub Desktop.
Dominion P2P structures
/**
Computed game state
*/
type GameState struct {
Copper, Silver, Gold int64 // amount of gold cards of value 1, 2 and 3 respectively
V1, V3, V6 int64 // amount of victory cards fo value 1, 3, 6 respectively
Actions map[string] int64 // amount of 10 action cards from the game box
Curse int64 // amount of curse cards
Trash []string // trash deck
}
/**
Transaction record
*/
type TransactionRecord struct {
Id []byte // hash of current transaction
Prev []byte // reference to hash of previous transaction in the game
Tx []byte // one of areed transaction descriptions (byte representation)
Sig []byte // signature of Prev + T
}
var gameStart TransactionRecord // root of transaction tree (constitues initial game state)
var latest TransactionRecord // latest aggreed transaction
var txIndex TransactionIndex // index of the transaction database to quickly find transaction by Id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment