{
 "format": "zoobc-conformance-vectors/1",
 "edition": "0.6.1",
 "chapter": "16",
 "license": "CC BY 4.0, ZooBC Foundation",
 "cases": [
  {
   "id": "16-1-seats",
   "chapter": "16",
   "section": "1",
   "title": "A ZooBC player and an Ethereum player in the players field",
   "kind": "16-seats",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seats": "00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea\n040000000102030405060708090a0b0c0d0e0f1011121314"
   },
   "expected": {
    "players": "2400000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea18040000000102030405060708090a0b0c0d0e0f1011121314",
    "count": "2",
    "seats": "00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea\n040000000102030405060708090a0b0c0d0e0f1011121314"
   }
  },
  {
   "id": "16-1-malformed",
   "chapter": "16",
   "section": "1",
   "title": "A length of 36 with two bytes after it reads as no player at all",
   "kind": "16-seats",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "players": "240000"
   },
   "expected": {
    "count": "0",
    "seats": ""
   }
  },
  {
   "id": "16-1-pool",
   "chapter": "16",
   "section": "1",
   "title": "The apps pool before any bet: the apps treasury of both genesis files",
   "kind": "reference",
   "validity": "valid",
   "source": "computed",
   "inputs": {},
   "expected": {
    "zbc": "1000000000000000"
   }
  },
  {
   "id": "16-2-roulette",
   "chapter": "16",
   "section": "2",
   "title": "A roulette bet of 10 ZBC on red at height 11,877, its id G from a hash beginning E2400E49C2A0FE49",
   "kind": "16-create-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "body": "12000000000000000000ca9a3b0000000001030001000100",
    "sender": "00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea",
    "hash": "e2400e49c2a0fe49",
    "height": "11877",
    "pool": "1000000000000000"
   },
   "expected": {
    "app_id": "5331875765163016418",
    "status": "Active",
    "players": "2400000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea",
    "state": "010001",
    "resolve_height": "11879",
    "max_payout": "36000000000",
    "cap": "50000000000000"
   },
   "note": "The largest payout the cap tests is per type: roulette is stake x 36."
  },
  {
   "id": "16-2-ttt-invite",
   "chapter": "16",
   "section": "2",
   "title": "A tic-tac-toe app for two at 1 ZBC, inviting one account",
   "kind": "16-create-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "sender": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f505000000000200002400000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   },
   "expected": {
    "status": "Open",
    "pot": "100000000",
    "state": "000000000000000000",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "channel": "0"
   }
  },
  {
   "id": "16-2-ttt-channel",
   "chapter": "16",
   "section": "2",
   "title": "The same as a channel app, between two ZooBC accounts",
   "kind": "16-create-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "sender": "00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f505000000000200002400000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e80701"
   },
   "expected": {
    "status": "Open",
    "pot": "100000000",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "channel": "1"
   }
  },
  {
   "id": "16-2-zbs-opponent",
   "chapter": "16",
   "section": "2",
   "title": "Inviting a ZBS_ address: nobody could join",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f50500000000020000240000000a0000002222222222222222222222222222222222222222222222222222222222222222"
   },
   "expected": {
    "error": "CreateApp: the invited opponent's kind cannot sign, so nobody could join"
   },
   "note": "A stateless check: refused at admission, and a block carrying it is invalid."
  },
  {
   "id": "16-2-channel-eth-creator",
   "chapter": "16",
   "section": "2",
   "title": "A channel app created by an Ethereum account",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "040000000102030405060708090a0b0c0d0e0f1011121314",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f505000000000200002400000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e80701"
   },
   "expected": {
    "error": "CreateApp: a state-channel app's seats sign 64-byte move vouchers, and the creator's kind cannot (create it as an on-chain app; rule canonical_account_forms)"
   }
  },
  {
   "id": "16-2-channel-eth-opponent",
   "chapter": "16",
   "section": "2",
   "title": "A channel app inviting an Ethereum account (49-byte body)",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f5050000000002000018000000040000000102030405060708090a0b0c0d0e0f101112131401"
   },
   "expected": {
    "error": "CreateApp: a state-channel app's seats sign 64-byte move vouchers, and the invited opponent's kind cannot (create it as an on-chain app; rule canonical_account_forms)"
   }
  },
  {
   "id": "16-2-onchain-eth-opponent",
   "chapter": "16",
   "section": "2",
   "title": "The same invitation as an on-chain app (48 bytes) is accepted",
   "kind": "16-create-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "sender": "00000000b6675786bedf28b3e7dcd8bac9bf99758b3a64604570bffd12fd10cbf20b39ea",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f5050000000002000018000000040000000102030405060708090a0b0c0d0e0f1011121314"
   },
   "expected": {
    "status": "Open",
    "opponent": "040000000102030405060708090a0b0c0d0e0f1011121314",
    "channel": "0"
   }
  },
  {
   "id": "16-2-full-key-opponent",
   "chapter": "16",
   "section": "2",
   "title": "An invited opponent in its full-key form (92-byte body)",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f50500000000020000440000000400000079be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
   },
   "expected": {
    "error": "CreateApp: the invited opponent: a full-key account form (an Ethereum or Tron key, a Bitcoin key) is not an account: no transaction can be sent from it; name the 20-byte address (rule canonical_account_forms)"
   }
  },
  {
   "id": "16-2-bare-opponent",
   "chapter": "16",
   "section": "2",
   "title": "The opponent appended without its length",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f5050000000002000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   },
   "expected": {
    "error": "CreateApp body too short"
   }
  },
  {
   "id": "16-2-dice-exact-3",
   "chapter": "16",
   "section": "2",
   "title": "A dice bet on an exact total of 0",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "10000000000000000000e1f505000000000102000300"
   },
   "expected": {
    "error": "dice: exact total must be 2..12"
   }
  },
  {
   "id": "16-2-zbs-creator",
   "chapter": "16",
   "section": "2",
   "title": "A ZBS_ account cannot create an app",
   "kind": "16-create-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "sender": "0a0000002222222222222222222222222222222222222222222222222222222222222222",
    "hash": "0100000000000000",
    "height": "1000",
    "pool": "1000000000000000",
    "body": "01000000000000000000e1f505000000000200002400000000000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   },
   "expected": {
    "error": "CreateApp: apps take a player of a kind that can sign"
   }
  },
  {
   "id": "16-3-join",
   "chapter": "16",
   "section": "3",
   "title": "The invited opponent joins and the app starts",
   "kind": "16-join-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   },
   "expected": {
    "players": "24000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f21522400000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "pot": "200000000",
    "status": "Active",
    "deadline_height": "1240",
    "turn": "-1",
    "resolve_height": "1002"
   }
  },
  {
   "id": "16-3-not-invited",
   "chapter": "16",
   "section": "3",
   "title": "Another account cannot join in the invited opponent's place",
   "kind": "16-join-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67"
   },
   "expected": {
    "error": "JoinApp: not the invited opponent"
   }
  },
  {
   "id": "16-3-not-invited-mined",
   "chapter": "16",
   "section": "3",
   "title": "Mined, that join makes the block invalid",
   "kind": "16-join-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "mined": "true"
   },
   "expected": {
    "error": "Not the invited opponent"
   }
  },
  {
   "id": "16-3-full",
   "chapter": "16",
   "section": "3",
   "title": "A join after the app is full",
   "kind": "16-join-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67"
   },
   "expected": {
    "error": "JoinApp: app is full"
   }
  },
  {
   "id": "16-3-channel-eth",
   "chapter": "16",
   "section": "3",
   "title": "An Ethereum account joins a channel app",
   "kind": "16-join-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "040000000102030405060708090a0b0c0d0e0f1011121314",
    "channel": "1"
   },
   "expected": {
    "error": "JoinApp: a state-channel app's seats sign 64-byte move vouchers, and this kind cannot (rule canonical_account_forms)"
   },
   "note": "The app was created with the 21-byte body 01 0000000000000000 00E1F50500000000 02 0000 01."
  },
  {
   "id": "16-3-channel-eth-mined",
   "chapter": "16",
   "section": "3",
   "title": "Mined, that join makes the block invalid",
   "kind": "16-join-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "040000000102030405060708090a0b0c0d0e0f1011121314",
    "channel": "1",
    "mined": "true"
   },
   "expected": {
    "error": "JoinApp: a state-channel app's seats sign 64-byte move vouchers, and this kind cannot"
   }
  },
  {
   "id": "16-3-onchain-eth",
   "chapter": "16",
   "section": "3",
   "title": "The same join of an on-chain app is accepted",
   "kind": "16-join-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "",
    "stake": "100000000",
    "created_height": "900",
    "height": "1000",
    "timeout": "161280",
    "sender": "040000000102030405060708090a0b0c0d0e0f1011121314",
    "channel": "0"
   },
   "expected": {
    "players": "24000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f215218040000000102030405060708090a0b0c0d0e0f1011121314",
    "pot": "200000000",
    "status": "Active"
   }
  },
  {
   "id": "16-3a-close",
   "chapter": "16",
   "section": "3a",
   "title": "A 2-player app with only its creator closes at 162,280",
   "kind": "16-close-unstarted",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seats": "2",
    "stake": "100000000",
    "created_height": "1000",
    "height": "162280",
    "timeout": "161280",
    "share_bps": "1000",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152"
   },
   "expected": {
    "back": "90000000",
    "pool": "10000000",
    "status": "Cancelled",
    "last_move_height": "162280"
   }
  },
  {
   "id": "16-3a-close-three",
   "chapter": "16",
   "section": "3a",
   "title": "A 4-player app with three players closes",
   "kind": "16-close-unstarted",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seats": "4",
    "stake": "1000000000",
    "created_height": "1000",
    "height": "162280",
    "timeout": "161280",
    "share_bps": "1000",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67\n00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   },
   "expected": {
    "back": "900000000\n900000000\n900000000",
    "pool": "300000000",
    "status": "Cancelled"
   }
  },
  {
   "id": "16-3a-late-join",
   "chapter": "16",
   "section": "3a",
   "title": "A join judged for block 162,280",
   "kind": "16-join-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "77",
    "body": "4d00000000000000",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152",
    "opponent": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "stake": "100000000",
    "created_height": "1000",
    "height": "162280",
    "timeout": "161280",
    "sender": "00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807"
   },
   "expected": {
    "error": "JoinApp: nobody started the app in 161280 blocks; it closes itself at height 162280"
   }
  },
  {
   "id": "16-4-move",
   "chapter": "16",
   "section": "4",
   "title": "Player 0 takes the centre",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010004",
    "state": "000000000000000000",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "state": "000000000100000000",
    "outcome": "0",
    "turn": "1",
    "deadline_height": "1340"
   }
  },
  {
   "id": "16-4-not-your-turn",
   "chapter": "16",
   "section": "4",
   "title": "The same move by the other player",
   "kind": "16-app-move",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010004",
    "state": "000000000000000000",
    "turn": "0",
    "sender": "1"
   },
   "expected": {
    "error": "AppMove: not your turn"
   }
  },
  {
   "id": "16-4-cell-9",
   "chapter": "16",
   "section": "4",
   "title": "Cell 9 is off the board",
   "kind": "16-app-move",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010009",
    "state": "000000000000000000",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "error": "AppMove: illegal move for the current board (square occupied or out of range)"
   }
  },
  {
   "id": "16-4-short",
   "chapter": "16",
   "section": "4",
   "title": "A 9-byte AppMove body",
   "kind": "16-app-move",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "010000000000000001",
    "state": "000000000000000000",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "error": "AppMove body too short"
   }
  },
  {
   "id": "16-7-ttt-1",
   "chapter": "16",
   "section": "7",
   "title": "Tic-tac-toe move 1: player 0 takes cell 4",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010004",
    "state": "000000000000000000",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "state": "000000000100000000",
    "outcome": "0",
    "turn": "1"
   }
  },
  {
   "id": "16-7-ttt-2",
   "chapter": "16",
   "section": "7",
   "title": "Tic-tac-toe move 2: player 1 takes cell 0",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010000",
    "state": "000000000100000000",
    "turn": "1",
    "sender": "1"
   },
   "expected": {
    "state": "020000000100000000",
    "outcome": "0",
    "turn": "0"
   }
  },
  {
   "id": "16-7-ttt-3",
   "chapter": "16",
   "section": "7",
   "title": "Tic-tac-toe move 3: player 0 takes cell 2",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010002",
    "state": "020000000100000000",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "state": "020001000100000000",
    "outcome": "0",
    "turn": "1"
   }
  },
  {
   "id": "16-7-ttt-4",
   "chapter": "16",
   "section": "7",
   "title": "Tic-tac-toe move 4: player 1 takes cell 8",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010008",
    "state": "020001000100000000",
    "turn": "1",
    "sender": "1"
   },
   "expected": {
    "state": "020001000100000002",
    "outcome": "0",
    "turn": "0"
   }
  },
  {
   "id": "16-7-ttt-5",
   "chapter": "16",
   "section": "7",
   "title": "Move 5: player 0 takes cell 6 and completes the diagonal",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010006",
    "state": "020001000100000002",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "state": "020001000100010002",
    "outcome": "1",
    "status": "Finished",
    "payouts": "0 198000000",
    "rake": "2000000"
   }
  },
  {
   "id": "16-1-win",
   "chapter": "16",
   "section": "1",
   "title": "A win of a pot of 2 ZBC: the rake and the winner's share",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010006",
    "state": "020001000100000002",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "payouts": "0 198000000",
    "rake": "2000000"
   }
  },
  {
   "id": "16-7-taken",
   "chapter": "16",
   "section": "7",
   "title": "Player 1 plays the centre after player 0 took it",
   "kind": "16-app-move",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010004",
    "state": "000000000100000000",
    "turn": "1",
    "sender": "1"
   },
   "expected": {
    "error": "AppMove: illegal move for the current board (square occupied or out of range)"
   }
  },
  {
   "id": "16-7-connect4",
   "chapter": "16",
   "section": "7",
   "title": "Connect-4: player 0's fourth piece in column 3 wins",
   "kind": "16-app-move",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "3",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "body": "0100000000000000010003",
    "state": "000000000000000000000000000000000000000000020000010000000200000100000002000001000000",
    "turn": "0",
    "sender": "0"
   },
   "expected": {
    "outcome": "1",
    "status": "Finished",
    "state": "000000000000000000000000000000000001000000020000010000000200000100000002000001000000"
   }
  },
  {
   "id": "16-5-resign",
   "chapter": "16",
   "section": "5",
   "title": "Player 0 resigns a 2-player app of pot 2 ZBC",
   "kind": "16-forfeit",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "state": "000000000100000000",
    "turn": "1",
    "body": "0100000000000000",
    "type": "27",
    "sender": "0"
   },
   "expected": {
    "payouts": "1 198000000",
    "rake": "2000000",
    "winner": "1",
    "status": "Finished"
   }
  },
  {
   "id": "16-1-resign-three",
   "chapter": "16",
   "section": "1",
   "title": "Player 0 resigns a 3-player app of pot 3 ZBC",
   "kind": "16-forfeit",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "3",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67\n00000000120ee4ca9d258d75656901ec4837373e07763369ad75ed8d63fa31c7e0b7e807",
    "stake": "100000000",
    "pot": "300000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "state": "000000000100000000",
    "turn": "1",
    "body": "0100000000000000",
    "type": "27",
    "sender": "0"
   },
   "expected": {
    "payouts": "1 148500000\n2 148500000",
    "rake": "3000000"
   }
  },
  {
   "id": "16-5-early-timeout",
   "chapter": "16",
   "section": "5",
   "title": "A timeout claimed at the deadline",
   "kind": "16-forfeit",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1240",
    "state": "000000000100000000",
    "turn": "1",
    "body": "0100000000000000",
    "type": "28",
    "sender": "0"
   },
   "expected": {
    "error": "ClaimAppTimeout: per-move deadline not yet passed"
   }
  },
  {
   "id": "16-5-stranger-resigns",
   "chapter": "16",
   "section": "5",
   "title": "An account that is not a player resigns",
   "kind": "16-forfeit",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "1",
    "app_type": "1",
    "seats": "2",
    "players": "000000005e8eb28dccaa94a992f7169fa67966207d96aa55df7d24d2d6ec1f538c9f2152\n00000000fd4472bbdec43b919aa37b9b3366a3318f2902a753a15f5fd6d43c44b5121b67",
    "stake": "100000000",
    "pot": "200000000",
    "status": "1",
    "deadline_height": "1240",
    "channel": "0",
    "height": "1100",
    "state": "000000000100000000",
    "turn": "1",
    "body": "0100000000000000",
    "type": "27",
    "sender": "other"
   },
   "expected": {
    "error": "ResignApp: not a player in this app"
   }
  },
  {
   "id": "16-6-roulette-win",
   "chapter": "16",
   "section": "6",
   "title": "The roulette bet resolved at 11,873: red, a win held back by the cap",
   "kind": "16-app-draw",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seed": "5d12257f7b18f8159573c73dc4c0eb3a40c6f805cd8900833d2faf3c3dc5387c842ce45d30128ac7dba7b357636963c28f165cb8ca3fbf1c6e31327fa75cbffc",
    "app_id": "5578600537796526643",
    "x": "0",
    "app_type": "18",
    "params": "010001",
    "stake": "1000000000"
   },
   "expected": {
    "r": "3da4d35b441eb593",
    "roll": "3",
    "payout": "2000000000",
    "paid": "1000000000",
    "owed": "1000000000"
   }
  },
  {
   "id": "16-6-owed-pass",
   "chapter": "16",
   "section": "6",
   "title": "When the next bet is staked at 11,877, block 11,878 pays the owed win",
   "kind": "16-owed-pass",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "owed": "1000000000",
    "paid": "1000000000",
    "inflow": "2000000000",
    "pool": "1000000000000000"
   },
   "expected": {
    "cap": "1000000000",
    "pay": "1000000000",
    "owed": "0"
   }
  },
  {
   "id": "16-6-roulette-loss",
   "chapter": "16",
   "section": "6",
   "title": "The bet G resolved at 11,879: black, lost",
   "kind": "16-app-draw",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seed": "4bcf38e602ccbade2ff12edd238e95271baa0aaaa618db1fba321bf15aa5f1fdb82ce33481b50e8509ec5856304b1f3ea0d0cff02206446e8bb1d5d461939306",
    "app_id": "5331875765163016418",
    "x": "0",
    "app_type": "18",
    "params": "010001",
    "stake": "1000000000"
   },
   "expected": {
    "r": "f0100d1f43848946",
    "roll": "29",
    "payout": "0"
   }
  },
  {
   "id": "16-6-coin-flip",
   "chapter": "16",
   "section": "6",
   "title": "A coin-flip on heads with a zero seed loses",
   "kind": "16-app-draw",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seed": "0000000000000000000000000000000000000000000000000000000000000000",
    "app_id": "7220290349025501074",
    "x": "0",
    "app_type": "17",
    "params": "0001",
    "stake": "100000000"
   },
   "expected": {
    "r": "52c103f98c753fad",
    "roll": "1",
    "payout": "0"
   }
  },
  {
   "id": "16-6-crash",
   "chapter": "16",
   "section": "6",
   "title": "A crash app's first play with a zero seed",
   "kind": "16-app-draw",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "seed": "0000000000000000000000000000000000000000000000000000000000000000",
    "app_id": "-7674452679971341885",
    "x": "0",
    "app_type": "21",
    "params": "9600",
    "stake": "100000000"
   },
   "expected": {
    "r": "280d97a5a37adbba",
    "roll": "194"
   }
  },
  {
   "id": "16-6-crash-0",
   "chapter": "16",
   "section": "6",
   "title": "The crash multiplier at u = 0",
   "kind": "16-crash",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "u": "0"
   },
   "expected": {
    "c": "100"
   }
  },
  {
   "id": "16-6-crash-500000",
   "chapter": "16",
   "section": "6",
   "title": "The crash multiplier at u = 500000",
   "kind": "16-crash",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "u": "500000"
   },
   "expected": {
    "c": "198"
   }
  },
  {
   "id": "16-6-crash-900000",
   "chapter": "16",
   "section": "6",
   "title": "The crash multiplier at u = 900000",
   "kind": "16-crash",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "u": "900000"
   },
   "expected": {
    "c": "990"
   }
  },
  {
   "id": "16-6-crash-999000",
   "chapter": "16",
   "section": "6",
   "title": "The crash multiplier at u = 999000",
   "kind": "16-crash",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "u": "999000"
   },
   "expected": {
    "c": "1000"
   }
  },
  {
   "id": "16-6-crash-491834",
   "chapter": "16",
   "section": "6",
   "title": "The crash multiplier at u = 491834",
   "kind": "16-crash",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "u": "491834"
   },
   "expected": {
    "c": "194"
   }
  },
  {
   "id": "16-8-settle",
   "chapter": "16",
   "section": "8",
   "title": "Three vouchers settle an unfinished tic-tac-toe channel app",
   "kind": "16-settle-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "55",
    "seeds": "51bae95d58f32304a5c9d894819989a4fb04da6115d9a43612a026e7a5dd5d96\n1111111111111111111111111111111111111111111111111111111111111111",
    "pot": "200000000",
    "height": "2000",
    "moves": "0 4\n1 0\n0 2"
   },
   "expected": {
    "settled": "true",
    "final_seq": "3",
    "outcome": "0",
    "winner_seat": "-1",
    "turn": "1",
    "state": "020001000100000000",
    "challenge_deadline_height": "2240",
    "payouts": "0 198000000"
   }
  },
  {
   "id": "16-8-seat-2",
   "chapter": "16",
   "section": "8",
   "title": "A voucher whose seat field is 2",
   "kind": "16-settle-app",
   "validity": "invalid",
   "source": "computed",
   "inputs": {
    "app_id": "55",
    "seeds": "51bae95d58f32304a5c9d894819989a4fb04da6115d9a43612a026e7a5dd5d96\n1111111111111111111111111111111111111111111111111111111111111111",
    "pot": "200000000",
    "height": "2000",
    "moves": "0 4\n2 0"
   },
   "expected": {
    "error": "SettleApp: seat out of range (2-player only)"
   }
  },
  {
   "id": "16-8-wrong-key",
   "chapter": "16",
   "section": "8",
   "title": "A voucher signed by the other player's key settles nothing",
   "kind": "16-settle-app",
   "validity": "valid",
   "source": "computed",
   "inputs": {
    "app_id": "55",
    "seeds": "51bae95d58f32304a5c9d894819989a4fb04da6115d9a43612a026e7a5dd5d96\n1111111111111111111111111111111111111111111111111111111111111111",
    "pot": "200000000",
    "height": "2000",
    "moves": "0 4\n1 0 0\n0 2"
   },
   "expected": {
    "settled": "false"
   }
  }
 ]
}
