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.

3125 lines
110 KiB

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