You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2695 lines
94 KiB

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