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.

2769 lines
96 KiB

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