# org.lichess.puzzle.attempt

> Published by [pds.dad](https://lexicon.garden/identity/did:plc:rnpkyqnmsw4ipey6eotbdnnf)

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:rnpkyqnmsw4ipey6eotbdnnf/org.lichess.puzzle.attempt)
- [Documentation](https://lexicon.garden/lexicon/did:plc:rnpkyqnmsw4ipey6eotbdnnf/org.lichess.puzzle.attempt/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:rnpkyqnmsw4ipey6eotbdnnf/org.lichess.puzzle.attempt/examples)

## Definitions

### `org.lichess.puzzle.attempt`

**Type**: `record`

A record of a user's attempt at solving an org.lichess.puzzle. Ranked attempts carry a detached signature (sig) from the service proving the submitted moves were judged server-side. Rating is not part of the record: it is each scoring service's (appview's) own business.

**Key**: `tid`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `fen` | `string` | No | The FEN of the puzzle's starting position (position before the opponent's setup move). Advisory context denormalized from the puzzle; derivable from puzzleId and not covered by sig. |
| `sig` | `string` | No | base64url (unpadded) detached signature by the service proving it judged playerMoves against the puzzle's solution with the given solved result. Signs the canonical DAG-CBOR encoding of an org.lichess.puzzle.defs#resultAttestation rebuilt from this record's fields — see that def for the exact verification recipe. Present only when the attempt was rated (ranked and not flagged). |
| `mode` | `string` | No | Whether this attempt was played for rating and should be counted towards the user's rating. |
| `nonce` | `string` | No | Idempotency key echoed back by submitAttempt (the challenge's jti). Uniquely identifies the issued challenge, so duplicate records for one attempt can be detected. Covered by sig. |
| `solved` | `boolean` | Yes | Whether the puzzle was solved. Advisory (client-claimed) unless sig is present, in which case it is the server-judged result and covered by the signature. |
| `service` | `string` (did) | Yes | DID of the puzzle/scoring service that issued this puzzle and owns the rating it affects. This is traditionally a did:web of the web server, not a user's identity. Needed to be able to find the puzzle |
| `puzzleId` | `string` | Yes | Lichess puzzle ID. |
| `createdAt` | `string` (datetime) | Yes | client-declared timestamp when this attempt record was created. |
| `playerMoves` | `string` | Yes | the moves played by the solver during the attempt, in the same notation as the puzzle's solution moves. For ranked attempts this must be the line submitted to submitAttempt verbatim: it is covered by sig. |

## Raw Schema

```json
{
  "id": "org.lichess.puzzle.attempt",
  "defs": {
    "main": {
      "key": "tid",
      "type": "record",
      "record": {
        "type": "object",
        "required": [
          "puzzleId",
          "service",
          "solved",
          "playerMoves",
          "createdAt"
        ],
        "properties": {
          "fen": {
            "type": "string",
            "maxLength": 128,
            "description": "The FEN of the puzzle's starting position (position before the opponent's setup move). Advisory context denormalized from the puzzle; derivable from puzzleId and not covered by sig."
          },
          "sig": {
            "type": "string",
            "maxLength": 128,
            "description": "base64url (unpadded) detached signature by the service proving it judged playerMoves against the puzzle's solution with the given solved result. Signs the canonical DAG-CBOR encoding of an org.lichess.puzzle.defs#resultAttestation rebuilt from this record's fields — see that def for the exact verification recipe. Present only when the attempt was rated (ranked and not flagged)."
          },
          "mode": {
            "type": "string",
            "default": "casual",
            "description": "Whether this attempt was played for rating and should be counted towards the user's rating.",
            "knownValues": [
              "casual",
              "ranked"
            ]
          },
          "nonce": {
            "type": "string",
            "maxLength": 64,
            "description": "Idempotency key echoed back by submitAttempt (the challenge's jti). Uniquely identifies the issued challenge, so duplicate records for one attempt can be detected. Covered by sig."
          },
          "solved": {
            "type": "boolean",
            "description": "Whether the puzzle was solved. Advisory (client-claimed) unless sig is present, in which case it is the server-judged result and covered by the signature."
          },
          "service": {
            "type": "string",
            "format": "did",
            "description": "DID of the puzzle/scoring service that issued this puzzle and owns the rating it affects. This is traditionally a did:web of the web server, not a user's identity. Needed to be able to find the puzzle"
          },
          "puzzleId": {
            "type": "string",
            "maxLength": 32,
            "description": "Lichess puzzle ID."
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "client-declared timestamp when this attempt record was created."
          },
          "playerMoves": {
            "type": "string",
            "description": "the moves played by the solver during the attempt, in the same notation as the puzzle's solution moves. For ranked attempts this must be the line submitted to submitAttempt verbatim: it is covered by sig."
          }
        }
      },
      "description": "A record of a user's attempt at solving an org.lichess.puzzle. Ranked attempts carry a detached signature (sig) from the service proving the submitted moves were judged server-side. Rating is not part of the record: it is each scoring service's (appview's) own business."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1
}
```
