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.

3114 lines
108 KiB

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