{
  "openapi": "3.1.0",
  "info": {
    "title": "Gridcoin Wallet API",
    "version": "3.0.0",
    "summary": "Read-only chain data straight from a Gridcoin wallet.",
    "description": "Read-only chain and governance data from a Gridcoin Research wallet, answered as JSON:API documents (`application/vnd.api+json`). Nothing here makes the wallet do something: every wallet call goes through a guard with an allowlist of read-only methods, a budget and stale answers, so the API keeps answering from its cache when the wallet is slow. Amounts are decimal strings with 8 decimals (GRC); times are Unix seconds. Two networks, named in the URL. For statistics from the cache database (lists, charts, supply) there is the Gridcoinstats API (`/gridcoinstats/v4`); this one is for what only the wallet knows. The groups are added one at a time; this description lists what exists.",
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://api.gridcoinstats.eu",
      "description": "The public API"
    }
  ],
  "tags": [
    {
      "name": "Description",
      "description": "What the API is and links to the networks. No wallet is asked."
    },
    {
      "name": "Status",
      "description": "Whether the wallet answers and how high its chain is."
    },
    {
      "name": "Protocol",
      "description": "The consensus rules by height. Static."
    },
    {
      "name": "Blocks",
      "description": "Blocks of the chain as the wallet has them."
    }
  ],
  "paths": {
    "/wallet/v3": {
      "get": {
        "tags": [
          "Description"
        ],
        "summary": "The API and its networks",
        "description": "What the API is, with a link to each network. No wallet is asked.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "The description.",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=3600, stale-while-revalidate=86400",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "A weak validator: send it back as `If-None-Match` and an unchanged answer is a 304.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Requests a minute from one client (the default is 60), all endpoints together.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "What is left in this minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the count starts again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiDocument"
                },
                "example": {
                  "jsonapi": {
                    "version": "1.1"
                  },
                  "data": {
                    "type": "api",
                    "id": "wallet",
                    "attributes": {
                      "name": "Gridcoin Wallet API",
                      "description": "Read-only Gridcoin chain and governance data from a Gridcoin Research wallet",
                      "version": "3.0.0",
                      "networks": [
                        "mainnet",
                        "testnet"
                      ]
                    }
                  },
                  "links": {
                    "self": "/wallet/v3",
                    "mainnet": "/wallet/v3/mainnet",
                    "testnet": "/wallet/v3/testnet"
                  },
                  "meta": {
                    "version": "3.0.0"
                  }
                }
              }
            }
          },
          "405": {
            "description": "A method the API does not answer: it only reads.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "429": {
            "description": "More requests than the limit allows (60 a minute from one client by default, fewer for some groups). `Retry-After` says how long to wait.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/v3/{network}": {
      "get": {
        "tags": [
          "Description"
        ],
        "summary": "One network",
        "description": "The description of one network, with the link to `status`. No wallet is asked.",
        "parameters": [
          {
            "name": "network",
            "in": "path",
            "required": true,
            "description": "The network.",
            "schema": {
              "type": "string",
              "enum": [
                "mainnet",
                "testnet"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The description of the network.",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=3600, stale-while-revalidate=86400",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "A weak validator: send it back as `If-None-Match` and an unchanged answer is a 304.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Requests a minute from one client (the default is 60), all endpoints together.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "What is left in this minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the count starts again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiDocument"
                },
                "example": {
                  "jsonapi": {
                    "version": "1.1"
                  },
                  "data": {
                    "type": "api",
                    "id": "wallet",
                    "attributes": {
                      "name": "Gridcoin Wallet API",
                      "description": "Read-only Gridcoin chain and governance data from a Gridcoin Research wallet",
                      "version": "3.0.0",
                      "network": "mainnet"
                    }
                  },
                  "links": {
                    "self": "/wallet/v3/mainnet",
                    "status": "/wallet/v3/mainnet/status"
                  },
                  "meta": {
                    "network": "mainnet",
                    "version": "3.0.0"
                  }
                }
              }
            }
          },
          "405": {
            "description": "A method the API does not answer: it only reads.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "429": {
            "description": "More requests than the limit allows (60 a minute from one client by default, fewer for some groups). `Retry-After` says how long to wait.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/v3/{network}/status": {
      "get": {
        "tags": [
          "Status"
        ],
        "summary": "The wallet's chain height",
        "description": "The height of the chain as the wallet sees it: the answer to \"is the wallet caught up\". It asks the wallet (through the wallet guard), so it is a 503 while the wallet is down.",
        "parameters": [
          {
            "name": "network",
            "in": "path",
            "required": true,
            "description": "The network.",
            "schema": {
              "type": "string",
              "enum": [
                "mainnet",
                "testnet"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The chain height.",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=15, stale-while-revalidate=30",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "A weak validator: send it back as `If-None-Match` and an unchanged answer is a 304.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Requests a minute from one client (the default is 60), all endpoints together.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "What is left in this minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the count starts again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusDocument"
                },
                "example": {
                  "jsonapi": {
                    "version": "1.1"
                  },
                  "data": {
                    "type": "status",
                    "id": "wallet",
                    "attributes": {
                      "height": 3300784
                    }
                  },
                  "meta": {
                    "network": "mainnet",
                    "version": "3.0.0"
                  },
                  "links": {
                    "self": "/wallet/v3/mainnet/status"
                  }
                }
              }
            }
          },
          "405": {
            "description": "A method the API does not answer: it only reads.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "429": {
            "description": "More requests than the limit allows (60 a minute from one client by default, fewer for some groups). `Retry-After` says how long to wait.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "The wallet is not reachable or is busy (`Retry-After` when the wallet guard says when to try again). Errors are never cached.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait, when known.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/v3/{network}/protocol": {
      "get": {
        "tags": [
          "Protocol"
        ],
        "summary": "The consensus rules by height",
        "description": "The network's consensus rules and when each block version and height-gated feature switches on. Static: no wallet is asked, so it answers while the wallet is down. `active_from_height` is the first block height a rule applies to, or `null` while it is not active on that network.",
        "parameters": [
          {
            "name": "network",
            "in": "path",
            "required": true,
            "description": "The network.",
            "schema": {
              "type": "string",
              "enum": [
                "mainnet",
                "testnet"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rules.",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=3600, stale-while-revalidate=86400",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "A weak validator: send it back as `If-None-Match` and an unchanged answer is a 304.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Requests a minute from one client (the default is 60), all endpoints together.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "What is left in this minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the count starts again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProtocolDocument"
                },
                "example": {
                  "jsonapi": {
                    "version": "1.1"
                  },
                  "data": {
                    "type": "protocol",
                    "id": "mainnet",
                    "attributes": {
                      "network": "mainnet",
                      "last_pow_block": 2050,
                      "target_spacing_seconds": 90,
                      "superblock_spacing_seconds": 86400,
                      "max_block_size": 1000000,
                      "coinbase_maturity": 100,
                      "stake_min_age_seconds": 57600,
                      "gates": [
                        {
                          "name": "protocol_v2",
                          "title": "Protocol v2: 90 second block spacing",
                          "block_version": null,
                          "active_from_height": 85401
                        },
                        {
                          "name": "superblock_spacing_24h",
                          "title": "Superblock spacing 24 hours instead of 12 hours (testnet always 24 hours)",
                          "block_version": null,
                          "active_from_height": 364500
                        },
                        {
                          "name": "research_age",
                          "title": "Research age",
                          "block_version": null,
                          "active_from_height": 364501
                        }
                      ]
                    }
                  },
                  "meta": {
                    "network": "mainnet",
                    "version": "3.0.0"
                  },
                  "links": {
                    "self": "/wallet/v3/mainnet/protocol"
                  }
                }
              }
            }
          },
          "405": {
            "description": "A method the API does not answer: it only reads.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "429": {
            "description": "More requests than the limit allows (60 a minute from one client by default, fewer for some groups). `Retry-After` says how long to wait.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/v3/{network}/blocks": {
      "get": {
        "tags": [
          "Blocks"
        ],
        "summary": "A page of blocks",
        "description": "A page of blocks, newest first by default, straight from the wallet. `meta.page` and the pagination `links` say where the page is; a page past the end is an empty list.",
        "parameters": [
          {
            "name": "network",
            "in": "path",
            "required": true,
            "description": "The network.",
            "schema": {
              "type": "string",
              "enum": [
                "mainnet",
                "testnet"
              ]
            }
          },
          {
            "name": "page[size]",
            "in": "query",
            "required": false,
            "description": "How many blocks on a page. At most 100 by default (the operator can lower it).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 25
            }
          },
          {
            "name": "page[number]",
            "in": "query",
            "required": false,
            "description": "The page, from 1.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "description": "`-height` is the newest first, `height` the oldest first.",
            "schema": {
              "type": "string",
              "enum": [
                "height",
                "-height"
              ],
              "default": "-height"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The blocks.",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=30, stale-while-revalidate=60",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "A weak validator: send it back as `If-None-Match` and an unchanged answer is a 304.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Requests a minute from one client (the default is 60), all endpoints together.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "What is left in this minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the count starts again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/BlocksDocument"
                },
                "example": {
                  "jsonapi": {
                    "version": "1.1"
                  },
                  "data": [
                    {
                      "type": "block",
                      "id": "3300784",
                      "attributes": {
                        "hash": "0000000000000000000000000000000000000000000000000000000000325db0",
                        "height": 3300784,
                        "in_best_chain": true,
                        "time": 1760000000,
                        "size": 1873,
                        "version": 13,
                        "merkle_root": "abababababababababababababababababababababababababababababababab",
                        "previous_block_hash": "0000000000000000000000000000000000000000000000000000000000325daf",
                        "next_block_hash": "0000000000000000000000000000000000000000000000000000000000325db1",
                        "difficulty": 1.5,
                        "bits": "1a0ffff0",
                        "nonce": 0,
                        "flags": "proof-of-stake",
                        "proof_hash": "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
                        "mint": "12.50000000",
                        "money_supply": "478123456.78000000",
                        "fees_collected": "0.01000000",
                        "mrc_foundation_fees": "0.00000000",
                        "mrc_staker_fees": "0.00000000",
                        "is_superblock": false,
                        "is_contract": false,
                        "claim": {
                          "mining_id": "INVESTOR",
                          "client_version": "5.4.8.0",
                          "block_subsidy": "12.50000000",
                          "research_subsidy": "0.00000000",
                          "magnitude": 0,
                          "magnitude_unit": 0.25
                        },
                        "tx_count": 2,
                        "tx": [
                          "2222222222222222222222222222222222222222222222222222222222222222",
                          "3333333333333333333333333333333333333333333333333333333333333333"
                        ]
                      },
                      "links": {
                        "self": "/wallet/v3/mainnet/blocks/3300784",
                        "prev": "/wallet/v3/mainnet/blocks/3300783",
                        "next": "/wallet/v3/mainnet/blocks/3300785"
                      }
                    },
                    {
                      "type": "block",
                      "id": "3300783",
                      "attributes": {
                        "hash": "0000000000000000000000000000000000000000000000000000000000325daf",
                        "height": 3300783,
                        "in_best_chain": true,
                        "time": 1760000000,
                        "size": 1873,
                        "version": 13,
                        "merkle_root": "abababababababababababababababababababababababababababababababab",
                        "previous_block_hash": "0000000000000000000000000000000000000000000000000000000000325dae",
                        "next_block_hash": "0000000000000000000000000000000000000000000000000000000000325db0",
                        "difficulty": 1.5,
                        "bits": "1a0ffff0",
                        "nonce": 0,
                        "flags": "proof-of-stake",
                        "proof_hash": "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
                        "mint": "12.50000000",
                        "money_supply": "478123456.78000000",
                        "fees_collected": "0.01000000",
                        "mrc_foundation_fees": "0.00000000",
                        "mrc_staker_fees": "0.00000000",
                        "is_superblock": false,
                        "is_contract": false,
                        "claim": {
                          "mining_id": "INVESTOR",
                          "client_version": "5.4.8.0",
                          "block_subsidy": "12.50000000",
                          "research_subsidy": "0.00000000",
                          "magnitude": 0,
                          "magnitude_unit": 0.25
                        },
                        "tx_count": 2,
                        "tx": [
                          "2222222222222222222222222222222222222222222222222222222222222222",
                          "3333333333333333333333333333333333333333333333333333333333333333"
                        ]
                      },
                      "links": {
                        "self": "/wallet/v3/mainnet/blocks/3300783",
                        "prev": "/wallet/v3/mainnet/blocks/3300782",
                        "next": "/wallet/v3/mainnet/blocks/3300784"
                      }
                    }
                  ],
                  "meta": {
                    "page": {
                      "number": 1,
                      "size": 2,
                      "total": 3300785,
                      "totalPages": 1650393
                    },
                    "network": "mainnet",
                    "version": "3.0.0"
                  },
                  "links": {
                    "self": "/wallet/v3/mainnet/blocks?page[size]=2&page[number]=1",
                    "first": "/wallet/v3/mainnet/blocks?page[size]=2&page[number]=1",
                    "next": "/wallet/v3/mainnet/blocks?page[size]=2&page[number]=2",
                    "last": "/wallet/v3/mainnet/blocks?page[size]=2&page[number]=1650393"
                  }
                }
              }
            }
          },
          "400": {
            "description": "A value out of range or of the wrong kind (`source.parameter` names it), or a parameter the endpoint does not take.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "405": {
            "description": "A method the API does not answer: it only reads.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "429": {
            "description": "More requests than the limit allows (60 a minute from one client by default, fewer for some groups). `Retry-After` says how long to wait.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "The wallet is not reachable or is busy (`Retry-After` when the wallet guard says when to try again). Errors are never cached.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait, when known.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/v3/{network}/blocks/{id}": {
      "get": {
        "tags": [
          "Blocks"
        ],
        "summary": "One block",
        "description": "One block by its height or its 64 character hash: the same resource either way, and its `id` is always the height. A block dropped in a reorganisation can still be fetched by hash (`in_best_chain` is `false`). There is no `confirmations`: it changes with every block, so subtract the block's height from the tip in `/status`. The deeper a block, the longer it is cached.",
        "parameters": [
          {
            "name": "network",
            "in": "path",
            "required": true,
            "description": "The network.",
            "schema": {
              "type": "string",
              "enum": [
                "mainnet",
                "testnet"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The block height, or its 64 character hash.",
            "schema": {
              "type": "string",
              "example": "3300784"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The block.",
            "headers": {
              "Cache-Control": {
                "description": "public, max-age=N, stale-while-revalidate=M: 15 and 30 for the tip, 60 and 120 from 2 confirmations, 600 and 3600 from 10, 900 and 3600 from 100, and 86400 and 604800 for a block at or below the wallet's checkpoint, which can never be replaced.",
                "schema": {
                  "type": "string"
                }
              },
              "ETag": {
                "description": "A weak validator: send it back as `If-None-Match` and an unchanged answer is a 304.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Requests a minute from one client (the default is 60), all endpoints together.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "What is left in this minute.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the count starts again.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockDocument"
                },
                "example": {
                  "jsonapi": {
                    "version": "1.1"
                  },
                  "data": {
                    "type": "block",
                    "id": "3300784",
                    "attributes": {
                      "hash": "0000000000000000000000000000000000000000000000000000000000325db0",
                      "height": 3300784,
                      "in_best_chain": true,
                      "time": 1760000000,
                      "size": 1873,
                      "version": 13,
                      "merkle_root": "abababababababababababababababababababababababababababababababab",
                      "previous_block_hash": "0000000000000000000000000000000000000000000000000000000000325daf",
                      "next_block_hash": "0000000000000000000000000000000000000000000000000000000000325db1",
                      "difficulty": 1.5,
                      "bits": "1a0ffff0",
                      "nonce": 0,
                      "flags": "proof-of-stake",
                      "proof_hash": "cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
                      "mint": "12.50000000",
                      "money_supply": "478123456.78000000",
                      "fees_collected": "0.01000000",
                      "mrc_foundation_fees": "0.00000000",
                      "mrc_staker_fees": "0.00000000",
                      "is_superblock": false,
                      "is_contract": false,
                      "claim": {
                        "mining_id": "INVESTOR",
                        "client_version": "5.4.8.0",
                        "block_subsidy": "12.50000000",
                        "research_subsidy": "0.00000000",
                        "magnitude": 0,
                        "magnitude_unit": 0.25
                      },
                      "tx_count": 2,
                      "tx": [
                        "2222222222222222222222222222222222222222222222222222222222222222",
                        "3333333333333333333333333333333333333333333333333333333333333333"
                      ]
                    },
                    "links": {
                      "self": "/wallet/v3/mainnet/blocks/3300784",
                      "prev": "/wallet/v3/mainnet/blocks/3300783",
                      "next": "/wallet/v3/mainnet/blocks/3300785"
                    }
                  },
                  "meta": {
                    "network": "mainnet",
                    "version": "3.0.0"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Not a height and not a hash.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "404": {
            "description": "No such block (a height above the tip, or an unknown hash).",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "405": {
            "description": "A method the API does not answer: it only reads.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            }
          },
          "429": {
            "description": "More requests than the limit allows (60 a minute from one client by default, fewer for some groups). `Retry-After` says how long to wait.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "The wallet is not reachable or is busy (`Retry-After` when the wallet guard says when to try again). Errors are never cached.",
            "content": {
              "application/vnd.api+json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorDocument"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait, when known.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "JsonApi": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "version": {
            "type": "string",
            "description": "The JSON:API version, `1.1`."
          }
        }
      },
      "Links": {
        "type": "object",
        "additionalProperties": {
          "type": "string"
        },
        "description": "Paths on the same host. `self` is always there."
      },
      "Meta": {
        "type": "object",
        "required": [
          "version"
        ],
        "properties": {
          "network": {
            "type": "string",
            "enum": [
              "mainnet",
              "testnet"
            ],
            "description": "The network of the answer."
          },
          "version": {
            "type": "string",
            "description": "The version of the API."
          }
        }
      },
      "MetaPage": {
        "type": "object",
        "required": [
          "version",
          "page"
        ],
        "properties": {
          "network": {
            "type": "string",
            "enum": [
              "mainnet",
              "testnet"
            ],
            "description": "The network of the answer."
          },
          "version": {
            "type": "string",
            "description": "The version of the API."
          },
          "page": {
            "type": "object",
            "required": [
              "number",
              "size",
              "total",
              "totalPages"
            ],
            "properties": {
              "number": {
                "type": "integer",
                "description": "This page."
              },
              "size": {
                "type": "integer",
                "description": "Blocks on a full page."
              },
              "total": {
                "type": "integer",
                "description": "All blocks of the chain, from 0 to the tip."
              },
              "totalPages": {
                "type": "integer",
                "description": "Pages of that size."
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "title"
        ],
        "properties": {
          "status": {
            "type": "string",
            "description": "The HTTP status as a string."
          },
          "title": {
            "type": "string",
            "description": "A short title that stays the same for a status."
          },
          "detail": {
            "type": "string",
            "description": "What went wrong."
          },
          "code": {
            "type": "string",
            "description": "A stable code, for example `invalid_query`."
          },
          "source": {
            "type": "object",
            "description": "Where the error is: `parameter` names the query parameter.",
            "properties": {
              "parameter": {
                "type": "string"
              }
            }
          }
        }
      },
      "ErrorDocument": {
        "type": "object",
        "required": [
          "jsonapi",
          "errors"
        ],
        "properties": {
          "jsonapi": {
            "$ref": "#/components/schemas/JsonApi"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "Claim": {
        "type": "object",
        "description": "Who staked the block and what it was paid. A field the wallet did not send for an old block is `null`.",
        "required": [
          "mining_id",
          "client_version",
          "block_subsidy",
          "research_subsidy",
          "magnitude",
          "magnitude_unit"
        ],
        "properties": {
          "mining_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The CPID that staked the block, `INVESTOR` or `NONCRUNCHER`."
          },
          "client_version": {
            "type": [
              "string",
              "null"
            ],
            "description": "The wallet version that made the block."
          },
          "block_subsidy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The stake reward in GRC, 8 decimals."
          },
          "research_subsidy": {
            "type": [
              "string",
              "null"
            ],
            "description": "The research reward in GRC, 8 decimals."
          },
          "magnitude": {
            "type": [
              "number",
              "null"
            ],
            "description": "The staker's magnitude."
          },
          "magnitude_unit": {
            "type": [
              "number",
              "null"
            ],
            "description": "The magnitude unit (configurable from block version 13)."
          }
        }
      },
      "Block": {
        "type": "object",
        "required": [
          "type",
          "id",
          "attributes",
          "links"
        ],
        "properties": {
          "type": {
            "const": "block"
          },
          "id": {
            "type": "string",
            "description": "The height."
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          },
          "attributes": {
            "type": "object",
            "required": [
              "hash",
              "height",
              "in_best_chain",
              "time",
              "size",
              "version",
              "tx_count",
              "tx",
              "claim"
            ],
            "properties": {
              "hash": {
                "type": "string",
                "description": "The block hash, 64 hex characters."
              },
              "height": {
                "type": "integer",
                "description": "The block height."
              },
              "in_best_chain": {
                "type": "boolean",
                "description": "`false` for a block dropped in a reorganisation."
              },
              "time": {
                "type": "integer",
                "description": "Unix seconds."
              },
              "size": {
                "type": "integer",
                "description": "Bytes."
              },
              "version": {
                "type": "integer",
                "description": "The block version: which rules it was made under (see `/protocol`)."
              },
              "merkle_root": {
                "type": "string"
              },
              "previous_block_hash": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The hash of the block before (null for the first block)."
              },
              "next_block_hash": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The hash of the next block (null at the tip)."
              },
              "difficulty": {
                "type": "number"
              },
              "bits": {
                "type": "string"
              },
              "nonce": {
                "type": "integer"
              },
              "flags": {
                "type": "string",
                "description": "`proof-of-stake` or `proof-of-work`."
              },
              "proof_hash": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "The proof hash, null when the wallet sends none."
              },
              "mint": {
                "type": "string",
                "description": "The coins created, GRC with 8 decimals."
              },
              "money_supply": {
                "type": "string",
                "description": "The wallet's money supply after the block. The wallet keeps it as a float, so it has about 7 reliable decimals."
              },
              "fees_collected": {
                "type": "string",
                "description": "GRC with 8 decimals."
              },
              "mrc_foundation_fees": {
                "type": "string",
                "description": "Zero before block version 12."
              },
              "mrc_staker_fees": {
                "type": "string",
                "description": "Zero before block version 12."
              },
              "is_superblock": {
                "type": "boolean"
              },
              "is_contract": {
                "type": "boolean",
                "description": "The block carries a contract."
              },
              "claim": {
                "$ref": "#/components/schemas/Claim"
              },
              "tx_count": {
                "type": "integer"
              },
              "tx": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "The transaction ids."
              }
            }
          }
        }
      },
      "Gate": {
        "type": "object",
        "required": [
          "name",
          "title",
          "block_version",
          "active_from_height"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "description": "What the rule is."
          },
          "block_version": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The block version that comes with the rule, if it has one."
          },
          "active_from_height": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The first block height the rule applies to, null while it is not active."
          }
        }
      },
      "Protocol": {
        "type": "object",
        "required": [
          "type",
          "id",
          "attributes"
        ],
        "properties": {
          "type": {
            "const": "protocol"
          },
          "id": {
            "type": "string",
            "description": "The network."
          },
          "attributes": {
            "type": "object",
            "required": [
              "network",
              "last_pow_block",
              "target_spacing_seconds",
              "superblock_spacing_seconds",
              "max_block_size",
              "coinbase_maturity",
              "stake_min_age_seconds",
              "gates"
            ],
            "properties": {
              "network": {
                "type": "string"
              },
              "last_pow_block": {
                "type": "integer",
                "description": "The last proof-of-work block."
              },
              "target_spacing_seconds": {
                "type": "integer",
                "description": "The block spacing now (60 seconds before `protocol_v2`)."
              },
              "superblock_spacing_seconds": {
                "type": "integer",
                "description": "The superblock spacing now (12 hours before `superblock_spacing_24h`)."
              },
              "max_block_size": {
                "type": "integer"
              },
              "coinbase_maturity": {
                "type": "integer",
                "description": "Blocks before a reward can be spent."
              },
              "stake_min_age_seconds": {
                "type": "integer",
                "description": "How long coins rest before they stake."
              },
              "gates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Gate"
                },
                "description": "Each block version (8 to 15) and each height-gated feature."
              }
            }
          }
        }
      },
      "Status": {
        "type": "object",
        "required": [
          "type",
          "id",
          "attributes"
        ],
        "properties": {
          "type": {
            "const": "status"
          },
          "id": {
            "type": "string"
          },
          "attributes": {
            "type": "object",
            "required": [
              "height"
            ],
            "properties": {
              "height": {
                "type": "integer",
                "description": "The wallet's chain height."
              }
            }
          }
        }
      },
      "Api": {
        "type": "object",
        "required": [
          "type",
          "id",
          "attributes"
        ],
        "properties": {
          "type": {
            "const": "api"
          },
          "id": {
            "type": "string"
          },
          "attributes": {
            "type": "object",
            "required": [
              "name",
              "description",
              "version"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "version": {
                "type": "string"
              },
              "network": {
                "type": "string"
              },
              "networks": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ApiDocument": {
        "type": "object",
        "required": [
          "jsonapi",
          "data",
          "meta"
        ],
        "properties": {
          "jsonapi": {
            "$ref": "#/components/schemas/JsonApi"
          },
          "data": {
            "$ref": "#/components/schemas/Api"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          }
        }
      },
      "StatusDocument": {
        "type": "object",
        "required": [
          "jsonapi",
          "data",
          "meta"
        ],
        "properties": {
          "jsonapi": {
            "$ref": "#/components/schemas/JsonApi"
          },
          "data": {
            "$ref": "#/components/schemas/Status"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          }
        }
      },
      "ProtocolDocument": {
        "type": "object",
        "required": [
          "jsonapi",
          "data",
          "meta"
        ],
        "properties": {
          "jsonapi": {
            "$ref": "#/components/schemas/JsonApi"
          },
          "data": {
            "$ref": "#/components/schemas/Protocol"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          }
        }
      },
      "BlockDocument": {
        "type": "object",
        "required": [
          "jsonapi",
          "data",
          "meta"
        ],
        "properties": {
          "jsonapi": {
            "$ref": "#/components/schemas/JsonApi"
          },
          "data": {
            "$ref": "#/components/schemas/Block"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          }
        }
      },
      "BlocksDocument": {
        "type": "object",
        "required": [
          "jsonapi",
          "data",
          "meta"
        ],
        "properties": {
          "jsonapi": {
            "$ref": "#/components/schemas/JsonApi"
          },
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Block"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/MetaPage"
          },
          "links": {
            "$ref": "#/components/schemas/Links"
          }
        }
      }
    }
  }
}
