arnaucube
arnaucube/hermez-nodePublic Self-hosted repository
hermez-node/api/swagger.yml
api/swagger.ymlRaw
   1openapi: 3.0.0
   2info:
   3  description: |
   4    This API server is the layer that allows 3rd party apps and services interfacing with the coordinator to explore, monitor and use the Hermez rollup.
   5    Example of these apps are:
   6    * Wallet: send L2 transactions, check balance, ...
   7    * Explorer: List transactions, slots, batches, ...
   8    * Exchange integrations
   9    
  10    ### Pagination
  11    
  12    #### Usage
  13
  14    All the endpoints that return a list of undefined size use pagination. Unless the opposite is explicitly said.
  15    In order to use pagination, three query parameters are used:
  16    * `fromItem`: indicates the first item to be returned. In general, this parameter shouldn't be provided in the first call to the endpoint, and use the `itemId` of the last returned item (+/-) 1, if the order is (ascending/descending).
  17    * `order`: all pginated items are ordered chronologicaly. However the specific fields to guarantee this order depend on each endpoint. For this purpose, `itemId` is used (itemId follows ascending chronological order except for unforged L1 user transactions). If the parameter is not provided, ascending order will be used by default. 
  18    * `limit`: maximum amount of items to include in each response. Default is 20, maximum 2049.
  19    
  20    Responses for those endpoint will always include a `pagination` object. This object includes the total amount of items that the endpoint will return at a given time with the given filters. Apart from that, it also includes the `itemId` of the last and first items that will be returned (not in a single response but within the total items). These two properties can be used to know when to stop querying. 
  21
  22    #### Reorgs and safetyness
  23
  24    Since all the items are ordered chronologicaly, there are no safety problems when fetching items in ascending order, except for reorgs (more on this later).
  25    On the other hand, when iterating in descending order, new items will be added at the beginning. This doesn't cause any safety problem, but to get those new items, it's necessary to start queryng without the `fromItem` set to `pagination.lastItem`.
  26    To handle reorgs, the `itemId` can be used since it will change. This is important since other identifiers may be the same but with different content. As an example, if the batch 424 get's reorged, it will be deleted, but eventualy, a new batch 424 will appear with potentialy different content.
  27
  28    ### Signatures
  29
  30    The POST endpoint require to be signed using BabyJubJub or Ethereum keys. TODO: add references to libraries / examples / ...    
  31
  32  version: "0.0.1"
  33  title: Hermez Network API
  34#  termsOfService: 'http://swagger.io/terms/'
  35#  contact:
  36#    email: apiteam@swagger.io
  37#  license:
  38#    name: Apache 2.0
  39#    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
  40externalDocs:
  41  description: Find out more about Hermez.
  42  url: 'https://hermez.io'
  43servers:
  44  - description: Hosted mock up
  45    url: http://167.71.59.190:4010
  46  - description: Localhost mock Up
  47    url: http://localhost:4010
  48tags:
  49  - name: Account
  50    description: Hermez account and the tokens it holds.
  51    externalDocs:
  52      description: Find out more.
  53      url: 'https://idocs.hermez.io/#/spec/zkrollup/README?id=account-types'
  54  - name: Transaction
  55    description: Send tokens off chain and track transactions.
  56    externalDocs:
  57      description: Find out more
  58      url: 'https://idocs.hermez.io/#/spec/zkrollup/README?id=transaction-types'
  59  - name: Hermez status
  60    description: Info about operators, tokens, auctions and more.
  61    externalDocs:
  62      description: Find out more.
  63      url: 'https://idocs.hermez.io/#/spec/zkrollup/README'
  64paths:
  65  '/account-creation-authorization':
  66    post:
  67      tags:
  68        - Account
  69      summary: Send an authorization that will allow the coordinator to register accounts associated to an Ethereum address on behalf of the user.
  70      description: >-
  71        Send an authorization to create rollup accounts associated to an Ethereum address. Each account creation (an account can only hold a specific token) is effective once the coordinator forges the corresponding L1CoordinatorTx (which are always of type *account creation*).        
  72      operationId: postRegister
  73      requestBody:
  74        description: Account creation authorization.
  75        required: true
  76        content:
  77          application/json:
  78            schema:
  79              $ref: '#/components/schemas/AccountCreationAuthorizationPost'
  80      responses:
  81        '200':
  82          description: Successful operation.
  83        '400':
  84          description: Bad request.
  85          content:
  86            application/json:
  87              schema:
  88                $ref: '#/components/schemas/Error400'
  89        '500':
  90          description: Internal server error.
  91          content:
  92            application/json:
  93              schema:
  94                $ref: '#/components/schemas/Error500'
  95  '/account-creation-authorization/{hezEthereumAddress}':
  96    get:
  97      tags:
  98        - Account
  99      summary: Get to know if the coordinator has the ability to create accounts associated to an Ethereum address.
 100      description: >-
 101        True if the coordinator has the required authorization to perform an account creation with the given Ethereum address on behalf of the Ethereum address holder.        
 102      operationId: getAccountCreationAuthorization
 103      parameters:
 104        - name: hezEthereumAddress
 105          in: path
 106          description: Ethereum address.
 107          required: true
 108          schema:
 109            $ref: '#/components/schemas/HezEthereumAddress'
 110      responses:
 111        '200':
 112          description: Successful operation.
 113          content:
 114            application/json:
 115              schema:
 116                $ref: '#/components/schemas/AccountCreationAuthorization'
 117        '400':
 118          description: Bad request.
 119          content:
 120            application/json:
 121              schema:
 122                $ref: '#/components/schemas/Error400'
 123        '404':
 124          description: Not found.
 125          content:
 126            application/json:
 127              schema:
 128                $ref: '#/components/schemas/Error404'
 129        '500':
 130          description: Internal server error.
 131          content:
 132            application/json:
 133              schema:
 134                $ref: '#/components/schemas/Error500'
 135  '/accounts':
 136    get:
 137      tags:
 138        - Account
 139      summary: Get accounts balances and other associated information.
 140      description: Get accounts balances and other associated information.
 141      operationId: getAccounts
 142      parameters:
 143        - name: hezEthereumAddress
 144          in: query
 145          description: Only get accounts associated to an Ethereum address. Incompatible with the query `BJJ`.
 146          required: false
 147          schema:
 148            $ref: '#/components/schemas/HezEthereumAddress'
 149        - name: BJJ
 150          in: query
 151          description: Only get accounts associated to a BabyJubJub public key.  Incompatible with the query `hezEthereumAddress`.
 152          required: false
 153          schema:
 154            $ref: '#/components/schemas/BJJ'
 155        - name: tokenIds
 156          in: query
 157          required: false
 158          description: Only get accounts of specific tokens.
 159          schema:
 160            type: string
 161            description: Comma separated list of token identifiers.
 162            example: "3,87,91"
 163        - name: fromItem
 164          in: query
 165          required: false
 166          description: Indicates the desired first item (using the itemId property) to be included in the response.
 167          schema:
 168            type: number
 169        - name: order
 170          in: query
 171          required: false
 172          description: Order of the returned items. Accounts will be ordered by increasing account index.
 173          schema:
 174            type: string
 175            default: ASC
 176            enum:
 177                - ASC
 178                - DESC
 179        - name: limit
 180          in: query
 181          required: false
 182          description: Maximum number of items to be returned.
 183          schema:
 184            type: integer
 185            minimum: 1
 186            maximum: 2049
 187      responses:
 188        '200':
 189          description: Successful operation.
 190          content:
 191            application/json:
 192              schema:
 193                $ref: '#/components/schemas/Accounts'
 194        '400':
 195          description: Bad request.
 196          content:
 197            application/json:
 198              schema:
 199                $ref: '#/components/schemas/Error400'
 200        '404':
 201          description: Not found.
 202          content:
 203            application/json:
 204              schema:
 205                $ref: '#/components/schemas/Error404'
 206        '500':
 207          description: Internal server error.
 208          content:
 209            application/json:
 210              schema:
 211                $ref: '#/components/schemas/Error500'
 212  '/accounts/{accountIndex}':
 213    get:
 214      tags:
 215        - Account
 216      summary: Get an account by its index.
 217      description: Get an account by its index.
 218      operationId: getAccount
 219      parameters:
 220        - name: accountIndex
 221          in: path
 222          description: Identifier of an account.
 223          required: true
 224          schema:
 225            $ref: '#/components/schemas/AccountIndex'
 226      responses:
 227        '200':
 228          description: Successful operation.
 229          content:
 230            application/json:
 231              schema:
 232                $ref: '#/components/schemas/Account'
 233        '400':
 234          description: Bad request.
 235          content:
 236            application/json:
 237              schema:
 238                $ref: '#/components/schemas/Error400'
 239        '404':
 240          description: Not found.
 241          content:
 242            application/json:
 243              schema:
 244                $ref: '#/components/schemas/Error404'
 245        '500':
 246          description: Internal server error.
 247          content:
 248            application/json:
 249              schema:
 250                $ref: '#/components/schemas/Error500'
 251  '/exits':
 252    get:
 253      tags:
 254        - Account
 255      summary: Get exit information. This information is required to perform a withdraw.
 256      description: Get exit information. This information is required to perform a withdraw.
 257      operationId: getExits
 258      parameters:
 259        - name: tokenId
 260          in: query
 261          required: false
 262          description: Only get exits of specific token
 263          schema:
 264            $ref: '#/components/schemas/TokenId'
 265        - name: hezEthereumAddress
 266          in: query
 267          description: Get exits associated to a Ethereum address. Incompatible with query `BJJ` and `accountIndex`.
 268          required: false
 269          schema:
 270            $ref: '#/components/schemas/HezEthereumAddress'
 271        - name: BJJ
 272          in: query
 273          description: Get exits associated to a BabyJubJub public key. Incompatible with query `hezEthereumAddress` and `accountIndex`.
 274          required: false
 275          schema:
 276            $ref: '#/components/schemas/BJJ'
 277        - name: accountIndex
 278          in: query
 279          description: Get exits associated to a specific account. Incompatible with queries `tokenId`, `hezEthereumAddress` and `BJJ`.
 280          required: false
 281          schema:
 282            $ref: '#/components/schemas/AccountIndex'
 283        - name: batchNum
 284          in: query
 285          description: Get exits from the exit tree of a specific batch.
 286          required: false
 287          schema:
 288            $ref: '#/components/schemas/BatchNum'
 289        - name: fromItem
 290          in: query
 291          required: false
 292          description: Indicates the desired first item (using the itemId property) to be included in the response.
 293          schema:
 294            type: number
 295        - name: order
 296          in: query
 297          required: false
 298          description: Order of the returned items. Exits will be ordered by increasing (batchNum, accountIndex).
 299          schema:
 300            type: string
 301            default: ASC
 302            enum:
 303                - ASC
 304                - DESC
 305        - name: limit
 306          in: query
 307          required: false
 308          description: Maximum number of items to be returned.
 309          schema:
 310            type: integer
 311            minimum: 1
 312            maximum: 2049
 313      responses:
 314        '200':
 315          description: Successful operation.
 316          content:
 317            application/json:
 318              schema:
 319                $ref: '#/components/schemas/Exits'
 320        '400':
 321          description: Bad request.
 322          content:
 323            application/json:
 324              schema:
 325                $ref: '#/components/schemas/Error400'
 326        '404':
 327          description: Not found.
 328          content:
 329            application/json:
 330              schema:
 331                $ref: '#/components/schemas/Error404'
 332        '500':
 333          description: Internal server error.
 334          content:
 335            application/json:
 336              schema:
 337                $ref: '#/components/schemas/Error500'
 338  '/exits/{batchNum}/{accountIndex}':
 339    get:
 340      tags:
 341        - Account
 342      summary: Get specific exit information.
 343      description: Get exit information form a specific exit tree and account. This information is required to perform a withdraw. Exits are identified with accounIndex and batchNum since every batch that has exits has a different exit tree.
 344      operationId: getExit
 345      parameters:
 346        - name: batchNum
 347          in: path
 348          description: Batch of the exit tree.
 349          required: true
 350          schema:
 351            $ref: '#/components/schemas/BatchNum'
 352        - name: accountIndex
 353          in: path
 354          description: Account identifier.
 355          required: true
 356          schema:
 357            $ref: '#/components/schemas/AccountIndex'
 358      responses:
 359        '200':
 360          description: Successful operation.
 361          content:
 362            application/json:
 363              schema:
 364                $ref: '#/components/schemas/Exit'
 365        '400':
 366          description: Bad request.
 367          content:
 368            application/json:
 369              schema:
 370                $ref: '#/components/schemas/Error400'
 371        '404':
 372          description: Not found.
 373          content:
 374            application/json:
 375              schema:
 376                $ref: '#/components/schemas/Error404'
 377        '500':
 378          description: Internal server error.
 379          content:
 380            application/json:
 381              schema:
 382                $ref: '#/components/schemas/Error500'
 383  '/transactions-pool':
 384    post:
 385      tags:
 386        - Transaction
 387      summary: Add an L2 transaction to the coordinator's pool
 388      description: >-
 389        Send L2 transaction. The transaction will be stored in the transaction pool of the coordinator and eventually forged.        
 390      operationId: postTx
 391      requestBody:
 392        description: Signed transaction.
 393        required: true
 394        content:
 395          application/json:
 396            schema:
 397              $ref: '#/components/schemas/PostPoolL2Transaction'
 398      responses:
 399        '200':
 400          description: Successful operation.
 401          content:
 402            application/json:
 403              schema:
 404                $ref: '#/components/schemas/TransactionId'
 405        '400':
 406          description: Bad request.
 407          content:
 408            application/json:
 409              schema:
 410                $ref: '#/components/schemas/Error400'
 411        '500':
 412          description: Internal server error.
 413          content:
 414            application/json:
 415              schema:
 416                $ref: '#/components/schemas/Error500'
 417  '/transactions-pool/{id}':
 418    get:
 419      tags:
 420        - Transaction
 421      summary: Get details and status of a transaction that is in the pool.
 422      description: >-
 423        Get transaction from the pool by its id. This endpoint is specially useful for tracking the status of a transaction that may not be forged yet.
 424        Only transactions from the pool will be returned.
 425        Note that the transaction pool is different for each coordinator and therefore only a coordinator that has received a specific transaction
 426        will be able to provide information about that transaction.        
 427      operationId: getPoolTx
 428      parameters:
 429        - name: id
 430          in: path
 431          description: Transaction identifier.
 432          required: true
 433          schema:
 434            $ref: '#/components/schemas/TransactionId'
 435      responses:
 436        '200':
 437          description: Successful operation.
 438          content:
 439            application/json:
 440              schema:
 441                $ref: '#/components/schemas/PoolL2Transaction'
 442        '400':
 443          description: Bad request.
 444          content:
 445            application/json:
 446              schema:
 447                $ref: '#/components/schemas/Error400'
 448        '404':
 449          description: Not found.
 450          content:
 451            application/json:
 452              schema:
 453                $ref: '#/components/schemas/Error404'
 454        '500':
 455          description: Internal server error.
 456          content:
 457            application/json:
 458              schema:
 459                $ref: '#/components/schemas/Error500'
 460  '/transactions-history':
 461    get:
 462      tags:
 463        - Transaction
 464      summary: Get details and status of transactions that have been forged.
 465      description: >-
 466        Get historical transactions. This endpoint will return all the different types of transactions except for:
 467          - Transactions that are still in the transaction pool of any coordinator. These transactions can be fetched using `GET /transactions-pool/{id}`.
 468          - L1 transactions sent by users that have not been forged yet. These transactions can be fetched using `GET /transactions-history/{id}`.        
 469      operationId: getHistoryTxs
 470      parameters:
 471        - name: tokenId
 472          in: query
 473          required: false
 474          description: Only get transactions of specific token
 475          schema:
 476            $ref: '#/components/schemas/TokenId'
 477        - name: hezEthereumAddress
 478          in: query
 479          required: false
 480          description: Only get transactions sent from or to an account associated to an Ethereum address Incompatible with the queries `BJJ` and `accountIndex`.
 481          schema:
 482            $ref: '#/components/schemas/HezEthereumAddress'
 483        - name: BJJ
 484          in: query
 485          description: Only get transactions associated to a BabyJubJub public key. Incompatible with the queries `hezEthereumAddress` and `accountIndex`.
 486          required: false
 487          schema:
 488            $ref: '#/components/schemas/BJJ'
 489        - name: accountIndex
 490          in: query
 491          required: false
 492          description: Only get transactions sent from or to a specific account. Incompatible with the queries `tokenId`, `hezEthereumAddress` and `BJJ`.
 493          schema:
 494            $ref: '#/components/schemas/AccountIndex'
 495        - name: batchNum
 496          in: query
 497          required: false
 498          description: Only get transactions forged in a specific batch.
 499          schema:
 500            $ref: '#/components/schemas/BatchNum'
 501        - name: type
 502          in: query
 503          required: false
 504          description: Only get transactions of a specific type.
 505          schema:
 506            $ref: '#/components/schemas/TransactionType'
 507        - name: fromItem
 508          in: query
 509          required: false
 510          description: Indicates the desired first item (using the itemId property) to be included in the response.
 511          schema:
 512            type: number
 513        - name: order
 514          in: query
 515          required: false
 516          description: Order of the returned items. History transactions will be ordered by (batchNum, position).
 517          schema:
 518            type: string
 519            default: ASC
 520            enum:
 521                - ASC
 522                - DESC
 523        - name: limit
 524          in: query
 525          required: false
 526          description: Maximum number of items to be returned.
 527          schema:
 528            type: integer
 529            minimum: 1
 530            maximum: 2049
 531      responses:
 532        '200':
 533          description: Successful operation.
 534          content:
 535            application/json:
 536              schema:
 537                $ref: '#/components/schemas/HistoryTransactions'
 538        '400':
 539          description: Bad request.
 540          content:
 541            application/json:
 542              schema:
 543                $ref: '#/components/schemas/Error400'
 544        '404':
 545          description: Not found.
 546          content:
 547            application/json:
 548              schema:
 549                $ref: '#/components/schemas/Error404'
 550        '500':
 551          description: Internal server error.
 552          content:
 553            application/json:
 554              schema:
 555                $ref: '#/components/schemas/Error500'
 556  '/transactions-history/{id}':
 557    get:
 558      tags:
 559        - Transaction
 560      summary: Get details and status of a historical transaction.
 561      description: >-
 562        Get transaction from the history by its id. This endpoint will return all the different types of transactions except those that are still in the pool of any coordinator.        
 563      operationId: getHistoryTx
 564      parameters:
 565        - name: id
 566          in: path
 567          description: Transaction identifier.
 568          required: true
 569          schema:
 570            $ref: '#/components/schemas/TransactionId'
 571      responses:
 572        '200':
 573          description: Successful operation.
 574          content:
 575            application/json:
 576              schema:
 577                $ref: '#/components/schemas/HistoryTransaction'
 578        '400':
 579          description: Bad request.
 580          content:
 581            application/json:
 582              schema:
 583                $ref: '#/components/schemas/Error400'
 584        '404':
 585          description: Not found.
 586          content:
 587            application/json:
 588              schema:
 589                $ref: '#/components/schemas/Error404'
 590        '500':
 591          description: Internal server error.
 592          content:
 593            application/json:
 594              schema:
 595                $ref: '#/components/schemas/Error500'
 596  '/batches':
 597    get:
 598      tags:
 599        - Hermez status
 600      summary: Get information about forged batches.
 601      description: >-
 602        Get information about forged batches.        
 603      operationId: getBatches
 604      parameters:
 605        - name: minBatchNum
 606          in: query
 607          required: false
 608          description: Include only `batchNum > minBatchNum` batches.
 609          schema:
 610            $ref: '#/components/schemas/BatchNum'
 611        - name: maxBatchNum
 612          in: query
 613          required: false
 614          description: Include only `batchNum < maxBatchNum` batches.
 615          schema:
 616            type: number
 617        - name: slotNum
 618          in: query
 619          required: false
 620          description: Include only batches that were forged within the specified slot.
 621          schema:
 622            $ref: '#/components/schemas/SlotNum'
 623        - name: forgerAddr
 624          in: query
 625          required: false
 626          description: Include only batches forged by `forgerAddr`
 627          schema:
 628            $ref: '#/components/schemas/EthereumAddress'
 629        - name: fromItem
 630          in: query
 631          required: false
 632          description: Indicates the desired first item (using the itemId property) to be included in the response.
 633          schema:
 634            type: number
 635        - name: order
 636          in: query
 637          required: false
 638          description: Order of the returned items. Batches will be ordered by increasing `batchNum`.
 639          schema:
 640            type: string
 641            default: ASC
 642            enum:
 643                - ASC
 644                - DESC
 645        - name: limit
 646          in: query
 647          required: false
 648          description: Maximum number of items to be returned.
 649          schema:
 650            type: integer
 651            minimum: 1
 652            maximum: 2049
 653      responses:
 654        '200':
 655          description: Successful operation.
 656          content:
 657            application/json:
 658              schema:
 659                $ref: '#/components/schemas/Batches'
 660        '400':
 661          description: Bad request.
 662          content:
 663            application/json:
 664              schema:
 665                $ref: '#/components/schemas/Error400'
 666        '404':
 667          description: Not found.
 668          content:
 669            application/json:
 670              schema:
 671                $ref: '#/components/schemas/Error404'
 672        '500':
 673          description: Internal server error.
 674          content:
 675            application/json:
 676              schema:
 677                $ref: '#/components/schemas/Error500'                
 678  '/batches/{batchNum}':
 679    get:
 680      tags:
 681        - Hermez status
 682      summary: Get a specific batch.
 683      description: >-
 684        Get a specific batch.        
 685      operationId: getBatch
 686      parameters:
 687        - name: batchNum
 688          in: path
 689          description: Batch identifier.
 690          required: true
 691          schema:
 692            $ref: '#/components/schemas/BatchNum'
 693      responses:
 694        '200':
 695          description: Successful operation
 696          content:
 697            application/json:
 698              schema:
 699                $ref: '#/components/schemas/Batch'
 700        '400':
 701          description: Bad request.
 702          content:
 703            application/json:
 704              schema:
 705                $ref: '#/components/schemas/Error400'
 706        '404':
 707          description: Not found.
 708          content:
 709            application/json:
 710              schema:
 711                $ref: '#/components/schemas/Error404'
 712        '500':
 713          description: Internal server error.
 714          content:
 715            application/json:
 716              schema:
 717                $ref: '#/components/schemas/Error500'
 718  '/full-batches/{batchNum}':
 719    get:
 720      tags:
 721        - Hermez status
 722      summary: Get a full batch
 723      description: >-
 724        Get a specific batch, including the associated transactions. The object returned in this method can be a bit heavy. 
 725        If you're devloping a front end, you may consider using a combinaton of `GET /batches/{batchnum}` and `GET /history-transactions?batchNum={batchNum}`.        
 726      operationId: getFullBatch
 727      parameters:
 728        - name: batchNum
 729          in: path
 730          description: Batch identifier
 731          required: true
 732          schema:
 733            $ref: '#/components/schemas/BatchNum'
 734      responses:
 735        '200':
 736          description: successful operation
 737          content:
 738            application/json:
 739              schema:
 740                $ref: '#/components/schemas/FullBatch'
 741        '400':
 742          description: Bad request.
 743          content:
 744            application/json:
 745              schema:
 746                $ref: '#/components/schemas/Error400'
 747        '404':
 748          description: Not found.
 749          content:
 750            application/json:
 751              schema:
 752                $ref: '#/components/schemas/Error404'
 753        '500':
 754          description: Internal server error.
 755          content:
 756            application/json:
 757              schema:
 758                $ref: '#/components/schemas/Error500'
 759  '/slots':
 760    get:
 761      tags:
 762        - Hermez status
 763      summary: Get information about slots.
 764      description: >-
 765        Get information about slots.        
 766      operationId: getSlots
 767      parameters:
 768        - name: minSlotNum
 769          in: query
 770          required: false
 771          description: Only include batches with `slotNum < minSlotNum`.
 772          schema:
 773            $ref: '#/components/schemas/SlotNum'
 774        - name: maxSlothNum
 775          in: query
 776          required: false
 777          description: Only include batches with `slotNum > maxSlotNum`.
 778          schema:
 779            $ref: '#/components/schemas/SlotNum'
 780        - name: wonByEthereumAddress
 781          in: query
 782          required: false
 783          description: Only include slots won by a coordinator whose `forgerAddr == wonByEthereumAddress`.
 784          schema:
 785            $ref: '#/components/schemas/EthereumAddress'
 786        - name: finishedAuction
 787          in: query
 788          required: false
 789          description: If set to true, only include slots whose auction has finished.
 790          schema:
 791            type: boolean
 792        - name: fromItem
 793          in: query
 794          required: false
 795          description: Indicates the desired first item (using the itemId property) to be included in the response.
 796          schema:
 797            type: number
 798        - name: order
 799          in: query
 800          required: false
 801          description: Order of the returned items. Slots will be ordered by increasing `slotNum`.
 802          schema:
 803            type: string
 804            default: ASC
 805            enum:
 806                - ASC
 807                - DESC
 808        - name: limit
 809          in: query
 810          required: false
 811          description: Maximum number of items to be returned.
 812          schema:
 813            type: integer
 814            minimum: 1
 815            maximum: 2049
 816      responses:
 817        '200':
 818          description: Successful operation.
 819          content:
 820            application/json:
 821              schema:
 822                $ref: '#/components/schemas/Slots'
 823        '400':
 824          description: Bad request.
 825          content:
 826            application/json:
 827              schema:
 828                $ref: '#/components/schemas/Error400'
 829        '404':
 830          description: Not found.
 831          content:
 832            application/json:
 833              schema:
 834                $ref: '#/components/schemas/Error404'
 835        '500':
 836          description: Internal server error.
 837          content:
 838            application/json:
 839              schema:
 840                $ref: '#/components/schemas/Error500'
 841  '/slots/{slotNum}':
 842    get:
 843      tags:
 844        - Hermez status
 845      summary: Get information about a specific slot.
 846      description: >-
 847        Get information about a specific slot.        
 848      operationId: getSlot
 849      parameters:
 850        - name: slotNum
 851          in: path
 852          required: true
 853          description: Identifier of the slot.
 854          schema:
 855            $ref: '#/components/schemas/SlotNum'
 856      responses:
 857        '200':
 858          description: Successful operation.
 859          content:
 860            application/json:
 861              schema:
 862                $ref: '#/components/schemas/Slot'
 863        '400':
 864          description: Bad request.
 865          content:
 866            application/json:
 867              schema:
 868                $ref: '#/components/schemas/Error400'
 869        '404':
 870          description: Not found.
 871          content:
 872            application/json:
 873              schema:
 874                $ref: '#/components/schemas/Error404'
 875        '500':
 876          description: Internal server error.
 877          content:
 878            application/json:
 879              schema:
 880                $ref: '#/components/schemas/Error500'
 881  '/bids':
 882    get:
 883      tags:
 884        - Hermez status
 885      summary: Get a list of bids made for a specific slot auction.
 886      description: Get a list of bids made for a specific slot auction.
 887      operationId: getSlotBids
 888      parameters:
 889        - name: slotNum
 890          in: query
 891          description: Slot identifier. Specify the auction where the returned bids were made.
 892          required: false
 893          schema:
 894            $ref: '#/components/schemas/SlotNum'
 895        - name: bidderAddr
 896          in: query
 897          description: Get only bids made by a coordinator identified by its bidder address.
 898          required: false
 899          schema:
 900            $ref: '#/components/schemas/EthereumAddress'
 901        - name: fromItem
 902          in: query
 903          required: false
 904          description: Indicates the desired first item (using the itemId property) to be included in the response.
 905          schema:
 906            type: number
 907        - name: order
 908          in: query
 909          required: false
 910          description: Order of the returned items. Bids will be ordered by increasing (slotNum, bidValue)`.
 911          schema:
 912            type: string
 913            default: ASC
 914            enum:
 915                - ASC
 916                - DESC
 917        - name: limit
 918          in: query
 919          required: false
 920          description: Maximum number of items to be returned.
 921          schema:
 922            type: integer
 923            minimum: 1
 924            maximum: 2049
 925      responses:
 926        '200':
 927          description: Successful operation
 928          content:
 929            application/json:
 930              schema:
 931                $ref: '#/components/schemas/Bids'
 932        '400':
 933          description: Bad request.
 934          content:
 935            application/json:
 936              schema:
 937                $ref: '#/components/schemas/Error400'
 938        '404':
 939          description: Not found.
 940          content:
 941            application/json:
 942              schema:
 943                $ref: '#/components/schemas/Error404'
 944        '500':
 945          description: Internal server error.
 946          content:
 947            application/json:
 948              schema:
 949                $ref: '#/components/schemas/Error500'
 950  '/state':
 951    get:
 952      tags:
 953        - Hermez status
 954      summary: Return information that represents the current state of the network.
 955      description: Return information that represents the current state of the network. It also includes metrics and statistics.
 956      operationId: getState
 957      responses:
 958        '200':
 959          description: Successful operation.
 960          content:
 961            application/json:
 962              schema:
 963                $ref: '#/components/schemas/State'
 964        '400':
 965          description: Bad request.
 966          content:
 967            application/json:
 968              schema:
 969                $ref: '#/components/schemas/Error400'
 970        '500':
 971          description: Internal server error.
 972          content:
 973            application/json:
 974              schema:
 975                $ref: '#/components/schemas/Error500'
 976  '/config':
 977    get:
 978      tags:
 979        - Hermez status
 980      summary: Return constant configuration of the network.
 981      description: Return constant configuration of the network.
 982      operationId: getConfig
 983      responses:
 984        '200':
 985          description: Successful operation.
 986          content:
 987            application/json:
 988              schema:
 989                $ref: '#/components/schemas/Config'
 990        '500':
 991          description: Internal server error.
 992          content:
 993            application/json:
 994              schema:
 995                $ref: '#/components/schemas/Error500'
 996  '/tokens':
 997    get:
 998      tags:
 999        - Hermez status
1000      summary: Get information of the supported tokens in the Hermez network.
1001      description: Get information of the supported tokens in the Hermez network.
1002      operationId: getTokens
1003      parameters:
1004        - name: ids
1005          in: query
1006          required: false
1007          description: Include only specific tokens by their Hermez identifiers.
1008          schema:
1009            type: string
1010            description: Comma separated list of token identifiers
1011            example: "2,44,689"
1012        - name: symbols
1013          in: query
1014          required: false
1015          description: Include only specific tokens by their symbols.
1016          schema:
1017            type: string
1018            description: Comma separated list of token symbols.
1019            example: "DAI,NEC,UMA"
1020        - name: name
1021          in: query
1022          required: false
1023          description: Include token(s) by their names (or a substring of the name).
1024          schema:
1025            type: string
1026        - name: fromItem
1027          in: query
1028          required: false
1029          description: Indicates the desired first item (using the itemId property) to be included in the response.
1030          schema:
1031            type: number
1032        - name: order
1033          in: query
1034          required: false
1035          description: Order of the returned items. Tokens will be ordered by increasing tokenID.
1036          schema:
1037            type: string
1038            default: ASC
1039            enum:
1040                - ASC
1041                - DESC
1042        - name: limit
1043          in: query
1044          required: false
1045          description: Maximum number of items to be returned.
1046          schema:
1047            type: integer
1048            minimum: 1
1049            maximum: 2049
1050      responses:
1051        '200':
1052          description: Successful operation.
1053          content:
1054            application/json:
1055              schema:
1056                $ref: '#/components/schemas/Tokens'
1057        '400':
1058          description: Bad request.
1059          content:
1060            application/json:
1061              schema:
1062                $ref: '#/components/schemas/Error400'
1063        '404':
1064          description: Not found.
1065          content:
1066            application/json:
1067              schema:
1068                $ref: '#/components/schemas/Error404'
1069        '500':
1070          description: Internal server error.
1071          content:
1072            application/json:
1073              schema:
1074                $ref: '#/components/schemas/Error500'
1075  '/tokens/{id}':
1076    get:
1077      tags:
1078        - Hermez status
1079      summary: Get information of a token supported by Hermez network.
1080      description: Get information of a token supported by Hermez network.
1081      operationId: getToken
1082      parameters:
1083        - name: id
1084          in: path
1085          description: Token identifier
1086          required: true
1087          schema:
1088            $ref: '#/components/schemas/TokenId'
1089      responses:
1090        '200':
1091          description: Successful operation.
1092          content:
1093            application/json:
1094              schema:
1095                $ref: '#/components/schemas/Token'
1096        '400':
1097          description: Bad request.
1098          content:
1099            application/json:
1100              schema:
1101                $ref: '#/components/schemas/Error400'
1102        '404':
1103          description: Not found.
1104          content:
1105            application/json:
1106              schema:
1107                $ref: '#/components/schemas/Error404'
1108        '500':
1109          description: Internal server error.
1110          content:
1111            application/json:
1112              schema:
1113                $ref: '#/components/schemas/Error500'
1114  '/coordinators':
1115    get:
1116      tags:
1117        - Hermez status
1118      summary: Get information about coordinators.
1119      description: Get information about coordinators.
1120      operationId: getCoordinators
1121      parameters:
1122        - name: fromItem
1123          in: query
1124          required: false
1125          description: Indicates the desired first item (using the itemId property) to be included in the response.
1126          schema:
1127            type: number
1128        - name: order
1129          in: query
1130          required: false
1131          description: Order of the returned items. Coordinators will be ordered by increasing (ethereumBlock, forgerAddr).
1132          schema:
1133            type: string
1134            default: ASC
1135            enum:
1136                - ASC
1137                - DESC
1138        - name: limit
1139          in: query
1140          required: false
1141          description: Maximum number of items to be returned.
1142          schema:
1143            type: integer
1144            minimum: 1
1145            maximum: 2049
1146      responses:
1147        '200':
1148          description: Successful operation.
1149          content:
1150            application/json:
1151              schema:
1152                $ref: '#/components/schemas/Coordinators'
1153        '400':
1154          description: Bad request.
1155          content:
1156            application/json:
1157              schema:
1158                $ref: '#/components/schemas/Error400'
1159        '500':
1160          description: Internal server error.
1161          content:
1162            application/json:
1163              schema:
1164                $ref: '#/components/schemas/Error500'
1165  '/coordinators/{bidderAddr}':
1166    get:
1167      tags:
1168        - Hermez status
1169      summary: Get the information of a coordinator.
1170      description: Get the information of a coordinator.
1171      operationId: getCoordinator
1172      parameters:
1173        - name: bidderAddr
1174          in: path
1175          description: Coordinator identifier
1176          required: true
1177          schema:
1178            $ref: '#/components/schemas/EthereumAddress'
1179      responses:
1180        '200':
1181          description: Successful operation.
1182          content:
1183            application/json:
1184              schema:
1185                $ref: '#/components/schemas/Coordinator'
1186        '400':
1187          description: Bad request.
1188          content:
1189            application/json:
1190              schema:
1191                $ref: '#/components/schemas/Error400'
1192        '404':
1193          description: Not found.
1194          content:
1195            application/json:
1196              schema:
1197                $ref: '#/components/schemas/Error404'
1198        '500':
1199          description: Internal server error.
1200          content:
1201            application/json:
1202              schema:
1203                $ref: '#/components/schemas/Error500'
1204components:
1205  schemas:
1206    ItemId:
1207      type: integer
1208      description: Position of the item in the DB. This is useful for pagination, but has  nothing to do with the protocol.
1209    PostPoolL2Transaction:
1210      type: object
1211      description: L2 transaction to be posted.
1212      properties:
1213        id:
1214          $ref: '#/components/schemas/TransactionId'
1215        type:
1216          $ref: '#/components/schemas/TransactionTypeL2'
1217        tokenId:
1218          $ref: '#/components/schemas/TokenId'
1219        fromAccountIndex:
1220          $ref: '#/components/schemas/AccountIndex'
1221        toAccountIndex:
1222          type: string
1223          description: >-
1224            Identifier of the destination account. It references the position where the account is inside the state Merkle tree.
1225            The identifier is built using: `hez:` + `token symbol:` + `index`. If this is provided, toHezEthereumAddress and toBjj
1226            must be null. To perform an exit the value hez:EXIT:1 must be used.            
1227          example: null
1228          nullable: true
1229        toHezEthereumAddress:
1230          type: string
1231          description: "Address of an Etherum account linked to the Hermez network. If this is provided, toAccountIndex and toBjj must be null."
1232          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1233          example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
1234          nullable: true
1235        toBjj:
1236          type: string
1237          description: >-
1238            BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes.
1239            If this is prvided, toAccountIndex must be null and toHezEthereumAddress must be hez:0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.            
1240          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1241          example: null
1242          nullable: true
1243        amount:
1244          allOf:
1245            - $ref: '#/components/schemas/BigInt'
1246            - description: Amount of tokens to be sent.
1247              example: "6300000000000000000"
1248        fee:
1249          $ref: '#/components/schemas/FeeSelector'
1250        nonce:
1251          $ref: '#/components/schemas/Nonce'
1252        signature:
1253          allOf:
1254            - $ref: '#/components/schemas/BJJSignature'
1255            - description: Signature of the transaction. More info [here](https://idocs.hermez.io/#/spec/zkrollup/README?id=l2a-idl2).
1256            - example: "72024a43f546b0e1d9d5d7c4c30c259102a9726363adcc4ec7b6aea686bcb5116f485c5542d27c4092ae0ceaf38e3bb44417639bd2070a58ba1aa1aab9d92c03"
1257        requestFromAccountIndex:
1258          type: string
1259          description: References the `fromAccountIndex` of the requested transaction.
1260          example: null
1261          nullable: true
1262        requestToAccountIndex:
1263          type: string
1264          description: References the `toAccountIndex` of the requested transaction.
1265          example: null
1266          nullable: true
1267        requestToHezEthereumAddress:
1268          type: string
1269          description: References the `toHezEthereumAddress` of the requested transaction.
1270          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1271          example: null
1272          nullable: true
1273        requestToBjj:
1274          type: string
1275          description: References the `toBjj` of the requested transaction.
1276          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1277          example: null
1278          nullable: true
1279        requestTokenId:
1280          type: integer
1281          description: References the `tokenId` of the requested transaction.
1282          example: null
1283          nullable: true
1284        requestAmount:
1285          type: string
1286          description: References the `amount` of the requested transaction.
1287          example: null
1288          nullable: true
1289        requestFee:
1290          type: integer
1291          description: References the `fee` of the requested transaction.
1292          example: null
1293          nullable: true
1294        requestNonce:
1295          type: integer
1296          description: References the `nonce` of the requested transaction.
1297          example: null
1298          nullable: true
1299      required:
1300      - id
1301      - type
1302      - tokenId
1303      - fromAccountIndex
1304      - amount
1305      - fee
1306      - nonce
1307      - signature
1308    PoolL2Transaction:
1309      type: object
1310      properties:
1311        id:
1312          $ref: '#/components/schemas/TransactionId'
1313        type:
1314          $ref: '#/components/schemas/TransactionTypeL2'
1315        fromAccountIndex:
1316          $ref: '#/components/schemas/AccountIndex'
1317        fromHezEthereumAddress:
1318          type: string
1319          description: "Address of an Etherum account linked to the Hermez network."
1320          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1321          example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
1322          nullable: true
1323        fromBJJ:
1324          type: string
1325          description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
1326          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1327          example: "hez:9CK9fjQdMUTGm8KDvGLy3MB-vnP0NCcGX7Uh7OO6KRJm"
1328          nullable: true
1329        toAccountIndex:
1330          type: string
1331          description: >-
1332            Identifier of the destination account. It references the position where the account is inside the state Merkle tree.
1333            The identifier is built using: `hez:` + `token symbol:` + `index`            
1334          example: "hez:DAI:309"
1335          nullable: true
1336        toHezEthereumAddress:
1337          type: string
1338          description: "Address of an Etherum account linked to the Hermez network."
1339          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1340          example: null
1341          nullable: true
1342        toBjj:
1343          type: string
1344          description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
1345          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1346          example: null
1347          nullable: true
1348        amount:
1349          allOf:
1350            - $ref: '#/components/schemas/BigInt'
1351            - description: Amount of tokens to be sent.
1352              example: "6303020000000000000"
1353        fee:
1354          $ref: '#/components/schemas/FeeSelector'
1355        nonce:
1356          $ref: '#/components/schemas/Nonce'
1357        state:
1358          $ref: '#/components/schemas/PoolL2TransactionState'
1359        signature:
1360          allOf:
1361            - $ref: '#/components/schemas/BJJSignature'
1362            - description: Signature of the transaction. More info [here](https://idocs.hermez.io/#/spec/zkrollup/README?id=l2a-idl2).
1363            - example: "72024a43f546b0e1d9d5d7c4c30c259102a9726363adcc4ec7b6aea686bcb5116f485c5542d27c4092ae0ceaf38e3bb44417639bd2070a58ba1aa1aab9d92c03"
1364        timestamp:
1365          type: string
1366          description: Moment in which the transaction was added to the pool.
1367          format: date-time
1368        batchNum:
1369          type: integer
1370          description: Identifier of a batch. Every new forged batch increments by one the batchNum, starting at 0.
1371          minimum: 0
1372          maximum: 4294967295
1373          nullable: true
1374          example: null
1375        requestFromAccountIndex:
1376          type: string
1377          description: >-
1378            Identifier of an account. It references the position where the account is inside the state Merkle tree.
1379            The identifier is built using: `hez:` + `token symbol:` + `index`            
1380          nullable: true
1381          example: null
1382        requestToAccountIndex:
1383          type: string
1384          description: >-
1385            Identifier of an account. It references the position where the account is inside the state Merkle tree.
1386            The identifier is built using: `hez:` + `token symbol:` + `index`            
1387          nullable: true
1388          example: null
1389        requestToHezEthereumAddress:
1390          type: string
1391          description: "Address of an Etherum account linked to the Hermez network."
1392          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1393          nullable: true
1394          example: null
1395        requestToBJJ:
1396          type: string
1397          description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
1398          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1399          nullable: true
1400          example: null
1401        requestTokenId:
1402          type: integer
1403          description: References the `tokenId` of the requested transaction.
1404          example: null
1405          nullable: true
1406        requestAmount:
1407          type: string
1408          description: BigInt is an integer encoded as a string for numbers that are very large.
1409          nullable: true
1410          example: null
1411        requestFee:
1412          type: integer
1413          description: Index of the fee type to select, more info [here](https://idocs.hermez.io/#/spec/zkrollup/fee-table?id=transaction-fee-table).
1414          minimum: 0
1415          maximum: 256
1416          nullable: true
1417          example: null
1418        requestNonce:
1419          type: integer
1420          description: Number that can only be used once per account. Increments by one with each transaction.
1421          minimum: 0
1422          maximum: 1.84467440737096e+19
1423          nullable: true
1424          example: null
1425        token:
1426          $ref: '#/components/schemas/Token'
1427      required:
1428        - id
1429        - type
1430        - fromAccountIndex
1431        - fromHezEthereumAddress
1432        - fromBJJ
1433        - toAccountIndex
1434        - toHezEthereumAddress
1435        - toBjj
1436        - amount
1437        - fee
1438        - nonce
1439        - state
1440        - signature
1441        - timestamp
1442        - batchNum
1443        - requestFromAccountIndex
1444        - requestToAccountIndex
1445        - requestToHezEthereumAddress
1446        - requestToBJJ
1447        - requestTokenId
1448        - requestAmount
1449        - requestFee
1450        - requestNonce
1451        - token
1452    TransactionId:
1453      type: string
1454      description: Identifier for transactions. Used for any kind of transaction (both L1 and L2). More info on how the identifiers are built [here](https://idocs.hermez.io/#/spec/architecture/db/README?id=txid)
1455      example: "0x00000000000001e240004700" 
1456    EthereumAddress:
1457      type: string
1458      description: "Address of an Etherum account."
1459      pattern: "^0x[a-fA-F0-9]{40}$"
1460      example: "0xaa942cfcd25ad4d90a62358b0dd84f33b398262a" 
1461    HezEthereumAddress:
1462      type: string
1463      description: "Address of an Etherum account linked to the Hermez network."
1464      pattern: "^hez:0x[a-fA-F0-9]{40}$"
1465      example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a" 
1466    BJJ:
1467      type: string
1468      description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
1469      pattern: "^hez:[A-Za-z0-9_-]{44}$"
1470      example: "hez:rR7LXKal-av7I56Y0dEBCVmwc9zpoLY5ERhy5w7G-xwe"
1471    AccountIndex:
1472      type: string
1473      description: >-
1474        Identifier of an account. It references the position where the account is inside the state Merkle tree.
1475        The identifier is built using: `hez:` + `token symbol:` + `index`        
1476      example: "hez:DAI:4444"
1477    TransactionType:
1478      type: string
1479      description: Type of transaction.
1480      enum:
1481      - Exit
1482      - Transfer
1483      - Deposit
1484      - CreateAccountDeposit
1485      - CreateAccountDepositTransfer
1486      - DepositTransfer
1487      - ForceTransfer
1488      - ForceExit
1489      - TransferToEthAddr
1490      - TransferToBJJ
1491    TransactionTypeL2:
1492      type: string
1493      description: Type of transaction.
1494      enum:
1495      - Exit
1496      - Transfer
1497      - TransferToEthAddr
1498      - TransferToBJJ
1499    TokenId:
1500      type: integer
1501      description: Identifier of a token registered in the network.
1502      minimum: 0
1503      maximum: 4294967295
1504      example: 98765
1505    BigInt:
1506      type: string
1507      description: BigInt is an integer encoded as a string for numbers that are very large.
1508      example: "8708856933496328593"
1509      pattern: "^\\d+$"
1510    FeeSelector:
1511      type: integer
1512      description: Index of the fee type to select, more info [here](https://idocs.hermez.io/#/spec/zkrollup/fee-table?id=transaction-fee-table).
1513      minimum: 0
1514      maximum: 256
1515      example: 36
1516    Nonce:
1517      type: integer
1518      description: Number that can only be used once per account, increments by one at each transaction.
1519      minimum: 0
1520      maximum: 1.84467440737096e+19
1521      example: 121
1522    PoolL2TransactionState:
1523      type: string
1524      description: > 
1525        State of a L2 transaction from the coordinator pool.
1526          * pend: Pending
1527          * fing: Forging
1528          * fged: Forged
1529          * invl: Invalid  
1530      enum:
1531      - pend
1532      - fing
1533      - fged
1534      - invl    
1535    ETHSignature:
1536      type: string
1537      description: Ethereum signature.
1538      pattern: "^0x[a-fA-F0-9]{130}$"
1539      example: "0xf9161cd688394772d93aa3e7b3f8f9553ca4f94f65b7cece93ed4a239d5c0b4677dca6d1d459e3a5c271a34de735d4664a43e5a8960a9a6e027d12c562dd448e1c"
1540    BJJSignature:
1541      type: string
1542      description: BabyJubJub compressed signature.
1543      pattern: "^[a-fA-F0-9]{128}$"
1544      example: "72024a43f546b0e1d9d5d7c4c30c259102a9726363adcc4ec7b6aea686bcb5116f485c5542d27c4092ae0ceaf38e3bb44417639bd2070a58ba1aa1aab9d92c03"
1545    BatchNum:
1546      type: integer
1547      description: Identifier of a batch. Every new forged batch increments by one the batchNum, starting at 0.
1548      minimum: 0
1549      maximum: 4294967295
1550      example: 5432
1551    AccountCreationAuthorizationPost:
1552      type: object
1553      properties:
1554        hezEthereumAddress:
1555          $ref: '#/components/schemas/HezEthereumAddress'
1556        bjj:
1557          $ref: '#/components/schemas/BJJ'
1558        signature:
1559          $ref: '#/components/schemas/ETHSignature'
1560      required:
1561      - hezEthereumAddress
1562      - bjj
1563      - signature
1564    AccountCreationAuthorization:
1565      type: object
1566      properties:
1567        timestamp:
1568          type: string
1569          format: date-time
1570        hezEthereumAddress:
1571          $ref: '#/components/schemas/HezEthereumAddress'
1572        bjj:
1573          $ref: '#/components/schemas/BJJ'
1574        signature:
1575          $ref: '#/components/schemas/ETHSignature'
1576      required:
1577      - timestamp
1578      - hezEthereumAddress
1579      - bjj
1580      - signature
1581    HistoryTransaction:
1582      type: object
1583      description: Transaction of the Hermez network
1584      properties:
1585        L1orL2:
1586          type: string
1587          enum:
1588            - L1
1589            - L2
1590        id:
1591          $ref: '#/components/schemas/TransactionId'
1592        itemId:
1593          $ref: '#/components/schemas/ItemId'
1594        type:
1595          $ref: '#/components/schemas/TransactionType'
1596        position:
1597          $ref: '#/components/schemas/TransactionPosition'
1598        fromAccountIndex:
1599          type: string
1600          description: >-
1601            Identifier of an account. It references the position where the account is inside the state Merkle tree.
1602            The identifier is built using: `hez:` + `token symbol:` + `index`            
1603          example: "hez:DAI:4444"
1604          nullable: true
1605        fromHezEthereumAddress:
1606          type: string
1607          description: "Address of an Etherum account linked to the Hermez network."
1608          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1609          example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
1610          nullable: true
1611        fromBJJ:
1612          type: string
1613          description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
1614          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1615          example: "hez:9CK9fjQdMUTGm8KDvGLy3MB-vnP0NCcGX7Uh7OO6KRJm"
1616          nullable: true
1617        toAccountIndex:
1618          allOf:
1619            - $ref: '#/components/schemas/AccountIndex'
1620            - example: "hez:DAI:672"
1621        toHezEthereumAddress:
1622          type: string
1623          description: "Address of an Etherum account linked to the Hermez network."
1624          pattern: "^hez:0x[a-fA-F0-9]{40}$"
1625          example: "hez:0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
1626          nullable: true
1627        toBJJ:
1628          type: string
1629          description: "BabyJubJub public key, encoded as base64 URL (RFC 4648), which result in 33 bytes. The padding byte is replaced by a sum of the encoded bytes."
1630          pattern: "^hez:[A-Za-z0-9_-]{44}$"
1631          example: "hez:f1J78_6uqTyjX6jrVCqN4RFeRBnWQAGl477ZFtOnH6Sm"
1632          nullable: true
1633        amount:
1634          allOf:
1635            - $ref: '#/components/schemas/BigInt'
1636            - description: Amount of tokens to be sent.
1637            -  example: "4903020000000000000"
1638        batchNum:
1639          type: integer
1640          description: Batch in which the transaction was forged. Null indicates not forged yet.
1641          minimum: 0
1642          maximum: 4294967295
1643          example: 5432
1644          nullable: true
1645        historicUSD:
1646          type: number
1647          description: Value in USD at the moment the transaction was forged.
1648          example: 49.7
1649          nullable: true
1650        timestamp:
1651          type: string
1652          format: date-time
1653          description: In the case of L1 indicates the moment where the transaction was added in the smart contract. For L2 indicates when the transaction was forged.
1654        token:
1655          $ref: '#/components/schemas/Token'
1656        L1Info:
1657          type: object
1658          description: Additional information that only applies to L1 transactions.
1659          nullable: true
1660          properties:
1661            toForgeL1TransactionsNum:
1662              $ref: '#/components/schemas/ToForgeL1TransactionsNum'
1663            userOrigin:
1664              type: boolean
1665              description: True if the transaction was sent by a user. False if it was sent by a coordinator.
1666            loadAmount:
1667              allOf:
1668                - $ref: '#/components/schemas/BigInt'
1669                - description: Tokens transfered from L1 to L2.
1670                - example: "4900000000000000000"
1671            historicLoadAmountUSD:
1672              type: number
1673              description: Load amount in USD, at the moment the transaction was made.
1674              example: 3.897
1675              nullable: true
1676            ethereumBlockNum:
1677              allOf:
1678                - $ref: '#/components/schemas/EthBlockNum'
1679                - description: Ethereum block in which the transaction was added to the smart contract forge queue.
1680                - example: 258723049
1681          required:
1682            - toForgeL1TransactionsNum
1683            - userOrigin
1684            - loadAmount
1685            - historicLoadAmountUSD
1686            - ethereumBlockNum
1687          additionalProperties: false
1688        L2Info:
1689          type: object
1690          description: Additional information that only applies to L2 transactions.
1691          nullable: true
1692          properties:
1693            fee:
1694              $ref: '#/components/schemas/FeeSelector'
1695            historicFeeUSD:
1696              type: number
1697              description: Fee in USD, at the moment the transaction was forged.
1698              example: 263.89
1699              nullable: true
1700            nonce:
1701              $ref: '#/components/schemas/Nonce'
1702          example: null
1703          required:
1704            - fee
1705            - historicFeeUSD
1706            - nonce
1707          additionalProperties: false
1708      required:
1709        - L1orL2
1710        - id
1711        - itemId
1712        - type
1713        - position
1714        - fromAccountIndex
1715        - fromHezEthereumAddress
1716        - fromBJJ
1717        - toAccountIndex
1718        - toHezEthereumAddress
1719        - toBJJ
1720        - amount
1721        - batchNum
1722        - historicUSD
1723        - timestamp
1724        - token
1725        - L1Info
1726        - L2Info
1727      additionalProperties: false
1728    HistoryTransactions:
1729      type: object
1730      properties:
1731        transactions:
1732          type: array
1733          description: List of history transactions.
1734          items: 
1735            $ref: '#/components/schemas/HistoryTransaction'
1736        pagination:
1737          $ref: '#/components/schemas/PaginationInfo'
1738      required:
1739        - transactions
1740        - pagination
1741      additionalProperties: false
1742    EthBlockNum:
1743      type: integer
1744      description: Ethereum block number
1745      minimum: 0
1746      maximum: 1.84467440737096e+19
1747      example: 762375478
1748    ToForgeL1TransactionsNum:
1749      type: integer
1750      description: Reference to know in which batch a L1 transaction was forged / will be forged.
1751      minimum: 0
1752      maximum: 4294967295
1753      example: 784
1754      nullable: true
1755    TransactionPosition:
1756      type: integer
1757      description: Position that a transaction occupies in a batch.
1758      minimum: 0
1759      example: 5
1760    URL:
1761      type: string
1762      description: HTTP URL
1763      example: "https://hermez.io"
1764    TokenSymbol:
1765      type: string
1766      description: Abreviation of the token name.
1767      example: "DAI"
1768    TokenName:
1769      type: string
1770      description: Token name.
1771      example: "Dai"
1772    CollectedFees:
1773      type: object
1774      description: Collected fees by the forger of the batch, represented by a map of tokenId => amount. A maximum of 64 different tokens can be used.
1775      additionalProperties:
1776        type: string
1777      example:
1778        1234: "425632785672345647"
1779        4321: "86538967235465432654352"
1780    Batch:
1781      type: object
1782      description: Group of transactions forged in a coordinator and sent and validated in Ethereum.
1783      properties:
1784        itemId:
1785          $ref: '#/components/schemas/ItemId'
1786        batchNum:
1787          $ref: '#/components/schemas/BatchNum'
1788        ethereumBlockNum:
1789          $ref: '#/components/schemas/EthBlockNum'
1790        ethereumBlockHash:
1791          type: string
1792          description: hash of the Ethereum block in which the batch was forged
1793          example: "0xfe88c94d860f01a17f961bf4bdfb6e0c6cd10d3fda5cc861e805ca1240c58553"
1794        timestamp:
1795          type: string
1796          format: date-time
1797          description: Time in which the batch was forged.
1798        forgerAddr:
1799          $ref: '#/components/schemas/EthereumAddress'
1800        collectedFees:
1801          $ref: '#/components/schemas/CollectedFees'
1802        historicTotalCollectedFeesUSD:
1803          type: number
1804          description: Sum of the all the fees collected, in USD, at the moment the batch was forged.
1805          example: 23.3
1806        stateRoot:
1807          allOf:
1808            - $ref: '#/components/schemas/Hash'
1809            - description: Root of the accounts Merkle Tree.
1810            - example: "2734657026572a8708d883"
1811        numAccounts:
1812          type: integer
1813          description: Number of registered accounts in this batch.
1814        exitRoot:
1815          allOf:
1816            - $ref: '#/components/schemas/Hash'
1817            - description: Root of the exit Merkle Tree associated to this batch.
1818            - example: "2734657026572a8708d883"
1819        forgeL1TransactionsNum:
1820          type: integer
1821          description: Identifier that corresponds to the group of L1 transactions forged in the current batch.
1822          example: 5
1823          nullable: true
1824        slotNum:
1825          $ref: '#/components/schemas/SlotNum'
1826      additionalProperties: false
1827      required:
1828          - itemId
1829          - batchNum
1830          - ethereumBlockNum
1831          - ethereumBlockHash
1832          - timestamp
1833          - forgerAddr
1834          - collectedFees
1835          - historicTotalCollectedFeesUSD
1836          - stateRoot
1837          - numAccounts
1838          - exitRoot
1839          - forgeL1TransactionsNum
1840          - slotNum
1841    FullBatch:
1842      type: object
1843      description: Group of transactions forged in a coordinator and sent and validated in Ethereum.
1844      properties:
1845        batch:
1846          $ref: '#/components/schemas/Batch'
1847        transactions:
1848          type: array
1849          description: List of forged transactions in the batch
1850          items:
1851            $ref: '#/components/schemas/HistoryTransaction'
1852      additionalProperties: false
1853      required:
1854        - batch
1855        - transactions
1856    Hash:
1857      type: string
1858      description: hashed data
1859      example: "2734657026572a8708d883"
1860    SlotNum:
1861      type: integer
1862      description: Identifier of a slot.
1863      minimum: 0
1864      maximum: 4294967295
1865      example: 784        
1866    Batches:
1867      type: object
1868      properties:
1869        batches:
1870          type: array
1871          description: List of batches.
1872          items:
1873            $ref: '#/components/schemas/Batch'
1874        pagination:
1875          $ref: '#/components/schemas/PaginationInfo'
1876      additionalProperties: false
1877      required:
1878        - batches
1879        - pagination
1880    Coordinator:
1881      type: object
1882      properties:
1883        itemId:
1884          $ref: '#/components/schemas/ItemId'
1885        forgerAddr:
1886          $ref: '#/components/schemas/EthereumAddress'
1887        bidderAddr:
1888          $ref: '#/components/schemas/EthereumAddress'
1889        URL:
1890          $ref: '#/components/schemas/URL'
1891        ethereumBlock:
1892          allOf:
1893            - $ref: '#/components/schemas/EthBlockNum'
1894            - description: Ethereum block in which the coordinator registered into the network.
1895            - example: 5735943738
1896      additionalProperties: false
1897      required:
1898        - itemId
1899        - forgerAddr
1900        - bidderAddr
1901        - URL
1902        - ethereumBlock
1903    Coordinators:
1904      type: object
1905      properties:
1906        coordinators:
1907          type: array
1908          description: List of coordinators.
1909          items: 
1910            $ref: '#/components/schemas/Coordinator'
1911        pagination:
1912          $ref: '#/components/schemas/PaginationInfo'
1913      additionalProperties: false
1914      required:
1915        - coordinators
1916        - pagination
1917    Bid:
1918      type: object
1919      description: Tokens placed in an auction by a coordinator to gain the right to forge batches during a specific slot.
1920      properties:
1921        itemId:
1922          $ref: '#/components/schemas/ItemId'
1923        bidderAddr:
1924          $ref: '#/components/schemas/EthereumAddress'
1925        forgerAddr:
1926          $ref: '#/components/schemas/EthereumAddress'
1927        slotNum:
1928          $ref: '#/components/schemas/SlotNum'
1929        URL:
1930          $ref: '#/components/schemas/URL'
1931        bidValue:
1932          $ref: '#/components/schemas/BigInt'
1933        ethereumBlockNum:
1934          $ref: '#/components/schemas/EthBlockNum'
1935        timestamp:
1936          type: string
1937          format: date-time
1938      additionalProperties: false
1939      require:
1940        - bidderAddr
1941        - forgerAddr
1942        - slotNum
1943        - URL
1944        - bidValue
1945        - ethereumBlockNum
1946        - timestamp
1947    Bids:
1948      type: object
1949      properties:
1950        bids:
1951          type: array
1952          description: List of bids.
1953          items: 
1954            $ref: '#/components/schemas/Bid'
1955        pagination:
1956          $ref: '#/components/schemas/PaginationInfo'
1957      additionalProperties: false
1958      require:
1959        - bids
1960        - pagination
1961    RecommendedFee:  
1962      type: object
1963      description: Fee that the coordinator recommends per transaction in USD.
1964      properties:
1965        existingAccount:
1966          type: number
1967          description: Recommended fee if the destination account of the transaction already exists.
1968          minimum: 0
1969          example: 0.1
1970        createAccount:
1971          type: number
1972          description: Recommended fee if the destination account of the transaction doesn't exist, but the coordinator has an authorization to create a valid account associated to an Ethereum address and a BJJ public key controlled by the receiver.
1973          minimum: 0
1974          example: 1.3
1975        createAccountInternal:
1976          type: number
1977          description: Recommended fee if the destination account of the transaction doesn't exist, but the coordinator has the ability to create a valid account associated to a BJJ public key controlled by the receiver. Note that these kind of accounts are not associated to an Ethereum address and therefore can only operate in L2. 
1978          minimum: 0
1979          example: 0.5
1980    Token:
1981      type: object
1982      description: Hermez network compatible and registered token.
1983      properties:
1984        id:
1985          $ref: '#/components/schemas/TokenId'
1986        ethereumAddress:
1987          allOf:
1988            - $ref: '#/components/schemas/EthereumAddress'
1989            - description: Ethereum address in which the token is deployed.
1990            - example: "0xaa942cfcd25ad4d90a62358b0dd84f33b398262a"
1991        itemId:
1992          $ref: '#/components/schemas/ItemId'
1993        name:
1994          type: string
1995          description: full name of the token
1996          example: Maker Dai
1997        symbol:
1998          allOf:
1999            - $ref: '#/components/schemas/TokenSymbol'
2000            - example: DAI
2001        decimals:
2002          type: integer
2003          description: Number of decimals of the token.
2004          example: 18
2005        ethereumBlockNum:
2006          allOf:
2007            - $ref: '#/components/schemas/EthBlockNum'
2008            - description: Ethereum block number in which the token was added to the Hermez network.
2009            - example: 539847538
2010        USD:
2011          type: number
2012          description: Value of the token in USD.
2013          example: 1.01
2014          nullable: true
2015        fiatUpdate:
2016          type: string
2017          format: date-time
2018          description: Timestamp of the moment the `USD` value was updated.
2019          nullable: true
2020      required:
2021        - id
2022        - ethereumAddress
2023        - itemId
2024        - name
2025        - symbol
2026        - decimals
2027        - ethereumBlockNum
2028        - USD
2029        - fiatUpdate
2030      additionalProperties: false
2031    Tokens:
2032      type: object
2033      properties:
2034        tokens:
2035          type: array
2036          description: List of tokens.
2037          items: 
2038            $ref: '#/components/schemas/Token'
2039        pagination:
2040          $ref: '#/components/schemas/PaginationInfo'
2041    Exit:
2042      type: object
2043      description: Exit tree leaf. It Contains the necessary information to perform a withdrawal.
2044      properties:
2045        batchNum:
2046          allOf:
2047            - $ref: '#/components/schemas/BatchNum'
2048            - description: Batch in which the exit was forged.
2049            - example: 7394
2050        accountIndex:
2051          $ref: '#/components/schemas/AccountIndex'
2052        itemId:
2053          $ref: '#/components/schemas/ItemId'
2054        merkleProof:
2055          type: object
2056          description: Existence proof of a leaf in a given Merkle Root. Encoded as hexadecimal string.
2057          properties:
2058              Root:
2059                $ref: '#/components/schemas/BigInt'
2060              Siblings:
2061                type: array
2062                items:
2063                  $ref: '#/components/schemas/BigInt'
2064              OldKey:
2065                $ref: '#/components/schemas/BigInt'
2066              OldValue:
2067                $ref: '#/components/schemas/BigInt'
2068              IsOld0:
2069                type: boolean
2070              Key:
2071                $ref: '#/components/schemas/BigInt'
2072              Value:
2073                $ref: '#/components/schemas/BigInt'
2074              Fnc:
2075                type: integer
2076                maximum: 3
2077                minimum: 0
2078          required:
2079            - Root
2080            - Siblings
2081            - OldKey
2082            - OldValue
2083            - IsOld0
2084            - Key
2085            - Value
2086            - Fnc
2087          additionalProperties: false
2088        balance:
2089          $ref: '#/components/schemas/BigInt'
2090        instantWithdrawn:
2091          type: integer
2092          description: Block in which the exit balance was instantly withdrawn. Null indicates that an instant withdrawn hasn't been performed.
2093          minimum: 0
2094          maximum: 1.84467440737096e+19
2095          example: 74747363
2096          nullable: true
2097        delayedWithdrawRequest:
2098          type: integer
2099          description: Block in which the exit balance was requested to delay withdraw. Null indicates that a delay withdraw hasn't been performed.
2100          minimum: 0
2101          maximum: 1.84467440737096e+19
2102          example: null
2103          nullable: true
2104        delayedWithdrawn:
2105          type: integer
2106          description: Block in which the exit balance was delayed withdrawn after a delay withdraw request. Null indicates that a delay withdraw hasn't been performed.
2107          minimum: 0
2108          maximum: 1.84467440737096e+19
2109          example: null
2110          nullable: true
2111        token:
2112          $ref: '#/components/schemas/Token'
2113      required:
2114          - batchNum
2115          - accountIndex
2116          - itemId
2117          - merkleProof
2118          - balance
2119          - instantWithdrawn
2120          - delayedWithdrawRequest
2121          - delayedWithdrawn
2122          - token
2123      additionalProperties: false
2124    Exits:
2125      type: object
2126      properties:
2127        exits:
2128          type: array
2129          description: List of exits.
2130          items: 
2131            $ref: '#/components/schemas/Exit'
2132        pagination:
2133          $ref: '#/components/schemas/PaginationInfo'   
2134      required:
2135          - exits
2136          - pagination
2137      additionalProperties: false 
2138    Account:
2139      type: object
2140      description: State tree leaf. It contains balance and nonce of an account.
2141      properties:
2142        accountIndex:
2143          $ref: '#/components/schemas/AccountIndex'
2144        nonce:
2145          $ref: '#/components/schemas/Nonce'      
2146        balance:
2147          $ref: '#/components/schemas/BigInt'
2148        bjj:
2149          $ref: '#/components/schemas/BJJ'      
2150        hezEthereumAddress:
2151          $ref: '#/components/schemas/HezEthereumAddress'
2152        token:
2153          $ref: '#/components/schemas/Token'
2154    Accounts:
2155      type: object
2156      properties:
2157        accounts:
2158          type: array
2159          description: List of accounts.
2160          items: 
2161            $ref: '#/components/schemas/Account'
2162        pagination:
2163          $ref: '#/components/schemas/PaginationInfo'
2164    Slot:
2165      type: object
2166      description: Slot information.
2167      properties:
2168        slotNum:
2169          $ref: '#/components/schemas/SlotNum'
2170        firstBlock:
2171          allOf:
2172            - $ref: '#/components/schemas/EthBlockNum'
2173            - description: Block in which the slot began or will begin
2174            - example: 76238647846
2175        lastBlock:
2176          allOf:
2177            - $ref: '#/components/schemas/EthBlockNum'
2178            - description: Block in which the slot ended or will end
2179            - example: 4475934
2180        closedAuction:
2181          type: boolean
2182          description: Whether the auction of the slot has finished or not.
2183        winner:
2184          allOf:
2185            - $ref: '#/components/schemas/Coordinator'
2186            - description: Coordinator who won the auction. Only applicable if the auction is closed.
2187            - nullable: true
2188            - example: null
2189    Slots:
2190      type: object
2191      properties:
2192        nextForgers:
2193          type: array
2194          description: List of slots.
2195          items: 
2196            $ref: '#/components/schemas/Slot'
2197        pagination:
2198          $ref: '#/components/schemas/PaginationInfo'
2199    NextForger:
2200      type: object
2201      description: Coordinator information along with the scheduled forging period
2202      properties:
2203        coordinator:
2204          $ref: '#/components/schemas/Coordinator'
2205        period:
2206          type: object
2207          description: Time period in which the coordinator will have the ability to forge. Specified both in Ethereum blocks and timestamp
2208          properties:
2209            fromBlock:
2210              $ref: '#/components/schemas/EthBlockNum'
2211            toBlock:
2212              $ref: '#/components/schemas/EthBlockNum'
2213            fromTimestamp:
2214              type: string
2215              format: date-time
2216            toTimestamp:
2217              type: string
2218              format: date-time
2219    NextForgers:
2220      type: object
2221      properties:
2222        nextForgers:
2223          type: array
2224          description: List of next coordinators to forge.
2225          items: 
2226            $ref: '#/components/schemas/NextForger'
2227        pagination:
2228          $ref: '#/components/schemas/PaginationInfo'
2229    State:
2230      type: object
2231      description: Gobal variables of the network
2232      properties:
2233        network:
2234          type: object
2235          description: Gobal statistics of the network
2236          properties:
2237            lastBlock:
2238              allOf:
2239                - $ref: '#/components/schemas/EthBlockNum'
2240                - description: Last synchronized Etherum block.
2241                - example: 3457437
2242            lastBatch:
2243              $ref: '#/components/schemas/Batch'
2244            currentSlot:
2245              allOf:
2246                - $ref: '#/components/schemas/SlotNum'
2247                - description: Slot where batches are currently being forged.
2248                - example: 2334
2249            nextForgers:
2250              $ref: '#/components/schemas/NextForgers'
2251          additionalProperties: false
2252          require: 
2253            - lastBlock
2254            - lastBatch
2255            - currentSlot
2256            - nextForgers
2257        metrics:
2258          type: object
2259          description: Metrics of the network
2260          properties:
2261            transactionsPerBatch:
2262              type: number
2263              description: Average transactions per batch in the last 24 hours.
2264              example: 2002.7
2265            batchFrequency:
2266              type: number
2267              description: Average elapsed time between batches in the last 24 hours, in seconds.
2268              example: 8.9
2269            transactionsPerSecond:
2270              type: number
2271              description: Average transactions per second in the last 24 hours.
2272              example: 302.3
2273            totalAccounts:
2274              type: integer
2275              description: Number of created accounts.
2276              example: 90473
2277            totalBJJs:
2278              type: integer
2279              description: Number of different registered BJJs.
2280              example: 23067
2281            avgTransactionFee:
2282              type: number
2283              description: Average fee percentage paid for L2 transactions in the last 24 hours.
2284              example: 1.54
2285          additionalProperties: false
2286          require:
2287            - transactionsPerBatch
2288            - batchFrequency
2289            - transactionsPerSecond
2290            - totalAccounts
2291            - totalBJJs
2292            - avgTransactionFee
2293        rollup:
2294          type: object
2295          description: Rollup parameters
2296          properties:
2297            forgeL1L2BatchTimeout:
2298              type: integer
2299              description: Max ethereum blocks after the last L1-L2-batch, when exceeds the timeout only L1-L2-batch are allowed.
2300              example: 5
2301            feeAddToken:
2302              type: integer
2303              description: Fee to pay when registering tokens into the network.
2304              example: 5698
2305            withdrawalDelay:
2306              type: integer
2307              description: Withdraw delay in seconds
2308              example: 432000
2309            buckets:
2310              type: array
2311              description: List of buckets state
2312              items:
2313                type: object
2314                properties:
2315                  ceilUSD:
2316                    type: integer
2317                    description: Max USD value
2318                    example: 1000
2319                  blockStamp:
2320                    type: integer
2321                    description: Last time a withdrawal was added ( or removed if the bucket was full)
2322                    example: 4475934
2323                  withdrawals:
2324                    type: integer
2325                    description: Available withdrawals of the bucket
2326                    example: 4
2327                  blockWithdrawalRate:
2328                    type: integer
2329                    description: Every `blockWithdrawalRate` blocks add 1 withdrawal
2330                    example: 8
2331                  maxWithdrawals:
2332                    type: integer
2333                    description: Max withdrawals the bucket can hold
2334                    example: 4
2335                additionalProperties: false
2336                require: 
2337                  - ceilUSD
2338                  - blockStamp
2339                  - withdrawals
2340                  - blockWithdrawalRate
2341                  - maxWithdrawals
2342          additionalProperties: false
2343          require: 
2344            - forgeL1L2BatchTimeout
2345            - feeAddToken
2346            - withdrawalDelay
2347            - buckets
2348        auction:
2349          type: object
2350          description: Auction parameters.
2351          properties:
2352            bootCoordinator:
2353              allOf:
2354                - $ref: '#/components/schemas/EthereumAddress'
2355                - description: Ethereum address of the boot coordinator.
2356                - example: "0x997dc4262BCDbf85190C01c996b4C06a461d2430"
2357            slotDeadline:
2358              type: integer
2359              description: Number of blocks after the beginning of a slot after which any coordinator can forge if the winner has not forged any batch in that slot.
2360              example: 3
2361            closedAuctionSlots:
2362              type: integer
2363              description: Amount of slots between the current slot and the slot auction that is closed. Example if the value is 2, when slot 10 begins, the auction of the slot 12 gets closed.
2364              example: 2
2365            openAuctionSlots:
2366              type: integer
2367              description: How many days in advance are auctions opened.
2368            defaultSlotSetBid:
2369              type: array
2370              description: "Initial minimal bid for each auction. Expressed as an array of 6 values. To calculate which value corresponds to each slot: `initialMinimalBidding[slotNum%6]`."
2371              items:
2372                type: integer
2373              example: [32,0,68,21,55,99]
2374            outbidding:
2375              type: number
2376              description: Minimum outbid over the previous one to consider it valid.
2377              example: 3.64
2378            donationAddress:
2379              allOf:
2380                - $ref: '#/components/schemas/EthereumAddress'
2381                - description: Ethereum address where the donations will go to.
2382                - example: "0x887dc4262BCDbf85190C01c996b4C06a461d2430"
2383            allocationRatio:
2384              type: array
2385              description: Percentage in which fees will be splitted between donations, governance and burning. The sum of the tree values should be 100.
2386              items:
2387                type: integer
2388              example: [80,10,10]
2389          additionalProperties: false
2390          require: 
2391            - bootCoordinator
2392            - slotDeadline
2393            - closedAuctionSlots
2394            - openAuctionSlots
2395            - defaultSlotSetBid
2396            - outbidding
2397            - donationAddress
2398            - allocationRatio
2399        withdrawalDelayer:
2400          type: object
2401          description: Withdrawal delayer parameters
2402          properties:
2403            hermezRollupAddress:
2404              allOf:
2405                - $ref: '#/components/schemas/EthereumAddress'
2406                - description: Ethereum address of the rollup smart contract.
2407                - example: "0x777dc4262BCDbf85190C01c996b4C06a461d2430"
2408            hermezGovernanceDAOAddress:
2409              allOf:
2410                - $ref: '#/components/schemas/EthereumAddress'
2411                - description: Ethereum address of the governance DAO.
2412                - example: "0x667dc4262BCDbf85190C01c996b4C06a461d2430"
2413            whiteHackGroupAddress:
2414              allOf:
2415                - $ref: '#/components/schemas/EthereumAddress'
2416                - description: Ethereum Address that can claim the funds in an emergency when the maximum emergency mode time is exceeded.
2417                - example: "0x557dc4262BCDbf85190C01c996b4C06a461d2430"
2418            hermezKeeperAddress:
2419              allOf:
2420                - $ref: '#/components/schemas/EthereumAddress'
2421                - description: Ethereum Address that can enable emergency mode and modify the delay to make a withdrawal.
2422                - example: "0x557dc4262BCDbf85190C01c996b4C06a461d2430"
2423            withdrawalDelay:
2424              allOf:
2425                - $ref: '#/components/schemas/EthBlockNum'
2426                - description: The time that anyone needs to wait until a withdrawal of the funds is allowed, in Ethereum blocks.
2427                - example: 539573849
2428            emergencyModeStartingTime:
2429              type: integer
2430              description: Ethereum block in which the emergency mode will be activated.
2431              example: 10
2432            emergencyMode:
2433              type: boolean
2434              description: Indicates if emergency mode has been activated.
2435              example: false
2436          additionalProperties: false
2437          require: 
2438            - hermezRollupAddress
2439            - hermezGovernanceDAOAddress
2440            - whiteHackGroupAddress
2441            - hermezKeeperAddress
2442            - withdrawalDelay
2443            - emergencyModeStartingTime
2444            - emergencyMode
2445        recommendedFee:
2446          $ref: '#/components/schemas/RecommendedFee'
2447      additionalProperties: false
2448      require: 
2449        - network
2450        - metrics
2451        - rollup
2452        - auction
2453        - withdrawalDelayer
2454        - recomendedFee 
2455    PaginationInfo:
2456      type: object
2457      description: Give pagination information
2458      properties:
2459        totalItems:
2460          type: integer
2461          description: Amount of items that the endpoint can return given the filters and the current state of the database.
2462          example: 2048
2463        firstItem:
2464          type: integer
2465          description: The smallest itemId that the endpoint will return with the given filters.
2466          example: 50
2467        lastItem:
2468          type: integer
2469          description: The greatest itemId that the endpoint will return with the given filters.
2470          example: 2130
2471    Config:
2472      type: object
2473      description: Configuration parameters of the different smart contracts that power the Hermez network.
2474      properties:
2475        hermez:
2476          type: object
2477          description: Constant configuration of the Hermez smart contract.
2478          properties:
2479            publicConstants:
2480              type: object
2481              description: Public Hermez smart contract constants
2482              properties: 
2483                tokenHEZ:
2484                  allOf:
2485                    - $ref: '#/components/schemas/EthereumAddress'
2486                    - description: Ethereum address of the HEZ token.
2487                    - example: "0x444dc4262BCDbf85190C01c996b4C06a461d2430"
2488                absoluteMaxL1L2BatchTimeout:
2489                  type: integer
2490                  description:  L1L2 Batch Timeout
2491                  example: 240
2492                verifiers:
2493                  type: array
2494                  description: List of verifiers struct
2495                  items:
2496                    type: object
2497                    properties:
2498                      maxTx:
2499                        type: integer
2500                        description: Maximum rollup transactions in a batch
2501                        example: 512
2502                      nlevels:
2503                        type: integer
2504                        description: Number of levels of the circuit
2505                        example: 32
2506                    required:
2507                      - maxTx
2508                      - nlevels
2509                    additionalProperties: false
2510                hermezAuctionContract:
2511                  allOf:
2512                    - $ref: '#/components/schemas/EthereumAddress'
2513                    - description: Ethereum address of the auction smart contract.
2514                    - example: "0x111dc4262BCDbf85190C01c996b4C06a461d2430"
2515                hermezGovernanceDAOAddress:
2516                  allOf:
2517                    - $ref: '#/components/schemas/EthereumAddress'
2518                    - description: Ethereum address of the governanceDAO.
2519                    - example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
2520                safetyAddress:
2521                  allOf:
2522                    - $ref: '#/components/schemas/EthereumAddress'
2523                    - description: Ethereum address of the safety.
2524                    - example: "0x333dc4262BCDbf85190C01c996b4C06a461d2430"
2525                withdrawDelayerContract:
2526                  allOf:
2527                    - $ref: '#/components/schemas/EthereumAddress'
2528                    - description: Ethereum address of the withdraw delayer contracts.
2529                    - example: "0x444dc4262BCDbf85190C01c996b4C06a461d2430"
2530              required:
2531                - tokenHEZ
2532                - absoluteMaxL1L2BatchTimeout
2533                - verifiers
2534                - hermezAuctionContract
2535                - hermezGovernanceDAOAddress
2536                - safetyAddress
2537                - withdrawDelayerContract
2538              additionalProperties: false
2539            maxFeeIdxCoordinator:
2540              type: integer
2541              description: is the maximum number of tokens the coordinator can use to collect fees.
2542              example: 64
2543            reservedIdx:
2544              type: integer
2545              description: First 256 indexes reserved, first user index will be the 256.
2546              example: 255
2547            exitIdx:
2548              type: integer
2549              description: Account index used to indicate that a transaction is an `exit` or `force exit`.
2550              example: 1
2551            limitLoadAmount:
2552              type: integer
2553              description: Maximum load amount (L1 to L2) allowed.
2554              example: 321
2555            limitL2TransferAmount:
2556              type: integer
2557              description: Maximum amount (L2 to L2) allowed.
2558              example: 837
2559            limitTokens:
2560              type: integer
2561              description: Maximum number of different tokens that can be registered in the network.
2562              example: 4294967295
2563            l1CoordinatorTotalBytes:
2564              type: integer
2565              description: Number of bytes that a L1 coordinator transaction has ([4 bytes] token + [32 bytes] babyjub + [65 bytes] compressedSignature).
2566              example: 101
2567            l1UserTotalBytes:
2568              type: integer
2569              description: Number of bytes that a L1 user transaction has ([20 bytes] fromEthAddr + [32 bytes] fromBjj-compressed + [6 bytes] fromIdx + [2 bytes] loadAmountFloat16 + [2 bytes] amountFloat16 + [4 bytes] tokenId + [6 bytes] toIdx).
2570              example: 72
2571            maxL1UserTx:
2572              type: integer
2573              description: Maximum L1-user transactions allowed to be queued in a batch.
2574              example: 128
2575            maxL1Tx:
2576              type: integer
2577              description: Maximum L1 transactions allowed to be queued in a batch.
2578              example: 256
2579            inputSHAConstantBytes:
2580              type: integer
2581              description: Input SHA constant bytes 
2582              example: 18542
2583            numBuckets:
2584              type: integer
2585              description: Number of buckets
2586              example: 5
2587            maxWithdrawalDelay:
2588              type: integer
2589              description: Maximum delay to withdraw tokens. Time is measured in seconds.
2590              example: 2 * 7 * 24 * 60 * 60
2591            exchangeMultiplier:
2592              type: integer
2593              description: exchange multiplier
2594              example: 1e14
2595          required:
2596            - publicConstants
2597            - reservedIdx
2598            - exitIdx
2599            - limitLoadAmount
2600            - limitL2TransferAmount
2601            - limitTokens
2602            - l1CoordinatorTotalBytes
2603            - l1UserTotalBytes
2604            - maxL1UserTx
2605            - maxL1Tx
2606            - inputSHAConstantBytes
2607            - numBuckets
2608            - maxWithdrawalDelay
2609            - exchangeMultiplier
2610          additionalProperties: false
2611        auction:
2612          type: object
2613          description: Constant configuration of the auction smart contract.
2614          properties:
2615            blocksPerSlot:
2616              type: integer
2617              description: Blocks per slot.
2618            initialMinimalBidding:
2619              type: integer
2620              description: Minimum bid when no one has bid yet.
2621            genesisBlockNum:
2622              allOf:
2623                - $ref: '#/components/schemas/EthBlockNum'
2624                - description: Ethereum block number in which the smart contract starts operating.
2625            tokenHEZ:
2626              allOf:
2627                - $ref: '#/components/schemas/EthereumAddress'
2628                - description: Ethereum address of the HEZ token.
2629                - example: "0x333dc4262BCDbf85190C01c996b4C06a461d2430"
2630            hermezRollup:
2631              allOf:
2632                - $ref: '#/components/schemas/EthereumAddress'
2633                - description: Ethereum address of the rollup smart contract.
2634                - example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
2635            governanceAddress:
2636              allOf:
2637                - $ref: '#/components/schemas/EthereumAddress'
2638                - description: Ethereum address of the governance.
2639                - example: "0x444dc4262BCDbf85190C01c996b4C06a461d2430"
2640          required:
2641            - blocksPerSlot
2642            - initialMinimalBidding
2643            - genesisBlockNum
2644            - tokenHEZ
2645            - hermezRollup
2646            - governanceAddress
2647          additionalProperties: false
2648        withdrawalDelayer:
2649          type: object
2650          description: Constant configuration of the withdrawal delayer smart contract.
2651          properties:
2652            maxWithdrawalDelay:
2653              type: integer
2654              description: Maximum time delay in which the tokens can be locked in the contract. Time is measured in Ethereum blocks.
2655              example: 200
2656            maxEmergencyModeTime:
2657              type: integer
2658              description: Maximum amount of time in which the contract can be in emergency mode. Time is measured in Ethereum blocks.
2659              example: 2000
2660            hermezRollup:
2661              allOf:
2662                - $ref: '#/components/schemas/EthereumAddress'
2663                - description: Ethereum address of the rollup smart contract.
2664                - example: "0x222dc4262BCDbf85190C01c996b4C06a461d2430"
2665          required:
2666            - maxWithdrawalDelay
2667            - maxEmergencyModeTime
2668            - hermezRollup
2669          additionalProperties: false
2670      required:
2671        - hermez
2672        - auction
2673        - withdrawalDelayer
2674      additionalProperties: false
2675    Error:
2676      type: object
2677      description: Error response. 
2678      properties:
2679        message:
2680          type: string
2681    Error400:
2682      allOf:
2683        - $ref: '#/components/schemas/Error'
2684        - example:
2685            message: Invalid signature.
2686    Error404:
2687      allOf:
2688        - $ref: '#/components/schemas/Error'
2689        - example:
2690            message: Item(s) not found.
2691    Error500:
2692      allOf:
2693        - $ref: '#/components/schemas/Error'
2694        - example:
2695            message: Database error.