├── .codecov.yml ├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .github ├── stale.yml ├── sync-script │ └── sync-script.sh └── workflows │ ├── benchmark.yml │ ├── codeql-analysis.yml │ ├── devnet-sync.yml │ ├── e2e.yml │ ├── functional.yml │ ├── integration.yml │ ├── lint.yml │ ├── mainnet-sync.yml │ ├── publish-develop.yml │ ├── publish-master.yml │ └── unit.yml ├── .gitignore ├── .lintstagedrc.json ├── .nvmrc ├── .prettierignore ├── .prettierrc ├── .yarnrc ├── CHANGELOG-2.X.md ├── CHANGELOG.md ├── CODEOWNERS ├── LICENSE ├── README.md ├── __mocks__ ├── better-sqlite3.js └── execa.js ├── __tests__ ├── e2e │ ├── README.md │ ├── img │ │ └── core-e2e-banner.png │ └── lib │ │ └── config │ │ ├── docker-compose.yml │ │ ├── nginx │ │ └── nginx.conf │ │ ├── nodes │ │ ├── Dockerfile │ │ ├── core0 │ │ │ ├── .env │ │ │ ├── app.json │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── core1 │ │ │ ├── .env │ │ │ ├── app.json │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── core2 │ │ │ ├── .env │ │ │ ├── app.json │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── core3 │ │ │ ├── .env │ │ │ ├── app.json │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ └── core4 │ │ │ ├── .env │ │ │ ├── app.json │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ └── peer-discovery │ │ ├── Dockerfile │ │ ├── index.js │ │ └── package.json ├── functional │ ├── .gitkeep │ ├── core-database │ │ ├── __support__ │ │ │ └── index.ts │ │ ├── migrations.test.ts │ │ └── repositories │ │ │ ├── block-repository.test.ts │ │ │ ├── round-repository.test.ts │ │ │ └── transaction-repository.test.ts │ └── transaction-forging │ │ ├── __support__ │ │ └── index.ts │ │ ├── bridgechain-registration.test.ts │ │ ├── bridgechain-resignation.test.ts │ │ ├── bridgechain-update.test.ts │ │ ├── business-registration.test.ts │ │ ├── business-resignation.test.ts │ │ ├── business-update.test.ts │ │ ├── delegate-registration.test.ts │ │ ├── delegate-resignation.test.ts │ │ ├── entity-register.test.ts │ │ ├── entity-resign.test.ts │ │ ├── entity-update.test.ts │ │ ├── htlc-claim.test.ts │ │ ├── htlc-lock.test.ts │ │ ├── htlc-refund.test.ts │ │ ├── ipfs.test.ts │ │ ├── multi-payment.test.ts │ │ ├── multi-signature-registration.test.ts │ │ ├── second-signature-registration.test.ts │ │ ├── transfer.test.ts │ │ └── vote.test.ts ├── integration │ ├── .gitkeep │ ├── core-api │ │ ├── __support__ │ │ │ └── setup.ts │ │ ├── api.test.ts │ │ ├── controllers │ │ │ ├── delegates.test.ts │ │ │ ├── locks.test.ts │ │ │ └── wallets.test.ts │ │ ├── handlers │ │ │ ├── blockchain.test.ts │ │ │ ├── blocks.test.ts │ │ │ ├── delegates.test.ts │ │ │ ├── locks.test.ts │ │ │ ├── node.test.ts │ │ │ ├── peers.test.ts │ │ │ ├── rounds.test.ts │ │ │ ├── transactions.test.ts │ │ │ ├── votes.test.ts │ │ │ └── wallets.test.ts │ │ ├── plugins │ │ │ └── rate-limit.test.ts │ │ └── services │ │ │ ├── __support__ │ │ │ └── setup.ts │ │ │ ├── delegate-search-service.test.ts │ │ │ ├── lock-search-service.test.ts │ │ │ └── wallet-search-service.test.ts │ ├── core-magistrate-api │ │ ├── __support__ │ │ │ ├── set-indexes.ts │ │ │ └── setup.ts │ │ ├── controllers │ │ │ └── entities.test.ts │ │ └── services │ │ │ ├── __support__ │ │ │ └── setup.ts │ │ │ └── entity-search-service.test.ts │ ├── core-state │ │ ├── __support__ │ │ │ ├── setup.ts │ │ │ └── utils.ts │ │ └── block-state │ │ │ ├── lock-then-claim.test.ts │ │ │ ├── lock-then-refund.test.ts │ │ │ ├── multi-payment.test.ts │ │ │ ├── transfer.test.ts │ │ │ ├── unvote-by-forger-then-vote-by-forger.test.ts │ │ │ ├── unvote-by-forger-vote-by-forger-twice.test.ts │ │ │ ├── unvote-then-vote-unvote.test.ts │ │ │ ├── unvote-then-vote.test.ts │ │ │ ├── unvote-vote-by-forger.test.ts │ │ │ └── unvote-vote.test.ts │ └── core-test-framework │ │ └── utils │ │ ├── __support__ │ │ ├── echo-controller.ts │ │ └── setup.ts │ │ ├── api-http-client.test.ts │ │ └── api-inject-client.test.ts └── unit │ ├── core-api │ ├── __fixtures__ │ │ ├── key.pem │ │ └── server.crt │ ├── __support__ │ │ ├── app.ts │ │ ├── index.ts │ │ └── server.ts │ ├── controllers │ │ ├── blockchain.test.ts │ │ ├── blocks.test.ts │ │ ├── controller.test.ts │ │ ├── delegates.test.ts │ │ ├── locks.test.ts │ │ ├── node.test.ts │ │ ├── peers.test.ts │ │ ├── rounds.test.ts │ │ ├── transactions.test.ts │ │ ├── votes.test.ts │ │ └── wallets.test.ts │ ├── plugins │ │ ├── cache.test.ts │ │ ├── comma-array-query.test.ts │ │ ├── dot-separated-query.test.ts │ │ ├── hapi-ajv.test.ts │ │ ├── log.test.ts │ │ ├── pagination.test.ts │ │ ├── rate-limit.test.ts │ │ ├── response-headers.test.ts │ │ ├── semaphore.test.ts │ │ └── whitelist.test.ts │ ├── resources-new │ │ └── wallet.test.ts │ ├── resources │ │ ├── block-with-transactions.test.ts │ │ ├── block.test.ts │ │ ├── fee-statistics.test.ts │ │ ├── peer.test.ts │ │ ├── ports.test.ts │ │ ├── round.test.ts │ │ ├── transaction-with-blocks.test.ts │ │ └── transaction.test.ts │ ├── routes │ │ ├── __fixtures__ │ │ │ ├── index.ts │ │ │ ├── results.ts │ │ │ └── server-defaults.ts │ │ ├── blockchain.test.ts │ │ ├── blocks.test.ts │ │ ├── delegates.test.ts │ │ ├── locks.test.ts │ │ ├── node.test.ts │ │ ├── peers.test.ts │ │ ├── rounds.test.ts │ │ ├── transactions.test.ts │ │ ├── votes.test.ts │ │ └── wallets.test.ts │ ├── schemas.test.ts │ ├── server.test.ts │ ├── service-provider.test.ts │ ├── services │ │ ├── __fixtures__ │ │ │ ├── delegates.ts │ │ │ ├── index.ts │ │ │ └── locks.ts │ │ ├── delegate-search-service.test.ts │ │ ├── lock-search-service.test.ts │ │ └── wallet-search-service.test.ts │ └── utils │ │ └── get-ip.test.ts │ ├── core-blockchain │ ├── __fixtures__ │ │ ├── blocks.ts │ │ └── index.ts │ ├── actions │ │ └── process-block.test.ts │ ├── blockchain.test.ts │ ├── process-blocks-job.test.ts │ ├── processor │ │ ├── block-processor.test.ts │ │ └── handlers │ │ │ ├── accept-block-handler.test.ts │ │ │ ├── already-forged-handler.test.ts │ │ │ ├── exception-handler.test.ts │ │ │ ├── incompatible-transactions-handler.test.ts │ │ │ ├── invalid-generator-handler.test.ts │ │ │ ├── nonce-out-of-order-handler.test.ts │ │ │ ├── revert-block-handler.test.ts │ │ │ ├── unchained-handler.test.ts │ │ │ └── verification-failed-handler.test.ts │ ├── service-provider.test.ts │ └── state-machine │ │ ├── actions │ │ ├── blockchain-ready.test.ts │ │ ├── check-last-block-synced.test.ts │ │ ├── check-last-downloaded-block-synced.test.ts │ │ ├── check-later.test.ts │ │ ├── download-blocks.test.ts │ │ ├── download-finished.test.ts │ │ ├── download-paused.test.ts │ │ ├── exit-app.test.ts │ │ ├── initialize.test.ts │ │ ├── rollback-database.test.ts │ │ ├── start-fork-recovery.test.ts │ │ ├── stopped.test.ts │ │ └── syncing-complete.test.ts │ │ └── state-machine.test.ts │ ├── core-cli │ ├── action-factory.test.ts │ ├── actions │ │ ├── abort-errored-process.test.ts │ │ ├── abort-missing-process.test.ts │ │ ├── abort-running-process.test.ts │ │ ├── abort-stopped-process.test.ts │ │ ├── abort-unknown-process.test.ts │ │ ├── daemonize-process.test.ts │ │ ├── restart-process.test.ts │ │ ├── restart-running-process-with-prompt.test.ts │ │ └── restart-running-process.test.ts │ ├── application-factory.test.ts │ ├── application.test.ts │ ├── commands │ │ ├── __stubs__ │ │ │ ├── command-without-definition.ts │ │ │ └── command.ts │ │ ├── command-help.test.ts │ │ ├── command.test.ts │ │ ├── discover-commands.test.ts │ │ ├── discover-config.test.ts │ │ ├── discover-network.test.ts │ │ └── dist │ │ │ ├── hidden.js │ │ │ ├── index.js │ │ │ └── visible.js │ ├── component-factory.test.ts │ ├── components │ │ ├── app-header.test.ts │ │ ├── ask-date.test.ts │ │ ├── ask-hidden.test.ts │ │ ├── ask-number.test.ts │ │ ├── ask-password.test.ts │ │ ├── ask.test.ts │ │ ├── auto-complete.test.ts │ │ ├── box.test.ts │ │ ├── clear.test.ts │ │ ├── confirm.test.ts │ │ ├── error.test.ts │ │ ├── fatal.test.ts │ │ ├── info.test.ts │ │ ├── listing.test.ts │ │ ├── log.test.ts │ │ ├── multi-select.test.ts │ │ ├── new-line.test.ts │ │ ├── prompt.test.ts │ │ ├── select.test.ts │ │ ├── spinner.test.ts │ │ ├── success.test.ts │ │ ├── table.test.ts │ │ ├── task-list.test.ts │ │ ├── title.test.ts │ │ ├── toggle.test.ts │ │ └── warning.test.ts │ ├── input │ │ ├── definition.test.ts │ │ ├── input.test.ts │ │ ├── parser.test.ts │ │ └── validator.test.ts │ ├── output │ │ └── output.test.ts │ ├── plugins │ │ └── suggest.test.ts │ ├── services │ │ ├── __fixtures__ │ │ │ ├── app.js │ │ │ └── latest-version.ts │ │ ├── config.test.ts │ │ ├── environment.test.ts │ │ ├── installer.test.ts │ │ ├── logger.test.ts │ │ ├── plugin-manager.test.ts │ │ ├── plugins │ │ │ ├── @namespace │ │ │ │ └── package2 │ │ │ │ │ └── package.json │ │ │ └── package1 │ │ │ │ └── package.json │ │ ├── process-manager.test.ts │ │ ├── source-providers │ │ │ ├── file.test.ts │ │ │ ├── git.test.ts │ │ │ ├── invalid-utils-0.9.1.tgz │ │ │ ├── missing-utils-0.9.1.tgz │ │ │ ├── npm.test.ts │ │ │ └── utils-0.9.1.tgz │ │ └── updater.test.ts │ └── utils │ │ ├── __fixtures__ │ │ ├── app.js │ │ └── latest-version.ts │ │ ├── builder.test.ts │ │ ├── flags.test.ts │ │ ├── process.test.ts │ │ ├── update.ts │ │ └── update │ │ └── check-for-updates.ts │ ├── core-database │ ├── __fixtures__ │ │ └── block1760000.ts │ ├── block-filter.test.ts │ ├── block-history-service.test.ts │ ├── database-service.test.ts │ ├── model-converter.test.ts │ ├── service-provider.test.ts │ ├── transaction-filter.test.ts │ ├── transaction-history-service.test.ts │ └── utils │ │ ├── query-helper.test.ts │ │ ├── snake-naming-strategy.test.ts │ │ └── transform.test.ts │ ├── core-forger │ ├── __utils__ │ │ ├── calculate-active-delegates.ts │ │ └── create-block-with-transactions.ts │ ├── client.test.ts │ ├── delegate-factory.test.ts │ ├── delegate-tracker.test.ts │ ├── errors.test.ts │ ├── forger-service.test.ts │ ├── methods │ │ ├── bip38.test.ts │ │ └── bip39.test.ts │ ├── mocks │ │ └── nes.ts │ ├── process-actions │ │ ├── current-delegate.test.ts │ │ ├── last-forged-block.test.ts │ │ └── next-slot.test.ts │ ├── service-provider.test.ts │ └── setup.ts │ ├── core-kernel │ ├── __stubs__ │ │ ├── config-empty │ │ │ └── .gitkeep │ │ ├── config-invalid-app │ │ │ ├── .env │ │ │ ├── app.js │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── config-invalid-delegates │ │ │ ├── .env │ │ │ ├── app.js │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── config-invalid-peers │ │ │ ├── .env │ │ │ ├── app.js │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── config-with-crypto │ │ │ ├── .env │ │ │ ├── app.js │ │ │ ├── crypto │ │ │ │ ├── exceptions.json │ │ │ │ ├── genesisBlock.json │ │ │ │ ├── milestones.json │ │ │ │ └── network.json │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── config │ │ │ ├── .env │ │ │ ├── app.js │ │ │ ├── delegates.json │ │ │ └── peers.json │ │ ├── stub-plugin-with-defaults │ │ │ ├── dist │ │ │ │ ├── defaults.js │ │ │ │ ├── index.js │ │ │ │ └── service-provider.js │ │ │ └── package.json │ │ └── stub-plugin │ │ │ ├── dist │ │ │ ├── index.js │ │ │ └── service-provider.js │ │ │ └── package.json │ ├── application.test.ts │ ├── bootstrap │ │ ├── app │ │ │ ├── load-cryptography.test.ts │ │ │ ├── load-service-providers.test.ts │ │ │ └── watch-configuration.test.ts │ │ └── service-providers │ │ │ ├── __stubs__ │ │ │ └── service-providers.ts │ │ │ ├── boot-service-providers.test.ts │ │ │ └── register-service-providers.test.ts │ ├── container.test.ts │ ├── ioc │ │ ├── decorator.test.ts │ │ └── selectors.test.ts │ ├── providers │ │ ├── plugin-configuration.test.ts │ │ ├── plugin-manifest.test.ts │ │ ├── service-provider-repository.test.ts │ │ └── service-provider.test.ts │ ├── services │ │ ├── attributes │ │ │ ├── attribute-map.test.ts │ │ │ └── attribute-set.test.ts │ │ ├── cache │ │ │ ├── drivers │ │ │ │ ├── memory.test.ts │ │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ │ ├── config │ │ │ ├── drivers │ │ │ │ └── local.test.ts │ │ │ ├── repository.test.ts │ │ │ └── watcher.test.ts │ │ ├── events │ │ │ ├── drivers │ │ │ │ ├── memory.test.ts │ │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ │ ├── filesystem │ │ │ ├── drivers │ │ │ │ ├── local.test.ts │ │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ │ ├── log │ │ │ ├── drivers │ │ │ │ ├── memory.test.ts │ │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ │ ├── mixins │ │ │ ├── mixins.test.ts │ │ │ └── service-provider.test.ts │ │ ├── pipeline │ │ │ ├── drivers │ │ │ │ ├── memory.test.ts │ │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ │ ├── process-actions │ │ │ ├── drivers │ │ │ │ └── pm2.test.ts │ │ │ └── service-provider.test.ts │ │ ├── queue │ │ │ ├── drivers │ │ │ │ ├── memory.test.ts │ │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ │ ├── schedule │ │ │ ├── block-job.test.ts │ │ │ ├── cron-job.test.ts │ │ │ ├── schedule.test.ts │ │ │ └── service-provider.test.ts │ │ ├── search │ │ │ ├── errors.test.ts │ │ │ ├── pagination-service.test.ts │ │ │ └── standard-criteria-service.test.ts │ │ ├── triggers │ │ │ ├── service-provider.test.ts │ │ │ └── triggers.test.ts │ │ └── validation │ │ │ ├── drivers │ │ │ ├── joi.test.ts │ │ │ └── null.test.ts │ │ │ └── service-provider.test.ts │ ├── support │ │ ├── class-manager.test.ts │ │ └── instance-manager.test.ts │ └── utils │ │ ├── assert.test.ts │ │ ├── calculate-forging-info.test.ts │ │ ├── delegate-calculator.test.ts │ │ ├── expiration-calculator.test.ts │ │ ├── format-timestamp.test.ts │ │ ├── get-blocktime-lookup.test.ts │ │ ├── ip-address.test.ts │ │ ├── ipc-handler.test.ts │ │ ├── ipc-subprocess.test.ts │ │ ├── is-blacklisted.test.ts │ │ ├── is-blocked-chained.test.ts │ │ ├── is-whitelisted.test.ts │ │ ├── lock.test.ts │ │ ├── round-calculator │ │ ├── calculate-round.test.ts │ │ └── is-new-round.test.ts │ │ ├── search.test.ts │ │ └── supply-calculator.test.ts │ ├── core-logger-pino │ ├── driver.test.ts │ └── service-provider.test.ts │ ├── core-magistrate-api │ ├── __support__ │ │ └── index.ts │ ├── controllers │ │ └── entities.test.ts │ └── service-provider.test.ts │ ├── core-magistrate-crypto │ ├── builders │ │ ├── bridgechain-registration.test.ts │ │ ├── bridgechain-resignation.test.ts │ │ ├── bridgechain-update.test.ts │ │ ├── business-registration.test.ts │ │ ├── business-resignation.test.ts │ │ ├── business-update.test.ts │ │ └── enity.test.ts │ ├── fixtures │ │ └── entity │ │ │ ├── assets │ │ │ └── generate.ts │ │ │ └── schemas │ │ │ ├── register.ts │ │ │ ├── resign.ts │ │ │ ├── update.ts │ │ │ └── utils.ts │ ├── helper.ts │ └── transactions │ │ ├── bridgechain-registration.test.ts │ │ ├── bridgechain-resignation.test.ts │ │ ├── bridgechain-update.test.ts │ │ ├── business-registration.test.ts │ │ ├── business-resgination.test.ts │ │ ├── business-update.test.ts │ │ └── entity.test.ts │ ├── core-magistrate-transactions │ ├── __support__ │ │ └── app.ts │ ├── handlers │ │ ├── __fixtures__ │ │ │ ├── assets.ts │ │ │ ├── entity │ │ │ │ ├── index.ts │ │ │ │ ├── register.ts │ │ │ │ ├── resign.ts │ │ │ │ └── update.ts │ │ │ └── index.ts │ │ ├── __mocks__ │ │ │ ├── transaction-error.ts │ │ │ ├── transaction-handler.ts │ │ │ ├── transaction-reader.ts │ │ │ └── wallet-repository.ts │ │ ├── bridgechain-registration.test.ts │ │ ├── bridgechain-resignation.test.ts │ │ ├── bridgechain-update.test.ts │ │ ├── business-registration.test.ts │ │ ├── business-resignation.test.ts │ │ ├── business-update.test.ts │ │ ├── entity.test.ts │ │ └── general.test.ts │ └── service-provider.test.ts │ ├── core-p2p │ ├── actions │ │ └── validate-and-accept-peer.test.ts │ ├── chunk-cache.test.ts │ ├── event-listener.test.ts │ ├── fixtures │ │ └── peers.json │ ├── hapi-nes │ │ ├── client.test.ts │ │ ├── listener.test.ts │ │ ├── plugin.test.ts │ │ └── socket.test.ts │ ├── listeners.test.ts │ ├── mocks │ │ ├── hapi.ts │ │ └── nes.ts │ ├── network-monitor.test.ts │ ├── network-state.test.ts │ ├── peer-communicator.test.ts │ ├── peer-connector.test.ts │ ├── peer-processor.test.ts │ ├── peer-repository.test.ts │ ├── peer-verifier.test.ts │ ├── peer.test.ts │ ├── rate-limiter.test.ts │ ├── service-provider.test.ts │ ├── socket-server │ │ ├── codecs │ │ │ └── transactions.test.ts │ │ ├── controllers │ │ │ ├── blocks.test.ts │ │ │ ├── internal.test.ts │ │ │ ├── peer.test.ts │ │ │ └── transactions.test.ts │ │ ├── plugins │ │ │ ├── accept-peer.test.ts │ │ │ ├── await-block.test.ts │ │ │ ├── is-app-ready.test.ts │ │ │ ├── rate-limit.test.ts │ │ │ ├── validate.test.ts │ │ │ └── whitelist-forger.test.ts │ │ ├── routes │ │ │ ├── blocks.test.ts │ │ │ ├── internal.test.ts │ │ │ ├── peer.test.ts │ │ │ └── transactions.test.ts │ │ ├── server.test.ts │ │ └── utils │ │ │ ├── get-headers.test.ts │ │ │ ├── get-peer-config.test.ts │ │ │ ├── map-addr.test.ts │ │ │ └── validate.test.ts │ ├── transaction-broadcaster.test.ts │ └── utils │ │ ├── build-rate-limiter.test.ts │ │ ├── check-dns.test.ts │ │ ├── check-ntp.test.ts │ │ └── is-valid-version.test.ts │ ├── core-snapshots │ ├── __fixtures__ │ │ ├── 1-52 │ │ │ ├── blocks │ │ │ ├── meta.json │ │ │ ├── rounds │ │ │ └── transactions │ │ ├── assets.ts │ │ └── index.ts │ ├── codecs │ │ ├── codec.test.ts │ │ └── json-codec.test.ts │ ├── database-service.test.ts │ ├── filesystem │ │ ├── filesystem.test.ts │ │ └── stream-reader-writer.test.ts │ ├── progress-dispatcher.test.ts │ ├── progress-renderer.test.ts │ ├── repositories │ │ ├── block-repository.test.ts │ │ ├── round-repository.test.ts │ │ └── transaction-repository.test.ts │ ├── service-provider.test.ts │ ├── snapshot-service.test.ts │ ├── verifier.test.ts │ └── workers │ │ ├── actions │ │ ├── __support__ │ │ │ ├── helper.ts │ │ │ └── index.ts │ │ ├── test-worker-action.test.ts │ │ └── worker-action.test.ts │ │ ├── read-processor.test.ts │ │ ├── worker-thread.test.ts │ │ ├── worker-wrapper.test.ts │ │ └── worker.test.ts │ ├── core-state │ ├── __fixtures__ │ │ └── block1760000.ts │ ├── __utils__ │ │ ├── build-delegate-and-vote-balances.ts │ │ ├── compact.ts │ │ ├── fixture-generator.ts │ │ ├── make-chained-block.ts │ │ ├── make-vote-transactions.ts │ │ ├── transactions.ts │ │ └── unique.ts │ ├── block-state.test.ts │ ├── database-interactions.test.ts │ ├── database-interceptor.test.ts │ ├── dpos │ │ ├── dpos-previous-round.test.ts │ │ └── dpos.test.ts │ ├── round-state.test.ts │ ├── service-provider.test.ts │ ├── setup.ts │ ├── state-builder.test.ts │ ├── stores │ │ ├── blocks.test.ts │ │ ├── state.test.ts │ │ └── transactions.test.ts │ ├── transaction-validator.test.ts │ └── wallets │ │ ├── errors.test.ts │ │ ├── wallet-index.test.ts │ │ ├── wallet-repository-clone.test.ts │ │ ├── wallet-repository-copy-on-write.test.ts │ │ ├── wallet-repository.test.ts │ │ └── wallet.test.ts │ ├── core-test-framework │ ├── app │ │ ├── generators │ │ │ ├── __fixtures__ │ │ │ │ └── assets.ts │ │ │ ├── core.test.ts │ │ │ └── crypto.test.ts │ │ └── sandbox.test.ts │ ├── cli │ │ └── console.test.ts │ ├── factories │ │ ├── factories │ │ │ ├── block.test.ts │ │ │ ├── identity.test.ts │ │ │ ├── peer.test.ts │ │ │ ├── round.test.ts │ │ │ ├── transaction.test.ts │ │ │ └── wallet.test.ts │ │ ├── factory-builder.test.ts │ │ └── helpers.test.ts │ ├── internal │ │ ├── delegates.test.ts │ │ └── signer.test.ts │ ├── matchers │ │ ├── api │ │ │ ├── block.test.ts │ │ │ ├── peer.test.ts │ │ │ ├── response.test.ts │ │ │ └── transaction.test.ts │ │ ├── blockchain │ │ │ ├── __fixtures__ │ │ │ │ └── assets.ts │ │ │ ├── dispatch.test.ts │ │ │ ├── execute-on-entry.test.ts │ │ │ └── transition.test.ts │ │ ├── fields │ │ │ ├── address.test.ts │ │ │ └── public-key.test.ts │ │ ├── functional │ │ │ ├── accepted.test.ts │ │ │ ├── entity.test.ts │ │ │ ├── forged.test.ts │ │ │ ├── rejected.test.ts │ │ │ ├── unconfirmed.test.ts │ │ │ └── vote-balance.test.ts │ │ ├── models │ │ │ ├── delegate.test.ts │ │ │ ├── transaction.test.ts │ │ │ └── wallet.test.ts │ │ └── transactions │ │ │ ├── types │ │ │ ├── delegate-registration.test.ts │ │ │ ├── delegate-resignation.test.ts │ │ │ ├── ipfs.test.ts │ │ │ ├── multi-payment.test.ts │ │ │ ├── multi-signature.test.ts │ │ │ ├── second-signature.test.ts │ │ │ ├── transfer.test.ts │ │ │ └── vote.test.ts │ │ │ ├── valid-second-signature.test.ts │ │ │ └── valid.test.ts │ ├── mocks │ │ ├── block-repository.test.ts │ │ ├── blockchain.test.ts │ │ ├── network-monitor.test.ts │ │ ├── peer-repository.test.ts │ │ ├── query.test.ts │ │ ├── round-repository.test.ts │ │ ├── service-provider-repository.test.ts │ │ ├── state-store.test.ts │ │ ├── transaction-pool-processor.test.ts │ │ ├── transaction-repository.test.ts │ │ └── wallet-repository.test.ts │ └── utils │ │ ├── __fixtures__ │ │ └── assets.ts │ │ ├── api-http-client.test.ts │ │ ├── api-inject-client.test.ts │ │ ├── api.test.ts │ │ ├── generic.test.ts │ │ ├── mapper.test.ts │ │ ├── rest-client.test.ts │ │ └── transaction-factory.test.ts │ ├── core-transaction-pool │ ├── collator.test.ts │ ├── dynamic-fee-matcher.test.ts │ ├── errors.test.ts │ ├── expiration-service.test.ts │ ├── mempool-index-registry.test.ts │ ├── mempool-index.test.ts │ ├── mempool.test.ts │ ├── processor-dynamic-fee-extension.test.ts │ ├── processor.test.ts │ ├── query.test.ts │ ├── sender-mempool.test.ts │ ├── sender-state.test.ts │ ├── service-provider.test.ts │ ├── service.test.ts │ ├── storage.test.ts │ ├── utils.test.ts │ ├── worker-pool.test.ts │ ├── worker-script-handler.test.ts │ ├── worker-script.test.ts │ └── worker.test.ts │ ├── core-transactions │ ├── handlers │ │ ├── __fixtures__ │ │ │ └── htlc-secrets.ts │ │ ├── __support__ │ │ │ └── app.ts │ │ ├── handler-registry.test.ts │ │ ├── one │ │ │ ├── delegate-registration.test.ts │ │ │ ├── multi-signature-registration.test.ts │ │ │ ├── second-signature-registration.test.ts │ │ │ ├── transafer.test.ts │ │ │ └── vote.test.ts │ │ └── two │ │ │ ├── delegate-registration.test.ts │ │ │ ├── delegate-resignation.test.ts │ │ │ ├── htlc-claim.test.ts │ │ │ ├── htlc-lock.test.ts │ │ │ ├── htlc-refund.test.ts │ │ │ ├── ipfs.test.ts │ │ │ ├── multi-payment.test.ts │ │ │ ├── multi-signature-registration.test.ts │ │ │ ├── second-signature-registration.test.ts │ │ │ ├── transaction.test.ts │ │ │ ├── transfer.test.ts │ │ │ └── vote.test.ts │ ├── service-provider.test.ts │ └── verification │ │ ├── multi-signature-verification-memoized.test.ts │ │ ├── multi-signature-verification.test.ts │ │ ├── second-signature-verification-memoized.test.ts │ │ └── second-signature-verification.test.ts │ ├── core-webhooks │ ├── __fixtures__ │ │ └── assets.ts │ ├── conditions.test.ts │ ├── database.test.ts │ ├── listener.test.ts │ ├── server │ │ ├── __support__ │ │ │ └── index.ts │ │ ├── plugins │ │ │ └── whitelist.test.ts │ │ ├── server.test.ts │ │ └── utils.test.ts │ └── service-provider.test.ts │ ├── core │ ├── __support__ │ │ └── app.ts │ ├── cli.test.ts │ ├── commands │ │ ├── config-cli.test.ts │ │ ├── config-database.test.ts │ │ ├── config-forger-bip38.test.ts │ │ ├── config-forger-bip39.test.ts │ │ ├── config-forger.test.ts │ │ ├── config-publish.test.ts │ │ ├── core-log.test.ts │ │ ├── core-restart.test.ts │ │ ├── core-run.test.ts │ │ ├── core-start.test.ts │ │ ├── core-status.test.ts │ │ ├── core-stop.test.ts │ │ ├── env-get.test.ts │ │ ├── env-list.test.ts │ │ ├── env-paths.test.ts │ │ ├── env-set.test.ts │ │ ├── forger-log.test.ts │ │ ├── forger-restart.test.ts │ │ ├── forger-run.test.ts │ │ ├── forger-start.test.ts │ │ ├── forger-status.test.ts │ │ ├── forger-stop.test.ts │ │ ├── help.test.ts │ │ ├── network-generate.test.ts │ │ ├── plugin-install.test.ts │ │ ├── plugin-remove.test.ts │ │ ├── plugin-update.test.ts │ │ ├── pool-clear.test.ts │ │ ├── reinstall.test.ts │ │ ├── relay-log.test.ts │ │ ├── relay-restart.test.ts │ │ ├── relay-run.test.ts │ │ ├── relay-share.test.ts │ │ ├── relay-start.test.ts │ │ ├── relay-status.test.ts │ │ ├── relay-stop.test.ts │ │ ├── snapshot-dump.test.ts │ │ ├── snapshot-restore.test.ts │ │ ├── snapshot-rollback.test.ts │ │ ├── snapshot-truncate.test.ts │ │ ├── snapshot-verify.test.ts │ │ ├── top.test.ts │ │ ├── uninstall.test.ts │ │ ├── update.test.ts │ │ └── version.test.ts │ ├── config.json │ └── internal │ │ ├── __fixtures__ │ │ ├── app.js │ │ └── latest-version.ts │ │ └── crypto.test.ts │ └── crypto │ ├── blocks │ ├── __fixtures__ │ │ ├── transaction.ts │ │ └── wallet.ts │ ├── block.test.ts │ ├── deserializer.test.ts │ └── factory.test.ts │ ├── constants.test.ts │ ├── crypto │ ├── bip38.test.ts │ ├── fixtures │ │ ├── bip38.json │ │ └── crypto.json │ ├── hash-algorithms.test.ts │ ├── hash.test.ts │ ├── hdwallet.test.ts │ ├── message.test.ts │ └── slots.test.ts │ ├── enums.test.ts │ ├── fixtures │ ├── block.ts │ ├── multi-transaction.ts │ └── transaction.ts │ ├── identities │ ├── address.test.ts │ ├── fixture.json │ ├── keys.test.ts │ ├── private-key.test.ts │ ├── public-key.test.ts │ └── wif.test.ts │ ├── managers │ ├── config.test.ts │ └── network.test.ts │ ├── transactions │ ├── __fixtures__ │ │ ├── htlc.ts │ │ ├── transaction.ts │ │ └── wallet.ts │ ├── __support__ │ │ └── index.ts │ ├── builders │ │ ├── builder-factory.test.ts │ │ └── transactions │ │ │ ├── delegate-registration.test.ts │ │ │ ├── delegate-resignation.test.ts │ │ │ ├── htlc-claim.test.ts │ │ │ ├── htlc-lock.test.ts │ │ │ ├── htlc-refund.test.ts │ │ │ ├── ipfs.test.ts │ │ │ ├── multi-payment.test.ts │ │ │ ├── multi-signature.test.ts │ │ │ ├── second-signature.test.ts │ │ │ ├── transaction-builder.test.ts │ │ │ ├── transfer.test.ts │ │ │ └── vote.test.ts │ ├── deserializer.test.ts │ ├── factory.test.ts │ ├── schemas.test.ts │ ├── serde.test.ts │ ├── signer.test.ts │ ├── transaction.test.ts │ ├── utils.test.ts │ └── verifier.test.ts │ ├── utils │ ├── base58.test.ts │ ├── block-time-calculator.test.ts │ ├── byte-buffer.test.ts │ ├── fixtures │ │ └── block-time-milestones.json │ ├── format-satoshi.test.ts │ ├── is-exception.test.ts │ ├── is-valid-peer.test.ts │ ├── message.test.ts │ ├── network-list.ts │ └── number-to-hex.test.ts │ └── validation │ ├── formats.test.ts │ ├── keywords.test.ts │ └── validator.test.ts ├── banner.png ├── benchmark ├── block │ ├── create.js │ ├── deserialize │ │ ├── 0.js │ │ ├── 150.js │ │ └── methods.js │ ├── serialize.js │ └── serializeWithTransactions.js ├── crypto │ └── hash-algorithms.js ├── fixtures │ ├── block │ │ ├── deserialized │ │ │ ├── multipayments-150.json │ │ │ ├── multipayments-1MB.json │ │ │ ├── multipayments-500.json │ │ │ ├── no-transactions.json │ │ │ └── transactions.json │ │ └── serialized │ │ │ ├── no-transactions.txt │ │ │ └── transactions.txt │ └── transaction │ │ ├── deserialized │ │ └── 0.json │ │ └── serialized │ │ └── 0.txt ├── helpers.js ├── index.js └── transaction │ ├── create │ └── 0.js │ ├── deserialize │ ├── 0.js │ └── methods.js │ └── serialize │ └── 0.js ├── commitlint.config.js ├── docker └── production │ ├── Dockerfile │ ├── LICENSE │ ├── README.md │ ├── ark-core-docker.png │ ├── devnet │ ├── devnet.env │ ├── docker-compose-build.yml │ ├── docker-compose.yml │ ├── enc.sh │ └── purge_all.sh │ ├── entrypoint.sh │ ├── mainnet │ ├── docker-compose-build.yml │ ├── docker-compose.yml │ ├── enc.sh │ ├── mainnet.env │ └── purge_all.sh │ └── purge_all.sh ├── install-next.sh ├── install.sh ├── jest.config.js ├── lerna.json ├── package.json ├── packages ├── core-api │ ├── package.json │ ├── src │ │ ├── controllers │ │ │ ├── blockchain.ts │ │ │ ├── blocks.ts │ │ │ ├── controller.ts │ │ │ ├── delegates.ts │ │ │ ├── locks.ts │ │ │ ├── node.ts │ │ │ ├── peers.ts │ │ │ ├── rounds.ts │ │ │ ├── transactions.ts │ │ │ ├── votes.ts │ │ │ └── wallets.ts │ │ ├── defaults.ts │ │ ├── handlers.ts │ │ ├── identifiers.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── plugins │ │ │ ├── cache.ts │ │ │ ├── comma-array-query.ts │ │ │ ├── dot-separated-query.ts │ │ │ ├── hapi-ajv.ts │ │ │ ├── index.ts │ │ │ ├── log.ts │ │ │ ├── pagination │ │ │ │ ├── config.ts │ │ │ │ ├── ext.ts │ │ │ │ └── index.ts │ │ │ ├── rate-limit.ts │ │ │ ├── response-headers.ts │ │ │ ├── semaphore.ts │ │ │ └── whitelist.ts │ │ ├── resources-new │ │ │ ├── block.ts │ │ │ ├── delegate.ts │ │ │ ├── index.ts │ │ │ ├── lock.ts │ │ │ ├── transaction.ts │ │ │ └── wallet.ts │ │ ├── resources │ │ │ ├── block-with-transactions.ts │ │ │ ├── block.ts │ │ │ ├── fee-statistics.ts │ │ │ ├── index.ts │ │ │ ├── peer.ts │ │ │ ├── ports.ts │ │ │ ├── round.ts │ │ │ ├── transaction-with-block.ts │ │ │ └── transaction.ts │ │ ├── routes │ │ │ ├── blockchain.ts │ │ │ ├── blocks.ts │ │ │ ├── delegates.ts │ │ │ ├── locks.ts │ │ │ ├── node.ts │ │ │ ├── peers.ts │ │ │ ├── rounds.ts │ │ │ ├── transactions.ts │ │ │ ├── votes.ts │ │ │ └── wallets.ts │ │ ├── schemas.ts │ │ ├── server.ts │ │ ├── service-provider.ts │ │ ├── services │ │ │ ├── delegate-search-service.ts │ │ │ ├── index.ts │ │ │ ├── lock-search-service.ts │ │ │ └── wallet-search-service.ts │ │ └── utils │ │ │ ├── get-ip.ts │ │ │ └── index.ts │ └── tsconfig.json ├── core-blockchain │ ├── package.json │ ├── src │ │ ├── actions │ │ │ ├── index.ts │ │ │ └── process-block.ts │ │ ├── blockchain.ts │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── process-blocks-job.ts │ │ ├── processor │ │ │ ├── block-processor.ts │ │ │ ├── contracts.ts │ │ │ ├── handlers │ │ │ │ ├── accept-block-handler.ts │ │ │ │ ├── already-forged-handler.ts │ │ │ │ ├── exception-handler.ts │ │ │ │ ├── incompatible-transactions-handler.ts │ │ │ │ ├── index.ts │ │ │ │ ├── invalid-generator-handler.ts │ │ │ │ ├── nonce-out-of-order-handler.ts │ │ │ │ ├── revert-block-handler.ts │ │ │ │ ├── unchained-handler.ts │ │ │ │ └── verification-failed-handler.ts │ │ │ └── index.ts │ │ ├── service-provider.ts │ │ └── state-machine │ │ │ ├── actions │ │ │ ├── blockchain-ready.ts │ │ │ ├── check-last-block-synced.ts │ │ │ ├── check-last-downloaded-block-synced.ts │ │ │ ├── check-later.ts │ │ │ ├── download-blocks.ts │ │ │ ├── download-finished.ts │ │ │ ├── download-paused.ts │ │ │ ├── exit-app.ts │ │ │ ├── index.ts │ │ │ ├── initialize.ts │ │ │ ├── rollback-database.ts │ │ │ ├── start-fork-recovery.ts │ │ │ ├── stopped.ts │ │ │ └── syncing-complete.ts │ │ │ ├── contracts.ts │ │ │ ├── index.ts │ │ │ ├── machine.ts │ │ │ └── state-machine.ts │ └── tsconfig.json ├── core-cli │ ├── package.json │ ├── src │ │ ├── action-factory.ts │ │ ├── actions │ │ │ ├── abort-errored-process.ts │ │ │ ├── abort-missing-process.ts │ │ │ ├── abort-running-process.ts │ │ │ ├── abort-stopped-process.ts │ │ │ ├── abort-unknown-process.ts │ │ │ ├── daemonize-process.ts │ │ │ ├── index.ts │ │ │ ├── restart-process.ts │ │ │ ├── restart-running-process-with-prompt.ts │ │ │ └── restart-running-process.ts │ │ ├── application-factory.ts │ │ ├── application.ts │ │ ├── commands │ │ │ ├── command-help.ts │ │ │ ├── command.ts │ │ │ ├── discover-commands.ts │ │ │ ├── discover-config.ts │ │ │ ├── discover-network.ts │ │ │ └── index.ts │ │ ├── component-factory.ts │ │ ├── components │ │ │ ├── app-header.ts │ │ │ ├── ask-date.ts │ │ │ ├── ask-hidden.ts │ │ │ ├── ask-number.ts │ │ │ ├── ask-password.ts │ │ │ ├── ask.ts │ │ │ ├── auto-complete.ts │ │ │ ├── box.ts │ │ │ ├── clear.ts │ │ │ ├── confirm.ts │ │ │ ├── error.ts │ │ │ ├── fatal.ts │ │ │ ├── index.ts │ │ │ ├── info.ts │ │ │ ├── listing.ts │ │ │ ├── log.ts │ │ │ ├── multi-select.ts │ │ │ ├── new-line.ts │ │ │ ├── prompt.ts │ │ │ ├── select.ts │ │ │ ├── spinner.ts │ │ │ ├── success.ts │ │ │ ├── table.ts │ │ │ ├── task-list.ts │ │ │ ├── title.ts │ │ │ ├── toggle.ts │ │ │ └── warning.ts │ │ ├── contracts.ts │ │ ├── exceptions │ │ │ ├── base.ts │ │ │ ├── index.ts │ │ │ └── runtime.ts │ │ ├── index.ts │ │ ├── input │ │ │ ├── definition.ts │ │ │ ├── index.ts │ │ │ ├── input.ts │ │ │ ├── parser.ts │ │ │ └── validator.ts │ │ ├── ioc │ │ │ ├── identifiers.ts │ │ │ └── index.ts │ │ ├── output │ │ │ ├── index.ts │ │ │ └── output.ts │ │ ├── plugins │ │ │ ├── index.ts │ │ │ └── suggest.ts │ │ ├── services │ │ │ ├── config.ts │ │ │ ├── environment.ts │ │ │ ├── index.ts │ │ │ ├── installer.ts │ │ │ ├── logger.ts │ │ │ ├── plugin-manager.ts │ │ │ ├── process-manager.ts │ │ │ ├── source-providers │ │ │ │ ├── abstract-source.ts │ │ │ │ ├── contracts.ts │ │ │ │ ├── errors.ts │ │ │ │ ├── file.ts │ │ │ │ ├── git.ts │ │ │ │ ├── index.ts │ │ │ │ └── npm.ts │ │ │ └── updater.ts │ │ └── utils │ │ │ ├── builder.ts │ │ │ ├── flags.ts │ │ │ ├── index.ts │ │ │ └── process.ts │ └── tsconfig.json ├── core-database │ ├── package.json │ ├── src │ │ ├── block-filter.ts │ │ ├── block-history-service.ts │ │ ├── database-service.ts │ │ ├── defaults.ts │ │ ├── events.ts │ │ ├── index.ts │ │ ├── migrations │ │ │ ├── 20180305100000-create-wallets-table.ts │ │ │ ├── 20180305200000-create-rounds-table.ts │ │ │ ├── 20180305300000-create-blocks-table.ts │ │ │ ├── 20180305400000-create-transactions-table.ts │ │ │ ├── 20181129400000-add-block_id-index-to-transactions-table.ts │ │ │ ├── 20181204100000-add-generator_public_key-index-to-blocks-table.ts │ │ │ ├── 20181204200000-add-timestamp-index-to-blocks-table.ts │ │ │ ├── 20181204300000-add-sender_public_key-index-to-transactions-table.ts │ │ │ ├── 20181204400000-add-recipient_id-index-to-transactions-table.ts │ │ │ ├── 20190307000000-drop-wallets-table.ts │ │ │ ├── 20190606000000-add-block-id-foreign-key-on-transactions.ts │ │ │ ├── 20190619000000-drop-id-column-from-rounds-table.ts │ │ │ ├── 20190626000000-enforce-chained-blocks.ts │ │ │ ├── 20190718000000-check_previous_block-add-schema.ts │ │ │ ├── 20190803000000-add-type_group-column-to-transactions-table.ts │ │ │ ├── 20190806000000-add-nonce-column-to-transactions-table.ts │ │ │ ├── 20190905000000-change-set_row_nonce-to-use-max-nonce.ts │ │ │ ├── 20190917000000-add-asset-column-to-transactions-table.ts │ │ │ ├── 20191003000000-migrate-vendor-field-hex.ts │ │ │ ├── 20191008000000-add-type-index-to-transactions-table.ts │ │ │ ├── 20200304000000-add-type_group-index-to-transactions-table.ts │ │ │ ├── 20200317000000-add-blocks-and-transactions-indexes.ts │ │ │ ├── 20200705000000-add-block-height-column-to-transactions-table.ts │ │ │ ├── 20201013000000-create-wallets-table.ts │ │ │ ├── 20201102000000-add-asset-payments-index-to-transactions-table.ts │ │ │ ├── 20201103000000-set-autovacuum-settings.ts │ │ │ ├── 20201117000000-add-generator_public_key_height-index-to-blocks-table.ts │ │ │ └── 20220606000000-disable-fastupdate-on-gin-indexes.ts │ │ ├── model-converter.ts │ │ ├── models │ │ │ ├── block.ts │ │ │ ├── index.ts │ │ │ ├── migration.ts │ │ │ ├── round.ts │ │ │ └── transaction.ts │ │ ├── repositories │ │ │ ├── abstract-repository.ts │ │ │ ├── block-repository.ts │ │ │ ├── index.ts │ │ │ ├── round-repository.ts │ │ │ └── transaction-repository.ts │ │ ├── service-provider.ts │ │ ├── transaction-filter.ts │ │ ├── transaction-history-service.ts │ │ ├── utils │ │ │ ├── index.ts │ │ │ ├── query-helper.ts │ │ │ ├── snake-naming-strategy.ts │ │ │ └── transform.ts │ │ └── wallets-table-service.ts │ └── tsconfig.json ├── core-forger │ ├── package.json │ ├── src │ │ ├── actions │ │ │ ├── forge-new-block.ts │ │ │ ├── index.ts │ │ │ └── is-forging-allowed.ts │ │ ├── client.ts │ │ ├── defaults.ts │ │ ├── delegate-factory.ts │ │ ├── delegate-tracker.ts │ │ ├── errors.ts │ │ ├── forger-service.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── methods │ │ │ ├── bip38.ts │ │ │ ├── bip39.ts │ │ │ └── method.ts │ │ ├── process-actions │ │ │ ├── current-delegate.ts │ │ │ ├── index.ts │ │ │ ├── last-forged-block.ts │ │ │ └── next-slot.ts │ │ └── service-provider.ts │ └── tsconfig.json ├── core-kernel │ ├── package.json │ ├── src │ │ ├── application.ts │ │ ├── bootstrap │ │ │ ├── app │ │ │ │ ├── index.ts │ │ │ │ ├── load-configuration.ts │ │ │ │ ├── load-cryptography.ts │ │ │ │ ├── load-environment-variables.ts │ │ │ │ ├── load-service-providers.ts │ │ │ │ ├── register-base-bindings.ts │ │ │ │ ├── register-base-configuration.ts │ │ │ │ ├── register-base-namespace.ts │ │ │ │ ├── register-base-paths.ts │ │ │ │ ├── register-base-service-providers.ts │ │ │ │ ├── register-error-handler.ts │ │ │ │ └── watch-configuration.ts │ │ │ ├── index.ts │ │ │ ├── interfaces.ts │ │ │ └── service-providers │ │ │ │ ├── boot-service-providers.ts │ │ │ │ ├── index.ts │ │ │ │ ├── listeners.ts │ │ │ │ └── register-service-providers.ts │ │ ├── container.ts │ │ ├── contracts │ │ │ ├── blockchain │ │ │ │ ├── blockchain.ts │ │ │ │ └── index.ts │ │ │ ├── database │ │ │ │ ├── block-filter.ts │ │ │ │ ├── event-types.ts │ │ │ │ ├── index.ts │ │ │ │ ├── model-converter.ts │ │ │ │ ├── models.ts │ │ │ │ ├── search │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── query-parameters.ts │ │ │ │ │ ├── search-parameter-converter.ts │ │ │ │ │ └── search-parameters.ts │ │ │ │ ├── transaction-filter.ts │ │ │ │ └── wallets-table-service.ts │ │ │ ├── index.ts │ │ │ ├── kernel │ │ │ │ ├── application.ts │ │ │ │ ├── cache.ts │ │ │ │ ├── config.ts │ │ │ │ ├── container.ts │ │ │ │ ├── events.ts │ │ │ │ ├── filesystem.ts │ │ │ │ ├── index.ts │ │ │ │ ├── log.ts │ │ │ │ ├── pipeline.ts │ │ │ │ ├── process-actions.ts │ │ │ │ ├── queue.ts │ │ │ │ └── validation.ts │ │ │ ├── p2p │ │ │ │ ├── blocks.ts │ │ │ │ ├── chunk-cache.ts │ │ │ │ ├── index.ts │ │ │ │ ├── nes-client.ts │ │ │ │ ├── network-monitor.ts │ │ │ │ ├── network-state.ts │ │ │ │ ├── peer-communicator.ts │ │ │ │ ├── peer-connector.ts │ │ │ │ ├── peer-processor.ts │ │ │ │ ├── peer-repository.ts │ │ │ │ ├── peer-verifier.ts │ │ │ │ ├── peer.ts │ │ │ │ ├── server.ts │ │ │ │ └── transaction-broadcaster.ts │ │ │ ├── search │ │ │ │ ├── criteria.ts │ │ │ │ ├── expressions.ts │ │ │ │ └── index.ts │ │ │ ├── shared │ │ │ │ ├── block-history-service.ts │ │ │ │ ├── download-block.ts │ │ │ │ ├── dynamic-fee.ts │ │ │ │ ├── forging-info.ts │ │ │ │ ├── index.ts │ │ │ │ ├── rounds.ts │ │ │ │ └── transaction-history-service.ts │ │ │ ├── snapshot │ │ │ │ ├── index.ts │ │ │ │ └── snapshot-service.ts │ │ │ ├── state │ │ │ │ ├── block-state.ts │ │ │ │ ├── block-store.ts │ │ │ │ ├── dpos.ts │ │ │ │ ├── index.ts │ │ │ │ ├── state-builder.ts │ │ │ │ ├── state-store.ts │ │ │ │ ├── transaction-store.ts │ │ │ │ ├── transaction-validator.ts │ │ │ │ └── wallets.ts │ │ │ ├── transaction-pool │ │ │ │ ├── collator.ts │ │ │ │ ├── dynamic-fee-matcher.ts │ │ │ │ ├── errors.ts │ │ │ │ ├── expiration-service.ts │ │ │ │ ├── index.ts │ │ │ │ ├── mempool-index-registry.ts │ │ │ │ ├── mempool-index.ts │ │ │ │ ├── mempool.ts │ │ │ │ ├── processor.ts │ │ │ │ ├── query.ts │ │ │ │ ├── sender-mempool.ts │ │ │ │ ├── sender-state.ts │ │ │ │ ├── service.ts │ │ │ │ ├── storage.ts │ │ │ │ └── worker.ts │ │ │ └── transactions │ │ │ │ ├── index.ts │ │ │ │ └── verification.ts │ │ ├── enums │ │ │ ├── events.ts │ │ │ ├── index.ts │ │ │ └── shutdown-signals.ts │ │ ├── exceptions │ │ │ ├── base.ts │ │ │ ├── cache.ts │ │ │ ├── config.ts │ │ │ ├── container.ts │ │ │ ├── filesystem.ts │ │ │ ├── index.ts │ │ │ ├── logic.ts │ │ │ ├── plugins.ts │ │ │ ├── runtime.ts │ │ │ └── validation.ts │ │ ├── index.ts │ │ ├── ioc │ │ │ ├── decorator.ts │ │ │ ├── identifiers.ts │ │ │ ├── index.ts │ │ │ └── selectors.ts │ │ ├── providers │ │ │ ├── index.ts │ │ │ ├── plugin-configuration.ts │ │ │ ├── plugin-manifest.ts │ │ │ ├── service-provider-repository.ts │ │ │ └── service-provider.ts │ │ ├── services │ │ │ ├── attributes │ │ │ │ ├── attribute-map.ts │ │ │ │ ├── attribute-set.ts │ │ │ │ ├── contracts.ts │ │ │ │ └── index.ts │ │ │ ├── cache │ │ │ │ ├── drivers │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── memory.ts │ │ │ │ │ └── null.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ │ ├── config │ │ │ │ ├── drivers │ │ │ │ │ ├── index.ts │ │ │ │ │ └── local.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ ├── repository.ts │ │ │ │ └── watcher.ts │ │ │ ├── events │ │ │ │ ├── drivers │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── memory.ts │ │ │ │ │ └── null.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ │ ├── filesystem │ │ │ │ ├── drivers │ │ │ │ │ ├── local.ts │ │ │ │ │ └── null.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ │ ├── index.ts │ │ │ ├── log │ │ │ │ ├── drivers │ │ │ │ │ ├── memory.ts │ │ │ │ │ └── null.ts │ │ │ │ ├── enums.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ │ ├── mixins │ │ │ │ ├── index.ts │ │ │ │ ├── mixins.ts │ │ │ │ └── service-provider.ts │ │ │ ├── pipeline │ │ │ │ ├── drivers │ │ │ │ │ ├── memory.ts │ │ │ │ │ └── null.ts │ │ │ │ ├── index.ts │ │ │ │ └── service-provider.ts │ │ │ ├── process-actions │ │ │ │ ├── drivers │ │ │ │ │ └── pm2.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ │ ├── queue │ │ │ │ ├── drivers │ │ │ │ │ ├── memory.ts │ │ │ │ │ └── null.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ │ ├── schedule │ │ │ │ ├── block-job.ts │ │ │ │ ├── cron-job.ts │ │ │ │ ├── index.ts │ │ │ │ ├── interfaces.ts │ │ │ │ ├── listeners.ts │ │ │ │ ├── schedule.ts │ │ │ │ └── service-provider.ts │ │ │ ├── search │ │ │ │ ├── errors.ts │ │ │ │ ├── index.ts │ │ │ │ ├── pagination-service.ts │ │ │ │ ├── service-provider.ts │ │ │ │ └── standard-criteria-service.ts │ │ │ ├── triggers │ │ │ │ ├── action.ts │ │ │ │ ├── index.ts │ │ │ │ ├── service-provider.ts │ │ │ │ └── triggers.ts │ │ │ └── validation │ │ │ │ ├── drivers │ │ │ │ ├── joi.ts │ │ │ │ └── null.ts │ │ │ │ ├── index.ts │ │ │ │ ├── manager.ts │ │ │ │ └── service-provider.ts │ │ ├── support │ │ │ ├── class-manager.ts │ │ │ ├── index.ts │ │ │ └── instance-manager.ts │ │ ├── types │ │ │ ├── container.ts │ │ │ └── index.ts │ │ └── utils │ │ │ ├── assert.ts │ │ │ ├── calculate-forging-info.ts │ │ │ ├── delegate-calculator.ts │ │ │ ├── expiration-calculator.ts │ │ │ ├── format-timestamp.ts │ │ │ ├── get-blocktime-lookup.ts │ │ │ ├── index.ts │ │ │ ├── ip-address.ts │ │ │ ├── ipc-handler.ts │ │ │ ├── ipc-subprocess.ts │ │ │ ├── is-blacklisted.ts │ │ │ ├── is-block-chained.ts │ │ │ ├── is-whitelisted.ts │ │ │ ├── lock.ts │ │ │ ├── round-calculator.ts │ │ │ ├── search.ts │ │ │ └── supply-calculator.ts │ └── tsconfig.json ├── core-logger-pino │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── driver.ts │ │ ├── index.ts │ │ └── service-provider.ts │ └── tsconfig.json ├── core-magistrate-api │ ├── package.json │ ├── src │ │ ├── controllers │ │ │ └── entities.ts │ │ ├── handlers.ts │ │ ├── identifiers.ts │ │ ├── index.ts │ │ ├── resources │ │ │ ├── entity.ts │ │ │ └── index.ts │ │ ├── routes │ │ │ └── entities.ts │ │ ├── service-provider.ts │ │ └── services │ │ │ ├── entity-search-service.ts │ │ │ └── index.ts │ └── tsconfig.json ├── core-magistrate-crypto │ ├── README.md │ ├── package.json │ ├── src │ │ ├── builders │ │ │ ├── bridgechain-registration.ts │ │ │ ├── bridgechain-resignation.ts │ │ │ ├── bridgechain-update.ts │ │ │ ├── business-registration.ts │ │ │ ├── business-resignation.ts │ │ │ ├── business-update.ts │ │ │ ├── entity.ts │ │ │ └── index.ts │ │ ├── enums.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ └── transactions │ │ │ ├── bridgechain-registration.ts │ │ │ ├── bridgechain-resignation.ts │ │ │ ├── bridgechain-update.ts │ │ │ ├── business-registration.ts │ │ │ ├── business-resignation.ts │ │ │ ├── business-update.ts │ │ │ ├── entity.ts │ │ │ ├── index.ts │ │ │ └── utils │ │ │ ├── bridgechain-schemas.ts │ │ │ ├── business-schema.ts │ │ │ └── entity-schemas.ts │ └── tsconfig.json ├── core-magistrate-transactions │ ├── README.md │ ├── package.json │ ├── src │ │ ├── enums.ts │ │ ├── errors.ts │ │ ├── events.ts │ │ ├── handlers │ │ │ ├── bridgechain-registration.ts │ │ │ ├── bridgechain-resignation.ts │ │ │ ├── bridgechain-update.ts │ │ │ ├── business-registration.ts │ │ │ ├── business-resignation.ts │ │ │ ├── business-update.ts │ │ │ ├── entity.ts │ │ │ ├── index.ts │ │ │ ├── magistrate-handler.ts │ │ │ └── utils.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── service-provider.ts │ │ └── wallet-indexes.ts │ └── tsconfig.json ├── core-p2p │ ├── package.json │ ├── src │ │ ├── actions │ │ │ ├── index.ts │ │ │ └── validate-and-accept-peer.ts │ │ ├── chunk-cache.ts │ │ ├── constants.ts │ │ ├── contracts.ts │ │ ├── defaults.ts │ │ ├── enums.ts │ │ ├── errors.ts │ │ ├── event-listener.ts │ │ ├── hapi-nes │ │ │ ├── client.ts │ │ │ ├── index.ts │ │ │ ├── interfaces.ts │ │ │ ├── listener.ts │ │ │ ├── plugin.ts │ │ │ ├── socket.ts │ │ │ └── utils.ts │ │ ├── index.ts │ │ ├── listeners.ts │ │ ├── network-monitor.ts │ │ ├── network-state.ts │ │ ├── peer-communicator.ts │ │ ├── peer-connector.ts │ │ ├── peer-processor.ts │ │ ├── peer-repository.ts │ │ ├── peer-verifier.ts │ │ ├── peer.ts │ │ ├── rate-limiter.ts │ │ ├── schemas.ts │ │ ├── service-provider.ts │ │ ├── socket-server │ │ │ ├── codecs │ │ │ │ ├── blocks.ts │ │ │ │ ├── index.ts │ │ │ │ ├── internal.ts │ │ │ │ ├── peer.ts │ │ │ │ ├── proto │ │ │ │ │ ├── blocks.proto │ │ │ │ │ ├── peer.proto │ │ │ │ │ ├── protos.d.ts │ │ │ │ │ ├── protos.js │ │ │ │ │ ├── shared.proto │ │ │ │ │ └── transactions.proto │ │ │ │ └── transactions.ts │ │ │ ├── controllers │ │ │ │ ├── blocks.ts │ │ │ │ ├── controller.ts │ │ │ │ ├── internal.ts │ │ │ │ ├── peer.ts │ │ │ │ └── transactions.ts │ │ │ ├── errors.ts │ │ │ ├── plugins │ │ │ │ ├── accept-peer.ts │ │ │ │ ├── await-block.ts │ │ │ │ ├── close-connection.ts │ │ │ │ ├── codec.ts │ │ │ │ ├── is-app-ready.ts │ │ │ │ ├── rate-limit.ts │ │ │ │ ├── validate.ts │ │ │ │ └── whitelist-forger.ts │ │ │ ├── routes │ │ │ │ ├── blocks.ts │ │ │ │ ├── internal.ts │ │ │ │ ├── peer.ts │ │ │ │ ├── route.ts │ │ │ │ └── transactions.ts │ │ │ ├── schemas │ │ │ │ ├── blocks.ts │ │ │ │ ├── internal.ts │ │ │ │ ├── peer.ts │ │ │ │ ├── shared.ts │ │ │ │ └── transactions.ts │ │ │ ├── server.ts │ │ │ └── utils │ │ │ │ ├── get-codec.ts │ │ │ │ ├── get-headers.ts │ │ │ │ ├── get-peer-config.ts │ │ │ │ ├── map-addr.ts │ │ │ │ └── validate.ts │ │ ├── transaction-broadcaster.ts │ │ └── utils │ │ │ ├── build-rate-limiter.ts │ │ │ ├── check-dns.ts │ │ │ ├── check-ntp.ts │ │ │ ├── get-peer-ip.ts │ │ │ ├── index.ts │ │ │ └── is-valid-version.ts │ └── tsconfig.json ├── core-snapshots │ ├── package.json │ ├── src │ │ ├── codecs │ │ │ ├── index.ts │ │ │ ├── json-codec.ts │ │ │ └── message-pack-codec.ts │ │ ├── contracts │ │ │ ├── codec.ts │ │ │ ├── database.ts │ │ │ ├── index.ts │ │ │ ├── meta-data.ts │ │ │ ├── options.ts │ │ │ ├── repository.ts │ │ │ ├── stream.ts │ │ │ └── worker.ts │ │ ├── database-service.ts │ │ ├── defaults.ts │ │ ├── events.ts │ │ ├── exceptions │ │ │ ├── codec.ts │ │ │ ├── index.ts │ │ │ ├── stream.ts │ │ │ └── verifier.ts │ │ ├── filesystem │ │ │ ├── filesystem.ts │ │ │ ├── index.ts │ │ │ ├── stream-reader.ts │ │ │ ├── stream-writer.ts │ │ │ ├── transform-encoder.ts │ │ │ └── utils │ │ │ │ ├── index.ts │ │ │ │ └── remove-listeners.ts │ │ ├── index.ts │ │ ├── ioc │ │ │ ├── identifiers.ts │ │ │ └── index.ts │ │ ├── progress-dispatcher.ts │ │ ├── progress-renderer.ts │ │ ├── repositories │ │ │ ├── abstract-repository.ts │ │ │ ├── block-repository.ts │ │ │ ├── index.ts │ │ │ ├── round-repository.ts │ │ │ └── transaction-repository.ts │ │ ├── service-provider.ts │ │ ├── snapshot-service.ts │ │ ├── verifier.ts │ │ └── workers │ │ │ ├── actions │ │ │ ├── abstract-worker-action.ts │ │ │ ├── dump-worker-action.ts │ │ │ ├── index.ts │ │ │ ├── read-processor.ts │ │ │ ├── restore-worker-action.ts │ │ │ ├── test-worker-action.ts │ │ │ └── verify-worker-action.ts │ │ │ ├── application.ts │ │ │ ├── worker-wrapper.ts │ │ │ └── worker.ts │ └── tsconfig.json ├── core-state │ ├── package.json │ ├── src │ │ ├── actions │ │ │ ├── build-delegate-ranking.ts │ │ │ ├── get-active-delegates.ts │ │ │ └── index.ts │ │ ├── block-state.ts │ │ ├── database-interactions.ts │ │ ├── database-interceptor.ts │ │ ├── defaults.ts │ │ ├── dpos │ │ │ ├── dpos-previous-round.ts │ │ │ ├── dpos.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── round-state.ts │ │ ├── service-provider.ts │ │ ├── state-builder.ts │ │ ├── stores │ │ │ ├── blocks.ts │ │ │ ├── index.ts │ │ │ ├── state.ts │ │ │ └── transactions.ts │ │ ├── transaction-validator.ts │ │ └── wallets │ │ │ ├── errors.ts │ │ │ ├── index.ts │ │ │ ├── indexers │ │ │ ├── index.ts │ │ │ ├── indexers.ts │ │ │ └── wallet-indexes.ts │ │ │ ├── wallet-event.ts │ │ │ ├── wallet-factory.ts │ │ │ ├── wallet-index.ts │ │ │ ├── wallet-repository-clone.ts │ │ │ ├── wallet-repository-copy-on-write.ts │ │ │ ├── wallet-repository.ts │ │ │ ├── wallet-sync-service.ts │ │ │ └── wallet.ts │ └── tsconfig.json ├── core-test-framework │ ├── package.json │ ├── src │ │ ├── app │ │ │ ├── contracts.ts │ │ │ ├── generators │ │ │ │ ├── core.ts │ │ │ │ ├── crypto.ts │ │ │ │ ├── generator.ts │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── sandbox.ts │ │ ├── cli │ │ │ ├── console.ts │ │ │ └── index.ts │ │ ├── factories │ │ │ ├── factories │ │ │ │ ├── block.ts │ │ │ │ ├── identity.ts │ │ │ │ ├── index.ts │ │ │ │ ├── peer.ts │ │ │ │ ├── round.ts │ │ │ │ ├── transaction.ts │ │ │ │ └── wallet.ts │ │ │ ├── factory-builder.ts │ │ │ ├── factory.ts │ │ │ ├── helpers.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── index.ts │ │ ├── internal │ │ │ ├── delegates.ts │ │ │ ├── index.ts │ │ │ ├── passphrases.json │ │ │ ├── signer.ts │ │ │ └── wallet-attributes.ts │ │ ├── matchers │ │ │ ├── api │ │ │ │ ├── block.ts │ │ │ │ ├── index.ts │ │ │ │ ├── peer.ts │ │ │ │ ├── response.ts │ │ │ │ └── transaction.ts │ │ │ ├── blockchain │ │ │ │ ├── dispatch.ts │ │ │ │ ├── execute-on-entry.ts │ │ │ │ ├── index.ts │ │ │ │ └── transition.ts │ │ │ ├── fields │ │ │ │ ├── address.ts │ │ │ │ ├── index.ts │ │ │ │ └── public-key.ts │ │ │ ├── functional │ │ │ │ ├── accepted.ts │ │ │ │ ├── entity.ts │ │ │ │ ├── forged.ts │ │ │ │ ├── index.ts │ │ │ │ ├── rejected.ts │ │ │ │ ├── unconfirmed.ts │ │ │ │ └── vote-balance.ts │ │ │ ├── index.ts │ │ │ ├── models │ │ │ │ ├── delegate.ts │ │ │ │ ├── index.ts │ │ │ │ ├── transaction.ts │ │ │ │ └── wallet.ts │ │ │ └── transactions │ │ │ │ ├── index.ts │ │ │ │ ├── types │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── delegate-resignation.ts │ │ │ │ ├── index.ts │ │ │ │ ├── ipfs.ts │ │ │ │ ├── multi-payment.ts │ │ │ │ ├── multi-signature.ts │ │ │ │ ├── second-signature.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ │ │ ├── valid-second-signature.ts │ │ │ │ └── valid.ts │ │ ├── mocks │ │ │ ├── block-repository.ts │ │ │ ├── blockchain.ts │ │ │ ├── index.ts │ │ │ ├── network-monitor.ts │ │ │ ├── peer-repository.ts │ │ │ ├── query.ts │ │ │ ├── round-repository.ts │ │ │ ├── service-provider-repository.ts │ │ │ ├── state-store.ts │ │ │ ├── transaction-pool-processor.ts │ │ │ ├── transaction-repository.ts │ │ │ └── wallet-respository.ts │ │ └── utils │ │ │ ├── api-http-client.ts │ │ │ ├── api-inject-client.ts │ │ │ ├── api.ts │ │ │ ├── generic.ts │ │ │ ├── index.ts │ │ │ ├── mapper.ts │ │ │ ├── rest-client.ts │ │ │ └── transaction-factory.ts │ └── tsconfig.json ├── core-transaction-pool │ ├── package.json │ ├── src │ │ ├── actions │ │ │ ├── apply-transaction.ts │ │ │ ├── index.ts │ │ │ ├── on-pool-enter.ts │ │ │ ├── on-pool-leave.ts │ │ │ ├── revert-transaction.ts │ │ │ ├── throw-if-cannot-enter-pool.ts │ │ │ └── verify-transaction.ts │ │ ├── collator.ts │ │ ├── defaults.ts │ │ ├── dynamic-fee-matcher.ts │ │ ├── errors.ts │ │ ├── expiration-service.ts │ │ ├── index.ts │ │ ├── mempool-index-registry.ts │ │ ├── mempool-index.ts │ │ ├── mempool.ts │ │ ├── processor-dynamic-fee-extension.ts │ │ ├── processor.ts │ │ ├── query.ts │ │ ├── sender-mempool.ts │ │ ├── sender-state.ts │ │ ├── service-provider.ts │ │ ├── service.ts │ │ ├── storage.ts │ │ ├── utils.ts │ │ ├── worker-pool.ts │ │ ├── worker-script-handler.ts │ │ ├── worker-script.ts │ │ └── worker.ts │ └── tsconfig.json ├── core-transactions │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── enums.ts │ │ ├── errors.ts │ │ ├── handlers │ │ │ ├── handler-provider.ts │ │ │ ├── handler-registry.ts │ │ │ ├── index.ts │ │ │ ├── one │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── index.ts │ │ │ │ ├── multi-signature-registration.ts │ │ │ │ ├── second-signature-registration.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ │ ├── transaction.ts │ │ │ └── two │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── delegate-resignation.ts │ │ │ │ ├── htlc-claim.ts │ │ │ │ ├── htlc-lock.ts │ │ │ │ ├── htlc-refund.ts │ │ │ │ ├── index.ts │ │ │ │ ├── ipfs.ts │ │ │ │ ├── multi-payment.ts │ │ │ │ ├── multi-signature-registration.ts │ │ │ │ ├── second-signature-registration.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ ├── index.ts │ │ ├── service-provider.ts │ │ ├── utils.ts │ │ └── verification │ │ │ ├── cache.ts │ │ │ ├── index.ts │ │ │ ├── multi-signature-verification-memoized.ts │ │ │ ├── multi-signature-verification.ts │ │ │ ├── second-signature-verification-memoized.ts │ │ │ └── second-signature-verification.ts │ └── tsconfig.json ├── core-webhooks │ ├── package.json │ ├── src │ │ ├── conditions.ts │ │ ├── database.ts │ │ ├── defaults.ts │ │ ├── events.ts │ │ ├── identifiers.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── listener.ts │ │ ├── server │ │ │ ├── index.ts │ │ │ ├── plugins │ │ │ │ └── whitelist.ts │ │ │ ├── schema.ts │ │ │ └── utils.ts │ │ └── service-provider.ts │ └── tsconfig.json ├── core │ ├── bin │ │ ├── config │ │ │ ├── devnet │ │ │ │ ├── .env │ │ │ │ ├── app.json │ │ │ │ ├── config.json │ │ │ │ ├── delegates.json │ │ │ │ └── peers.json │ │ │ ├── mainnet │ │ │ │ ├── .env │ │ │ │ ├── app.json │ │ │ │ ├── config.json │ │ │ │ ├── delegates.json │ │ │ │ └── peers.json │ │ │ └── testnet │ │ │ │ ├── .env │ │ │ │ ├── app.json │ │ │ │ ├── config.json │ │ │ │ ├── delegates.json │ │ │ │ └── peers.json │ │ └── run │ ├── package.json │ ├── src │ │ ├── cli.ts │ │ ├── commands │ │ │ ├── config-cli.ts │ │ │ ├── config-database.ts │ │ │ ├── config-forger-bip38.ts │ │ │ ├── config-forger-bip39.ts │ │ │ ├── config-forger.ts │ │ │ ├── config-publish.ts │ │ │ ├── core-log.ts │ │ │ ├── core-restart.ts │ │ │ ├── core-run.ts │ │ │ ├── core-start.ts │ │ │ ├── core-status.ts │ │ │ ├── core-stop.ts │ │ │ ├── env-get.ts │ │ │ ├── env-list.ts │ │ │ ├── env-paths.ts │ │ │ ├── env-set.ts │ │ │ ├── forger-log.ts │ │ │ ├── forger-restart.ts │ │ │ ├── forger-run.ts │ │ │ ├── forger-start.ts │ │ │ ├── forger-status.ts │ │ │ ├── forger-stop.ts │ │ │ ├── help.ts │ │ │ ├── network-generate.ts │ │ │ ├── plugin-install.ts │ │ │ ├── plugin-remove.ts │ │ │ ├── plugin-update.ts │ │ │ ├── pool-clear.ts │ │ │ ├── reinstall.ts │ │ │ ├── relay-log.ts │ │ │ ├── relay-restart.ts │ │ │ ├── relay-run.ts │ │ │ ├── relay-share.ts │ │ │ ├── relay-start.ts │ │ │ ├── relay-status.ts │ │ │ ├── relay-stop.ts │ │ │ ├── snapshot-dump.ts │ │ │ ├── snapshot-restore.ts │ │ │ ├── snapshot-rollback.ts │ │ │ ├── snapshot-truncate.ts │ │ │ ├── snapshot-verify.ts │ │ │ ├── top.ts │ │ │ ├── uninstall.ts │ │ │ ├── update.ts │ │ │ └── version.ts │ │ ├── exceptions │ │ │ ├── base.ts │ │ │ ├── crypto.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── internal │ │ │ └── crypto.ts │ └── tsconfig.json └── crypto │ ├── banner.png │ ├── package.json │ ├── rollup.config.js │ ├── src │ ├── blocks │ │ ├── block.ts │ │ ├── deserializer.ts │ │ ├── factory.ts │ │ ├── index.ts │ │ └── serializer.ts │ ├── constants.ts │ ├── crypto │ │ ├── bip38.ts │ │ ├── hash-algorithms.ts │ │ ├── hash.ts │ │ ├── hdwallet.ts │ │ ├── index.ts │ │ ├── message.ts │ │ └── slots.ts │ ├── enums.ts │ ├── errors.ts │ ├── identities │ │ ├── address.ts │ │ ├── helpers.ts │ │ ├── index.ts │ │ ├── keys.ts │ │ ├── private-key.ts │ │ ├── public-key.ts │ │ └── wif.ts │ ├── index.ts │ ├── interfaces │ │ ├── block.ts │ │ ├── crypto.ts │ │ ├── identities.ts │ │ ├── index.ts │ │ ├── managers.ts │ │ ├── message.ts │ │ ├── networks.ts │ │ └── transactions.ts │ ├── managers │ │ ├── config.ts │ │ ├── index.ts │ │ └── network.ts │ ├── networks │ │ └── index.ts │ ├── transactions │ │ ├── builders │ │ │ ├── index.ts │ │ │ └── transactions │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── delegate-resignation.ts │ │ │ │ ├── htlc-claim.ts │ │ │ │ ├── htlc-lock.ts │ │ │ │ ├── htlc-refund.ts │ │ │ │ ├── ipfs.ts │ │ │ │ ├── multi-payment.ts │ │ │ │ ├── multi-signature.ts │ │ │ │ ├── second-signature.ts │ │ │ │ ├── transaction.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ ├── deserializer.ts │ │ ├── factory.ts │ │ ├── index.ts │ │ ├── registry.ts │ │ ├── serializer.ts │ │ ├── signer.ts │ │ ├── types │ │ │ ├── factory.ts │ │ │ ├── index.ts │ │ │ ├── internal-transaction-type.ts │ │ │ ├── one │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── index.ts │ │ │ │ ├── multi-signature-registration.ts │ │ │ │ ├── second-signature-registration.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ │ ├── schemas.ts │ │ │ ├── transaction.ts │ │ │ └── two │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── delegate-resignation.ts │ │ │ │ ├── htlc-claim.ts │ │ │ │ ├── htlc-lock.ts │ │ │ │ ├── htlc-refund.ts │ │ │ │ ├── index.ts │ │ │ │ ├── ipfs.ts │ │ │ │ ├── multi-payment.ts │ │ │ │ ├── multi-signature-registration.ts │ │ │ │ ├── second-signature-registration.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ ├── utils.ts │ │ └── verifier.ts │ ├── types.ts │ ├── utils │ │ ├── base58.ts │ │ ├── bignum.ts │ │ ├── block-time-calculator.ts │ │ ├── byte-buffer.ts │ │ ├── index.ts │ │ └── is-valid-peer.ts │ └── validation │ │ ├── formats.ts │ │ ├── index.ts │ │ ├── keywords.ts │ │ └── schemas.ts │ └── tsconfig.json ├── plugins └── .gitignore ├── renovate.json ├── scripts ├── api-iptables.sh ├── circular.js ├── deps │ ├── missing.js │ ├── unused.js │ └── update.sh ├── docker │ ├── generate-docker.js │ └── templates │ │ ├── devnet │ │ ├── Dockerfile │ │ ├── docker-compose.yml │ │ ├── entrypoint.sh │ │ ├── purge_all.sh │ │ └── restore.sh │ │ ├── mainnet │ │ └── docker-compose.yml │ │ ├── testnet │ │ ├── Dockerfile │ │ ├── docker-compose.yml │ │ ├── entrypoint.sh │ │ ├── purge_all.sh │ │ └── restore.sh │ │ └── unitnet │ │ ├── docker-compose.yml │ │ └── purge.sh ├── pre-test.sh ├── publish │ ├── alpha.sh │ ├── beta.sh │ ├── latest.sh │ ├── next.sh │ └── rc.sh ├── upgrade.sh ├── upgrade │ ├── test.sh │ └── upgrade.js ├── v3-iptables.sh └── version.sh ├── tsconfig.eslint.json ├── tsconfig.json ├── tsconfig.test.json ├── upgrade └── 2.1.0 │ ├── exchange.sh │ └── normal.sh ├── vagrant ├── bootstrap.sh ├── centos │ ├── 6 │ │ └── Vagrantfile │ └── 7 │ │ └── Vagrantfile ├── debian │ ├── 8_10 │ │ └── Vagrantfile │ └── 9_4 │ │ └── Vagrantfile └── ubuntu │ ├── 16_04 │ └── Vagrantfile │ └── 18_04 │ └── Vagrantfile ├── wallaby.js └── yarn.lock /.codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "packages/**/src/defaults.ts" 3 | - "packages/**/src/index.ts" 4 | - "packages/**/src/plugin.ts" 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | bin 4 | *.d.ts -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | _extends: .github 2 | -------------------------------------------------------------------------------- /.github/sync-script/sync-script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Sync script, just waits till the node running on localhost is synced 3 | 4 | starttime=$(date +%s) 5 | synced=0 6 | 7 | while test $synced != 1 8 | do 9 | tail output.log # the node must redirect its output to output.log 10 | currtime=$(date +%s) 11 | difftime=`expr $currtime - $starttime` 12 | echo "still not synced after $difftime seconds..." 13 | if [ $difftime -gt 18000 ] ; then exit 1 ; fi # exit with error after 5 hours 14 | sleep 6 15 | synced=$(curl http://127.0.0.1:4003/api/node/status -m 2 | grep "\"synced\":true" | wc -l) 16 | done -------------------------------------------------------------------------------- /.github/workflows/mainnet-sync.yml: -------------------------------------------------------------------------------- 1 | name: Mainnet sync 2 | 3 | on: 4 | schedule: 5 | - cron: '0 10 * * *' 6 | 7 | jobs: 8 | mainnet-sync: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: executing remote ssh commands using password 13 | uses: appleboy/ssh-action@master 14 | with: 15 | host: ${{ secrets.SYNC_HOST }} 16 | username: ${{ secrets.SYNC_USERNAME }} 17 | password: ${{ secrets.SYNC_PASSWORD }} 18 | port: ${{ secrets.SYNC_PORT }} 19 | script_stop: true 20 | script: bash mainnet-sync-result.sh -------------------------------------------------------------------------------- /.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "/packages/**/src/**/*.ts": ["yarn lint", "prettier --write", "git add"], 3 | "*.{json,md}": ["prettier --write", "git add"] 4 | } 5 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 12.18.4 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .coverage 2 | dist 3 | docs 4 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "singleQuote": false, 4 | "tabWidth": 4, 5 | "trailingComma": "all", 6 | "useTabs": false 7 | } 8 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | child-concurrency 1 2 | --install.ignore-engines true 3 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @itsanametoo @sebastijankuzner @boldninja @oXtxNt9U 2 | -------------------------------------------------------------------------------- /__mocks__/better-sqlite3.js: -------------------------------------------------------------------------------- 1 | const BetterSqlite3 = jest.requireActual("better-sqlite3"); 2 | 3 | module.exports = class BetterSqlite3Mock extends BetterSqlite3 { 4 | constructor(path, options = {}) { 5 | super(path || ":memory:", options); 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /__mocks__/execa.js: -------------------------------------------------------------------------------- 1 | module.exports = jest.genMockFromModule("execa"); 2 | -------------------------------------------------------------------------------- /__tests__/e2e/img/core-e2e-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/e2e/img/core-e2e-banner.png -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | events { 2 | worker_connections 4096; ## Default: 1024 3 | } 4 | http { 5 | server { 6 | listen 4900; 7 | 8 | location ~ /core(\d+)(.*)$ { 9 | resolver 127.0.0.11; 10 | proxy_pass http://core$1:4003$2; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM telus/build-essential 2 | FROM python 3 | FROM node:12.13 4 | 5 | WORKDIR /ark-core 6 | 7 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core0/.env: -------------------------------------------------------------------------------- 1 | CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true 2 | CORE_LOG_LEVEL=debug 3 | CORE_LOG_LEVEL_FILE=trace 4 | 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4000 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_API_HOST=0.0.0.0 14 | CORE_API_PORT=4003 15 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core0/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [{ "ip": "127.0.0.1", "port": 4000 }] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core1/.env: -------------------------------------------------------------------------------- 1 | CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true 2 | CORE_LOG_LEVEL=debug 3 | CORE_LOG_LEVEL_FILE=trace 4 | 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4000 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_API_HOST=0.0.0.0 14 | CORE_API_PORT=4003 15 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core1/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [], 3 | "sources": ["http://peerdiscovery:3000/"] 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core2/.env: -------------------------------------------------------------------------------- 1 | CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true 2 | CORE_LOG_LEVEL=debug 3 | CORE_LOG_LEVEL_FILE=trace 4 | 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4000 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_API_HOST=0.0.0.0 14 | CORE_API_PORT=4003 15 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core2/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [], 3 | "sources": ["http://peerdiscovery:3000/"] 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core3/.env: -------------------------------------------------------------------------------- 1 | CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true 2 | CORE_LOG_LEVEL=debug 3 | CORE_LOG_LEVEL_FILE=trace 4 | 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4000 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_API_HOST=0.0.0.0 14 | CORE_API_PORT=4003 15 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core3/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [], 3 | "sources": ["http://peerdiscovery:3000/"] 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core4/.env: -------------------------------------------------------------------------------- 1 | CORE_P2P_PEER_VERIFIER_DEBUG_EXTRA=true 2 | CORE_LOG_LEVEL=debug 3 | CORE_LOG_LEVEL_FILE=trace 4 | 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4000 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_API_HOST=0.0.0.0 14 | CORE_API_PORT=4003 15 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core4/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [], 3 | "sources": ["http://peerdiscovery:3000/"] 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/peer-discovery/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | COPY index.js . 4 | COPY package.json . 5 | 6 | RUN npm install 7 | 8 | CMD [ "node", "index.js" ] 9 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/peer-discovery/index.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const app = express(); 3 | 4 | const ips = {}; 5 | const sources = []; 6 | app.get("/", function (req, res) { 7 | console.log(`received peer discovery request from ${req.ip} !`); 8 | if (!ips[req.ip]) { 9 | ips[req.ip] = true; 10 | sources.push({ ip: req.ip, port: 4000 }); 11 | } 12 | console.log(`responding with ${JSON.stringify(sources)}`); 13 | res.send(sources); 14 | }); 15 | 16 | app.listen(3000, function () { 17 | console.log("Peer discovery app listening on port 3000!"); 18 | }); 19 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/peer-discovery/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "peerdiscovery", 3 | "description": "Peer discovery app", 4 | "dependencies": { 5 | "express": "4.17.1" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /__tests__/functional/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/functional/.gitkeep -------------------------------------------------------------------------------- /__tests__/integration/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/integration/.gitkeep -------------------------------------------------------------------------------- /__tests__/integration/core-test-framework/utils/__support__/echo-controller.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { Container } from "@arkecosystem/core-kernel"; 3 | 4 | @Container.injectable() 5 | export class EchoController { 6 | public index(request: Hapi.Request): { query: Hapi.RequestQuery; payload: Hapi.RequestPayload } { 7 | return { query: request.query, payload: request.payload }; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /__tests__/unit/core-api/__support__/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./app"; 2 | export * from "./server"; 3 | -------------------------------------------------------------------------------- /__tests__/unit/core-api/routes/__fixtures__/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./results"; 2 | export * from "./server-defaults"; 3 | -------------------------------------------------------------------------------- /__tests__/unit/core-api/routes/__fixtures__/results.ts: -------------------------------------------------------------------------------- 1 | export const paginatedResult = { 2 | results: [], 3 | totalCount: 0, 4 | meta: { 5 | totalCountIsEstimate: false, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-api/routes/__fixtures__/server-defaults.ts: -------------------------------------------------------------------------------- 1 | export const serverDefaults = { 2 | plugins: { 3 | pagination: { 4 | limit: 100, 5 | }, 6 | socketTimeout: 5000, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-api/services/__fixtures__/index.ts: -------------------------------------------------------------------------------- 1 | export * as Delegates from "./delegates"; 2 | export * as Locks from "./locks"; 3 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/__fixtures__/index.ts: -------------------------------------------------------------------------------- 1 | export * as Blocks from "./blocks"; 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/actions/process-block.test.ts: -------------------------------------------------------------------------------- 1 | import { ProcessBlockAction } from "@packages/core-blockchain/src/actions/process-block"; 2 | 3 | const blockProcessor = { 4 | process: jest.fn(), 5 | }; 6 | 7 | const block = { 8 | id: "dummy_block_id", 9 | }; 10 | 11 | describe("ProcessBlockAction", () => { 12 | it("should execute", async () => { 13 | const action = new ProcessBlockAction(); 14 | 15 | await action.execute({ blockProcessor, block }); 16 | 17 | expect(blockProcessor.process).toHaveBeenCalledWith(block); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/commands/__stubs__/command-without-definition.ts: -------------------------------------------------------------------------------- 1 | import { Commands, Container } from "@arkecosystem/core-cli"; 2 | 3 | @Container.injectable() 4 | export class CommandWithoutDefinition extends Commands.Command { 5 | public signature: string = "config:cli"; 6 | public description: string = "Update the CLI configuration."; 7 | 8 | public async execute(): Promise { 9 | // Do nothing... 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/commands/dist/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Commands: [ 3 | require('./hidden').Command, 4 | require('./visible').Command, 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/input/parser.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { InputParser } from "@packages/core-cli/src/input"; 4 | 5 | describe("InputParser", () => { 6 | it("should parse the arguments and flags", () => { 7 | const { args, flags } = InputParser.parseArgv(["env:set", "john", "doe", "--force"]); 8 | 9 | expect(args).toEqual(["env:set", "john", "doe"]); 10 | expect(flags.force).toBeTrue(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/services/__fixtures__/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | forger: { 3 | plugins: [{ package: "@arkecosystem/core-forger" }], 4 | }, 5 | relay: { 6 | plugins: [{ package: "@arkecosystem/core-forger" }], 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/services/plugins/@namespace/package2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@namespace/package2", 3 | "version": "2.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/services/plugins/package1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "package1", 3 | "version": "1.0.0" 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-cli/services/source-providers/invalid-utils-0.9.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/unit/core-cli/services/source-providers/invalid-utils-0.9.1.tgz -------------------------------------------------------------------------------- /__tests__/unit/core-cli/services/source-providers/missing-utils-0.9.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/unit/core-cli/services/source-providers/missing-utils-0.9.1.tgz -------------------------------------------------------------------------------- /__tests__/unit/core-cli/services/source-providers/utils-0.9.1.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/unit/core-cli/services/source-providers/utils-0.9.1.tgz -------------------------------------------------------------------------------- /__tests__/unit/core-cli/utils/__fixtures__/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | forger: { 3 | plugins: [{ package: "@arkecosystem/core-forger" }], 4 | }, 5 | relay: { 6 | plugins: [{ package: "@arkecosystem/core-forger" }], 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-forger/mocks/nes.ts: -------------------------------------------------------------------------------- 1 | export const nesClient = { 2 | connect: jest.fn().mockReturnValue(new Promise((resolve) => resolve())), 3 | disconnect: jest.fn(), 4 | request: jest.fn().mockReturnValue({ payload: Buffer.from(JSON.stringify({})) }), 5 | onError: jest.fn(), 6 | _isReady: jest.fn().mockReturnValue(true), 7 | setMaxPayload: jest.fn(), 8 | }; 9 | 10 | export default { 11 | Client: jest.fn().mockImplementation(() => nesClient), 12 | }; 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-empty/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/unit/core-kernel/__stubs__/config-empty/.gitkeep -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-app/.env: -------------------------------------------------------------------------------- 1 | key=value -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-app/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | core: { plugins: [] }, 3 | relay: { plugins: [] }, 4 | }; 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-app/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-app/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-delegates/.env: -------------------------------------------------------------------------------- 1 | key=value -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-delegates/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | core: { plugins: [] }, 3 | relay: { plugins: [] }, 4 | forger: { plugins: [] }, 5 | }; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-delegates/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": {} 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-delegates/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-peers/.env: -------------------------------------------------------------------------------- 1 | key=value -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-peers/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | core: { plugins: [] }, 3 | relay: { plugins: [] }, 4 | forger: { plugins: [] }, 5 | }; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-peers/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-invalid-peers/peers.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-with-crypto/.env: -------------------------------------------------------------------------------- 1 | key=value -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-with-crypto/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | core: { plugins: [] }, 3 | relay: { plugins: [] }, 4 | forger: { plugins: [] }, 5 | }; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-with-crypto/crypto/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-with-crypto/crypto/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "unitnet", 3 | "messagePrefix": "UNIT message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 23, 9 | "nethash": "a63b5a3858afbca23edefac885be74d59f1a26985548a4082f4f479e74fcc348", 10 | "wif": 186, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "UARK", 15 | "symbol": "UѦ", 16 | "explorer": "http://uexplorer.ark.io" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-with-crypto/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config-with-crypto/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config/.env: -------------------------------------------------------------------------------- 1 | key=value -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | core: { plugins: [] }, 3 | relay: { plugins: [] }, 4 | forger: { plugins: [] }, 5 | }; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/config/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin-with-defaults/dist/defaults.js: -------------------------------------------------------------------------------- 1 | module.exports = { defaults: { defaultKey: "defaultValue" } } 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin-with-defaults/dist/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | ServiceProvider 3 | } = require('./service-provider') 4 | const { 5 | defaults 6 | } = require('defaults') 7 | 8 | exports.defaults = defaults; 9 | exports.ServiceProvider = ServiceProvider; 10 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin-with-defaults/dist/service-provider.js: -------------------------------------------------------------------------------- 1 | const { 2 | Providers 3 | } = require("@arkecosystem/core-kernel"); 4 | 5 | class ServiceProvider extends Providers.ServiceProvider { 6 | async register() { 7 | // 8 | } 9 | 10 | async boot() { 11 | // 12 | } 13 | 14 | async dispose() { 15 | // 16 | } 17 | 18 | configDefaults() { 19 | return { 20 | key: "value" 21 | }; 22 | } 23 | } 24 | 25 | exports.ServiceProvider = ServiceProvider; 26 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin-with-defaults/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stub-plugin-with-defaults", 3 | "version": "1.0.0", 4 | "main": "dist/index" 5 | } 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin/dist/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | ServiceProvider 3 | } = require('./service-provider') 4 | 5 | exports.ServiceProvider = ServiceProvider; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin/dist/service-provider.js: -------------------------------------------------------------------------------- 1 | const { 2 | Providers 3 | } = require("@arkecosystem/core-kernel"); 4 | 5 | class ServiceProvider extends Providers.ServiceProvider { 6 | async register() { 7 | // 8 | } 9 | 10 | async boot() { 11 | // 12 | } 13 | 14 | async dispose() { 15 | // 16 | } 17 | } 18 | 19 | exports.ServiceProvider = ServiceProvider; 20 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/__stubs__/stub-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stub-plugin", 3 | "version": "1.0.0", 4 | "main": "dist/index", 5 | "arkecosystem": { 6 | "core": { 7 | "required": true, 8 | "alias": "some-alias", 9 | "dependencies": [ 10 | { 11 | "name": "some-dependency" 12 | } 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /__tests__/unit/core-kernel/utils/format-timestamp.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { formatTimestamp } from "@packages/core-kernel/src/utils/format-timestamp"; 4 | 5 | describe("Format Timestamp", () => { 6 | it("should compute the correct epoch value", () => { 7 | expect(formatTimestamp(100).epoch).toBe(100); 8 | }); 9 | 10 | it("should compute the correct unix value", () => { 11 | expect(formatTimestamp(100).unix).toBe(1490101300); 12 | }); 13 | 14 | it("should compute the correct human value", () => { 15 | expect(formatTimestamp(100).human).toBe("2017-03-21T13:01:40.000Z"); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /__tests__/unit/core-magistrate-transactions/handlers/__fixtures__/entity/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./register"; 2 | export * from "./resign"; 3 | export * from "./update"; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-magistrate-transactions/handlers/__fixtures__/index.ts: -------------------------------------------------------------------------------- 1 | import * as Assets from "./assets"; 2 | import * as Entity from "./entity"; 3 | 4 | export { Assets, Entity }; 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-magistrate-transactions/handlers/__mocks__/transaction-error.ts: -------------------------------------------------------------------------------- 1 | export class TransactionError { 2 | 3 | } -------------------------------------------------------------------------------- /__tests__/unit/core-magistrate-transactions/handlers/__mocks__/transaction-reader.ts: -------------------------------------------------------------------------------- 1 | export const transactionReader = { 2 | read: () => {}, 3 | } -------------------------------------------------------------------------------- /__tests__/unit/core-magistrate-transactions/handlers/__mocks__/wallet-repository.ts: -------------------------------------------------------------------------------- 1 | export const walletRepository = { 2 | findByPublicKey: (publicKey) => {}, 3 | index: () => {}, 4 | allByIndex: () => [], 5 | hasByIndex: () => false, 6 | setOnIndex: () => {}, 7 | forgetOnIndex: () => {}, 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/fixtures/peers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { "ip": "187.177.54.44", "port": 4000 }, 3 | { "ip": "188.177.54.44", "port": 4000 }, 4 | { "ip": "189.177.54.44", "port": 4000 }, 5 | { "ip": "190.177.54.44", "port": 4000 } 6 | ] 7 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/hapi.ts: -------------------------------------------------------------------------------- 1 | export class HapiServer { 2 | public start() { 3 | return; 4 | } 5 | public stop() { 6 | return; 7 | } 8 | 9 | public inject() { 10 | return; 11 | } 12 | 13 | public route() { 14 | return; 15 | } 16 | 17 | public register() { 18 | return; 19 | } 20 | } 21 | 22 | export default { 23 | Server: jest.fn().mockImplementation(() => new HapiServer()), 24 | }; 25 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/nes.ts: -------------------------------------------------------------------------------- 1 | export class NesClient { 2 | public connect() { 3 | return; 4 | } 5 | public disconnect() { 6 | return; 7 | } 8 | public terminate() { 9 | return; 10 | } 11 | 12 | public request() { 13 | return; 14 | } 15 | } 16 | 17 | export default { 18 | Client: jest.fn().mockImplementation((url) => new NesClient()), 19 | }; 20 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/socket-server/utils/map-addr.test.ts: -------------------------------------------------------------------------------- 1 | import { mapAddr } from "@arkecosystem/core-p2p/src/socket-server/utils/map-addr"; 2 | 3 | describe("mapAddr", () => { 4 | it("should map IP 'v6' to IP v4 counterpart", () => { 5 | const ipv6 = "::ffff:192.168.1.1"; 6 | const ipv4 = "192.168.1.1"; 7 | expect(mapAddr(ipv6)).toBe(ipv4); 8 | }); 9 | 10 | it("should map a real IP v6 to itself", () => { 11 | const ipv6 = "2001:db8:3312::1"; 12 | expect(mapAddr(ipv6)).toBe(ipv6); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/utils/build-rate-limiter.test.ts: -------------------------------------------------------------------------------- 1 | import { buildRateLimiter } from "@packages/core-p2p/src/utils/build-rate-limiter"; 2 | import { RateLimiter } from "@packages/core-p2p/src/rate-limiter"; 3 | 4 | describe("buildRateLimiter", () => { 5 | it("should return instance of RateLimiter", () => { 6 | const rateLimiter = buildRateLimiter({ whitelist: [], remoteAccess: [] }); 7 | 8 | expect(rateLimiter).toBeInstanceOf(RateLimiter); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/utils/check-dns.test.ts: -------------------------------------------------------------------------------- 1 | import { checkDNS } from "@arkecosystem/core-p2p/src/utils/check-dns"; 2 | 3 | const app = { 4 | log: { error: jest.fn() }, 5 | } as any; 6 | 7 | describe("Check DNS", () => { 8 | it("should be ok", async () => { 9 | const response = await checkDNS(app, ["1.1.1.1"]); 10 | expect(response).toBe("1.1.1.1"); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-snapshots/__fixtures__/1-52/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "blocks": { "count": 51, "start": 1, "end": 52 }, 3 | "transactions": { "count": 153, "start": 0, "end": 98136840 }, 4 | "rounds": { "count": 51, "start": 1, "end": 2 }, 5 | "folder": "1-52", 6 | "skipCompression": true, 7 | "network": "testnet", 8 | "packageVersion": "3.0.0-next.0", 9 | "codec": "json" 10 | } 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-snapshots/__fixtures__/1-52/transactions: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/__tests__/unit/core-snapshots/__fixtures__/1-52/transactions -------------------------------------------------------------------------------- /__tests__/unit/core-snapshots/__fixtures__/index.ts: -------------------------------------------------------------------------------- 1 | import * as Assets from "./assets"; 2 | 3 | export { Assets }; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-snapshots/workers/actions/__support__/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./helper"; 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/__utils__/compact.ts: -------------------------------------------------------------------------------- 1 | function compact(array) { 2 | let resIndex = 0; 3 | const result = []; 4 | 5 | if (array == null) { 6 | return result; 7 | } 8 | 9 | for (const value of array) { 10 | if (value) { 11 | result[resIndex++] = value; 12 | } 13 | } 14 | return result; 15 | } 16 | 17 | export default compact; 18 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/__utils__/make-vote-transactions.ts: -------------------------------------------------------------------------------- 1 | import { Transactions } from "@packages/crypto"; 2 | import { ITransaction } from "@packages/crypto/dist/interfaces"; 3 | 4 | export const makeVoteTransactions = (length: number, voteAssets: string[]): ITransaction[] => { 5 | const txs: ITransaction[] = []; 6 | for (let i = 0; i < length; i++) { 7 | txs[i] = Transactions.BuilderFactory.vote().sign(Math.random().toString(36)).votesAsset(voteAssets).build(); 8 | } 9 | return txs; 10 | }; 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/__utils__/transactions.ts: -------------------------------------------------------------------------------- 1 | import { IBlock, ITransaction } from "@packages/crypto/dist/interfaces"; 2 | 3 | export const addTransactionsToBlock = (txs: ITransaction[], block: IBlock) => { 4 | const { data } = block; 5 | data.transactions = []; 6 | txs.forEach((tx) => data.transactions?.push(tx.data)); 7 | data.transactions.push(txs[0].data); 8 | data.transactions.push(txs[1].data); 9 | data.transactions.push(txs[2].data); 10 | data.numberOfTransactions = txs.length; // NOTE: if transactions are added to a fixture the NoT needs to be increased 11 | block.transactions = txs; 12 | }; 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/__utils__/unique.ts: -------------------------------------------------------------------------------- 1 | export default (array: Array) => [...new Set(array)]; 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-test-framework/internal/delegates.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { delegates } from "@packages/core-test-framework/src/internal/delegates"; 4 | 5 | describe("Delegates", () => { 6 | it("should create delegates from passphrases", async () => { 7 | expect(delegates.length).toBeGreaterThan(1); 8 | delegates.forEach((delegate) => { 9 | expect(delegate.passphrase).toBeString(); 10 | expect(delegate.address).toBeString(); 11 | expect(delegate.publicKey).toBeString(); 12 | expect(delegate.privateKey).toBeString(); 13 | expect(delegate.wif).toBeString(); 14 | }); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /__tests__/unit/core-transaction-pool/worker-script.test.ts: -------------------------------------------------------------------------------- 1 | describe("worker-script.ts", () => { 2 | it("should not crash", () => { 3 | const check = () => require("../../../packages/core-transaction-pool/src/worker-script"); 4 | expect(check).not.toThrow(); 5 | }); 6 | }); 7 | -------------------------------------------------------------------------------- /__tests__/unit/core-transactions/handlers/__fixtures__/htlc-secrets.ts: -------------------------------------------------------------------------------- 1 | export const htlcSecretHex = "c27f1ce845d8c29eebc9006be932b604fd06755521b1a8b0be4204c65377151a"; 2 | 3 | export const htlcSecretHashHex = "9c1a3815d49e0c9f78b872bfb017e825ea2db708158b70815526a830c85912b4"; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-webhooks/__fixtures__/assets.ts: -------------------------------------------------------------------------------- 1 | import { Webhook } from "@packages/core-webhooks/src/interfaces"; 2 | 3 | export const dummyWebhook: Webhook = { 4 | id: "id", 5 | token: "token", 6 | event: "event", 7 | target: "target", 8 | enabled: true, 9 | // conditions: [ 10 | // { 11 | // key: "key", 12 | // value: "value", 13 | // condition: "condition", 14 | // }, 15 | // ], 16 | conditions: [], 17 | }; 18 | -------------------------------------------------------------------------------- /__tests__/unit/core/commands/core-log.test.ts: -------------------------------------------------------------------------------- 1 | import { Console } from "@arkecosystem/core-test-framework"; 2 | import { Command } from "@packages/core/src/commands/core-log"; 3 | 4 | let cli; 5 | beforeEach(() => (cli = new Console())); 6 | 7 | describe("LogCommand", () => { 8 | it("should throw if the process does not exist", async () => { 9 | await expect(cli.execute(Command)).rejects.toThrow('The "ark-core" process does not exist.'); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /__tests__/unit/core/commands/forger-log.test.ts: -------------------------------------------------------------------------------- 1 | import { Console } from "@arkecosystem/core-test-framework"; 2 | import { Command } from "@packages/core/src/commands/forger-log"; 3 | 4 | let cli; 5 | beforeEach(() => (cli = new Console())); 6 | 7 | describe("LogCommand", () => { 8 | it("should throw if the process does not exist", async () => { 9 | await expect(cli.execute(Command)).rejects.toThrow('The "ark-forger" process does not exist.'); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /__tests__/unit/core/commands/relay-share.test.ts: -------------------------------------------------------------------------------- 1 | import { Console } from "@arkecosystem/core-test-framework"; 2 | import { Command } from "@packages/core/src/commands/relay-share"; 3 | import ngrok from "ngrok"; 4 | 5 | let cli; 6 | beforeEach(() => (cli = new Console())); 7 | 8 | describe("ShareCommand", () => { 9 | it("should throw if the process does not exist", async () => { 10 | const spyConnect = jest.spyOn(ngrok, "connect").mockImplementation(undefined); 11 | 12 | await cli.execute(Command); 13 | 14 | expect(spyConnect).toHaveBeenCalledWith({ 15 | addr: 4003, 16 | proto: "http", 17 | region: "eu", 18 | }); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /__tests__/unit/core/commands/uninstall.test.ts: -------------------------------------------------------------------------------- 1 | import { Console } from "@arkecosystem/core-test-framework"; 2 | import { Command } from "@packages/core/src/commands/uninstall"; 3 | 4 | let cli; 5 | beforeEach(() => (cli = new Console())); 6 | 7 | describe("UninstallCommand", () => { 8 | it("should throw since the command is not implemented", async () => { 9 | await expect(cli.execute(Command)).rejects.toThrow("This command has not been implemented."); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /__tests__/unit/core/commands/version.test.ts: -------------------------------------------------------------------------------- 1 | import { Console } from "@arkecosystem/core-test-framework"; 2 | import { Command } from "@packages/core/src/commands/version"; 3 | 4 | let cli; 5 | beforeEach(() => (cli = new Console())); 6 | 7 | describe("VersionCommand", () => { 8 | it("should throw since the command is not implemented", async () => { 9 | const spyConsoleLog = jest.spyOn(console, "log"); 10 | 11 | await cli.execute(Command); 12 | expect(spyConsoleLog).toHaveBeenCalledWith(cli.pkg.version); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /__tests__/unit/core/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "dummyToken", 3 | "network": "testnet" 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/unit/core/internal/__fixtures__/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | forger: { 3 | plugins: [{ package: "@arkecosystem/core-forger" }], 4 | }, 5 | relay: { 6 | plugins: [{ package: "@arkecosystem/core-forger" }], 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/blocks/__fixtures__/wallet.ts: -------------------------------------------------------------------------------- 1 | import { Wallets } from "@arkecosystem/core-state"; 2 | 3 | import { BigNumber } from "../../../../../packages/crypto/src/utils"; 4 | 5 | export const wallet = { 6 | address: "DTRdbaUW3RQQSL5By4G43JVaeHiqfVp9oh", 7 | balance: BigNumber.make(4527654310), 8 | publicKey: "034da006f958beba78ec54443df4a3f52237253f7ae8cbdb17dccf3feaa57f3126", 9 | } as Wallets.Wallet; 10 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/constants.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import * as constants from "@packages/crypto/src/constants"; 4 | 5 | describe("Constants", () => { 6 | it("satoshi is valid", () => { 7 | expect(constants.SATOSHI).toBeDefined(); 8 | expect(constants.SATOSHI).toBe(100000000); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/crypto/fixtures/crypto.json: -------------------------------------------------------------------------------- 1 | { 2 | "ripemd160": "a830d7beb04eb7549ce990fb7dc962e499a27230", 3 | "sha1": "0a4d55a8d778e5022fab701977c5d840bbc486d0", 4 | "sha256": "a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e", 5 | "hash160": "bdfb69557966d026975bebe914692bf08490d8ca", 6 | "hash256": "42a873ac3abd02122d27e80486c6fa1ef78694e8505fcec9cbcc8a7728ba8949" 7 | } 8 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/identities/fixture.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "privateKey": "d8839c2432bfd0a67ef10a804ba991eabba19f154a3d707917681d45822a5712", 4 | "publicKey": "034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192", 5 | "address": "D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib", 6 | "wif": "SGq4xLgZKCGxs7bjmwnBrWcT4C1ADFEermj846KC97FSv1WFD1dA" 7 | }, 8 | "passphrase": "this is a top secret passphrase" 9 | } 10 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/identities/private-key.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { PrivateKey } from "../../../../packages/crypto/src/identities/private-key"; 4 | import { data, passphrase } from "./fixture.json"; 5 | 6 | describe("Identities - Private Key", () => { 7 | describe("fromPassphrase", () => { 8 | it("should be OK", () => { 9 | expect(PrivateKey.fromPassphrase(passphrase)).toBe(data.privateKey); 10 | }); 11 | }); 12 | 13 | describe("fromWIF", () => { 14 | it("should be OK", () => { 15 | expect(PrivateKey.fromWIF(data.wif)).toBe(data.privateKey); 16 | }); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/identities/wif.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { WIF } from "../../../../packages/crypto/src/identities/wif"; 4 | import { data, passphrase } from "./fixture.json"; 5 | 6 | describe("Identities - WIF", () => { 7 | describe("fromPassphrase", () => { 8 | it("should be OK", () => { 9 | expect(WIF.fromPassphrase(passphrase)).toBe(data.wif); 10 | }); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/transactions/__fixtures__/htlc.ts: -------------------------------------------------------------------------------- 1 | export const htlcSecretHex = "c27f1ce845d8c29eebc9006be932b604fd06755521b1a8b0be4204c65377151a"; 2 | // SHA256(c2 7f ...) = 9c 1a ... 3 | export const htlcSecretHashHex = "9c1a3815d49e0c9f78b872bfb017e825ea2db708158b70815526a830c85912b4"; 4 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/transactions/__fixtures__/wallet.ts: -------------------------------------------------------------------------------- 1 | import { Wallets } from "@arkecosystem/core-state"; 2 | import { Utils } from "@arkecosystem/crypto"; 3 | 4 | export const wallet = { 5 | address: "ANBkoGqWeTSiaEVgVzSKZd3jS7UWzv9PSo", 6 | balance: Utils.BigNumber.make(4527654310), 7 | publicKey: "03287bfebba4c7881a0509717e71b34b63f31e40021c321f89ae04f84be6d6ac37", 8 | } as Wallets.Wallet; 9 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/utils/network-list.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { parse } from "path"; 4 | import tg from "tiny-glob/sync"; 5 | 6 | const entries = tg("../../../../packages/crypto/src/networks/**/*.json", { cwd: __dirname }); 7 | 8 | const NETWORKS = {}; 9 | entries.forEach((file) => { 10 | NETWORKS[parse(file).name] = require(file); 11 | }); 12 | 13 | const NETWORKS_LIST = []; 14 | entries.forEach((file) => NETWORKS_LIST.push(require(file))); 15 | 16 | module.exports = { NETWORKS, NETWORKS_LIST }; 17 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/utils/number-to-hex.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import { numberToHex } from "../../../../packages/crypto/src/utils"; 4 | 5 | describe("NumberToHex", () => { 6 | it("should be ok", () => { 7 | expect(numberToHex(10)).toBe("0a"); 8 | expect(numberToHex(1)).toBe("01"); 9 | expect(numberToHex(16)).toBe("10"); 10 | expect(numberToHex(16, 4)).toBe("0010"); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/banner.png -------------------------------------------------------------------------------- /benchmark/block/deserialize/0.js: -------------------------------------------------------------------------------- 1 | const { 2 | deserialize 3 | } = require('./methods') 4 | 5 | const data = require('../../helpers').getFixture('block/serialized/no-transactions.txt'); 6 | 7 | exports['core'] = () => { 8 | return deserialize(data); 9 | }; 10 | -------------------------------------------------------------------------------- /benchmark/block/deserialize/150.js: -------------------------------------------------------------------------------- 1 | const { 2 | deserialize 3 | } = require('./methods') 4 | 5 | const data = require('../../helpers').getFixture('block/serialized/transactions.txt'); 6 | 7 | exports['core'] = () => { 8 | return deserialize(data); 9 | }; 10 | -------------------------------------------------------------------------------- /benchmark/block/deserialize/methods.js: -------------------------------------------------------------------------------- 1 | const { 2 | Blocks 3 | } = require('@arkecosystem/crypto') 4 | 5 | exports.deserialize = data => { 6 | return Blocks.Deserializer.deserialize(data) 7 | } 8 | -------------------------------------------------------------------------------- /benchmark/block/serialize.js: -------------------------------------------------------------------------------- 1 | const { 2 | Blocks 3 | } = require('@arkecosystem/crypto') 4 | 5 | const data = require('../helpers').getJSONFixture('block/deserialized/no-transactions'); 6 | 7 | exports['core'] = () => { 8 | return Blocks.Serializer.serialize(data); 9 | }; 10 | -------------------------------------------------------------------------------- /benchmark/block/serializeWithTransactions.js: -------------------------------------------------------------------------------- 1 | const { 2 | Blocks 3 | } = require('@arkecosystem/crypto') 4 | 5 | const data = require('../helpers').getJSONFixture('block/deserialized/transactions'); 6 | 7 | exports['core'] = () => { 8 | return Blocks.Serializer.serializeWithTransactions(data); 9 | }; 10 | -------------------------------------------------------------------------------- /benchmark/fixtures/block/serialized/no-transactions.txt: -------------------------------------------------------------------------------- 1 | 0000000052f0760313000000a099b7651f0e5eb89600000000ac23fc06000000002f6859000000000000000000000000c0120000e5a7e9b5a8a8e2f47f7d8a532e0e9c43d44052dc6c6339ad57246e9a339665e303a46f2547d20b47003c1c376788db5a54d67264df2ae914f70bf453b6a1fa1b3a304402204e31f1ae02cbcf2bb936e225f9f9db332ac275577b777a389b2d713e48b78c9002203f11c4ee0d30d2e10b2cb4a7fb59569e761571971ffe1be5abaa32fdc42a056b 2 | -------------------------------------------------------------------------------- /benchmark/fixtures/transaction/serialized/0.txt: -------------------------------------------------------------------------------- 1 | ff0117004df0760303d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c35780969800000000000d5472616e73616374696f6e203700c2eb0b00000000000000001759e7dc56557733804418f0ea6fd3b2573a9aabdd3045022100bac5b7699748a891b39ff5439e16ea1a694e93954b248be6b8082da01e5386310220129eb06a58b9f80d36ea3cdc903e6cc0240bbe1d371339ffe15c87742af1427d 2 | -------------------------------------------------------------------------------- /benchmark/helpers.js: -------------------------------------------------------------------------------- 1 | const { readFileSync } = require("fs"); 2 | const { resolve } = require("path"); 3 | 4 | exports.createBlocks = count => new Array(count).fill(require("./fixtures/block")); 5 | 6 | exports.getFixture = value => readFileSync(resolve(__dirname, `./fixtures/${value}`)).toString().trim(); 7 | 8 | exports.getJSONFixture = value => require(resolve(__dirname, `./fixtures/${value}`)); 9 | -------------------------------------------------------------------------------- /benchmark/transaction/deserialize/0.js: -------------------------------------------------------------------------------- 1 | const { 2 | deserialize 3 | } = require('./methods') 4 | 5 | const data = require('../../helpers').getFixture('transaction/serialized/0.txt'); 6 | 7 | exports['core'] = () => { 8 | return deserialize(data); 9 | }; 10 | -------------------------------------------------------------------------------- /benchmark/transaction/deserialize/methods.js: -------------------------------------------------------------------------------- 1 | const { 2 | Transactions 3 | } = require('@arkecosystem/crypto') 4 | 5 | exports.deserialize = data => { 6 | return Transactions.Deserializer.deserialize(data) 7 | } 8 | -------------------------------------------------------------------------------- /benchmark/transaction/serialize/0.js: -------------------------------------------------------------------------------- 1 | const { 2 | Transactions 3 | } = require('@arkecosystem/crypto') 4 | 5 | const data = require('../../helpers').getJSONFixture('transaction/deserialized/0'); 6 | 7 | exports['core'] = () => { 8 | return Transactions.Utils.toBytes(data); 9 | }; 10 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ["@commitlint/config-conventional"], 3 | }; 4 | -------------------------------------------------------------------------------- /docker/production/ark-core-docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/docker/production/ark-core-docker.png -------------------------------------------------------------------------------- /docker/production/devnet/devnet.env: -------------------------------------------------------------------------------- 1 | #MODE must be one of: relay or forger 2 | #relay: start a relay node only 3 | #forger: start relay and forger 4 | MODE=relay 5 | NETWORK=devnet 6 | #Core variables 7 | CORE_LOG_LEVEL=debug 8 | CORE_LOG_LEVEL_FILE=info 9 | CORE_DB_HOST=postgres-devnet 10 | CORE_DB_USERNAME=node 11 | CORE_DB_PASSWORD=password 12 | CORE_DB_DATABASE=core_devnet 13 | CORE_P2P_HOST=0.0.0.0 14 | CORE_P2P_PORT=4002 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | CORE_WEBHOOKS_HOST=0.0.0.0 18 | CORE_WEBHOOKS_PORT=4004 19 | -------------------------------------------------------------------------------- /docker/production/devnet/purge_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker stop $(docker ps -aq) 4 | docker rm $(docker ps -aq) 5 | docker rmi $(docker images -q) 6 | docker volume prune -f 7 | docker network prune -f 8 | -------------------------------------------------------------------------------- /docker/production/mainnet/mainnet.env: -------------------------------------------------------------------------------- 1 | #MODE must be one of: relay or forger 2 | #relay: start a relay node only 3 | #forger: start relay and forger 4 | MODE=relay 5 | NETWORK=mainnet 6 | #Core variables 7 | CORE_LOG_LEVEL=info 8 | CORE_LOG_LEVEL_FILE=info 9 | CORE_DB_HOST=postgres-mainnet 10 | CORE_DB_USERNAME=node 11 | CORE_DB_PASSWORD=password 12 | CORE_DB_DATABASE=core_mainnet 13 | CORE_P2P_HOST=0.0.0.0 14 | CORE_P2P_PORT=4001 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | CORE_WEBHOOKS_HOST=0.0.0.0 18 | CORE_WEBHOOKS_PORT=4004 19 | -------------------------------------------------------------------------------- /docker/production/mainnet/purge_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker stop $(docker ps -aq) 4 | docker rm $(docker ps -aq) 5 | docker rmi $(docker images -q) 6 | docker volume prune -f 7 | docker network prune -f 8 | -------------------------------------------------------------------------------- /docker/production/purge_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker stop $(docker ps -aq) 4 | docker rm $(docker ps -aq) 5 | docker rmi $(docker images -q) 6 | docker volume prune -f 7 | docker network prune -f 8 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "npmClient": "yarn", 3 | "packages": [ 4 | "packages/*", 5 | "plugins/*" 6 | ], 7 | "version": "3.9.1", 8 | "$schema": "node_modules/lerna/schemas/lerna-schema.json" 9 | } 10 | -------------------------------------------------------------------------------- /packages/core-api/src/identifiers.ts: -------------------------------------------------------------------------------- 1 | export const Identifiers = { 2 | HTTP: Symbol.for("API"), 3 | HTTPS: Symbol.for("API"), 4 | 5 | WalletSearchService: Symbol.for("API"), 6 | DelegateSearchService: Symbol.for("API"), 7 | LockSearchService: Symbol.for("API"), 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Contracts from "./interfaces"; 2 | export * as Schemas from "./schemas"; 3 | export * as Resources from "./resources-new"; 4 | 5 | export * from "./controllers/controller"; 6 | export * from "./services"; 7 | export * from "./identifiers"; 8 | export * from "./server"; 9 | export * from "./service-provider"; 10 | -------------------------------------------------------------------------------- /packages/core-api/src/plugins/pagination/config.ts: -------------------------------------------------------------------------------- 1 | // Based on https://github.com/fknop/hapi-pagination 2 | 3 | import Joi from "joi"; 4 | 5 | export const getConfig = (options) => { 6 | const { error, value } = Joi.object({ 7 | query: Joi.object({ 8 | limit: Joi.object({ 9 | default: Joi.number().integer().positive().default(100), 10 | }), 11 | }), 12 | }).validate(options); 13 | 14 | /* istanbul ignore next */ 15 | return { error: error || undefined, config: error ? undefined : value }; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/core-api/src/plugins/pagination/index.ts: -------------------------------------------------------------------------------- 1 | // Based on https://github.com/fknop/hapi-pagination 2 | 3 | import { getConfig } from "./config"; 4 | import { Ext } from "./ext"; 5 | 6 | exports.plugin = { 7 | name: "hapi-pagination", 8 | version: "1.0.0", 9 | register(server, options) { 10 | const { error, config } = getConfig(options); 11 | 12 | if (error) { 13 | throw error; 14 | } 15 | 16 | const ext = new Ext(config); 17 | 18 | server.ext("onPreHandler", (request, h) => ext.onPreHandler(request, h)); 19 | server.ext("onPostHandler", (request, h) => ext.onPostHandler(request, h)); 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /packages/core-api/src/resources-new/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block"; 2 | export * from "./delegate"; 3 | export * from "./lock"; 4 | export * from "./transaction"; 5 | export * from "./wallet"; 6 | -------------------------------------------------------------------------------- /packages/core-api/src/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block-with-transactions"; 2 | export * from "./block"; 3 | export * from "./fee-statistics"; 4 | export * from "./peer"; 5 | export * from "./ports"; 6 | export * from "./round"; 7 | export * from "./transaction-with-block"; 8 | export * from "./transaction"; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/routes/blockchain.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | 3 | import { BlockchainController } from "../controllers/blockchain"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | const controller = server.app.app.resolve(BlockchainController); 7 | server.bind(controller); 8 | 9 | server.route({ 10 | method: "GET", 11 | path: "/blockchain", 12 | handler: (request: Hapi.Request) => controller.index(request), 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-api/src/services/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./wallet-search-service"; 2 | export * from "./delegate-search-service"; 3 | export * from "./lock-search-service"; 4 | -------------------------------------------------------------------------------- /packages/core-api/src/utils/get-ip.ts: -------------------------------------------------------------------------------- 1 | import { Request } from "@hapi/hapi"; 2 | 3 | export const getIp = (request: Request, trustProxy: boolean): string => { 4 | if (trustProxy) { 5 | return request.headers["x-forwarded-for"]?.split(",")[0]?.trim() ?? request.info.remoteAddress; 6 | } 7 | 8 | return request.info.remoteAddress; 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-api/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./get-ip" 2 | -------------------------------------------------------------------------------- /packages/core-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/actions/index.ts: -------------------------------------------------------------------------------- 1 | export { ProcessBlockAction } from "./process-block"; 2 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/actions/process-block.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | import { BlockProcessor, BlockProcessorResult } from "../processor"; 5 | 6 | export class ProcessBlockAction extends Services.Triggers.Action { 7 | public async execute(args: Types.ActionArguments): Promise { 8 | const blockProcessor: BlockProcessor = args.blockProcessor; 9 | const block: Interfaces.IBlock = args.block; 10 | 11 | return blockProcessor.process(block); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | fastSync: !!process.env.CORE_BLOCKCHAIN_FAST_SYNC, // Improves sync rate for readonly nodes, that have a p2p port closed to public. Such node doesn't broadcast data 3 | databaseRollback: { 4 | maxBlockRewind: 10000, 5 | steps: 1000, 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./defaults"; 2 | export * from "./blockchain"; 3 | export * from "./service-provider"; 4 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/contracts.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | import { BlockProcessorResult } from "./block-processor"; 4 | 5 | export interface BlockHandler { 6 | execute(block?: Interfaces.IBlock): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accept-block-handler"; 2 | export * from "./already-forged-handler"; 3 | export * from "./exception-handler"; 4 | export * from "./incompatible-transactions-handler"; 5 | export * from "./invalid-generator-handler"; 6 | export * from "./nonce-out-of-order-handler"; 7 | export * from "./revert-block-handler"; 8 | export * from "./unchained-handler"; 9 | export * from "./verification-failed-handler"; 10 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/index.ts: -------------------------------------------------------------------------------- 1 | export * from "../processor/block-processor"; 2 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/state-machine/actions/check-last-block-synced.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | import { Action } from "../contracts"; 4 | 5 | @Container.injectable() 6 | export class CheckLastBlockSynced implements Action { 7 | @Container.inject(Container.Identifiers.Application) 8 | public readonly app!: Contracts.Kernel.Application; 9 | 10 | @Container.inject(Container.Identifiers.BlockchainService) 11 | private readonly blockchain!: Contracts.Blockchain.Blockchain; 12 | 13 | public async handle(): Promise { 14 | this.blockchain.dispatch(this.blockchain.isSynced() ? "SYNCED" : "NOTSYNCED"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/state-machine/actions/download-paused.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | import { Action } from "../contracts"; 4 | 5 | @Container.injectable() 6 | export class DownloadPaused implements Action { 7 | @Container.inject(Container.Identifiers.LogService) 8 | private readonly logger!: Contracts.Kernel.Logger; 9 | 10 | public async handle(): Promise { 11 | this.logger.info("Blockchain download paused"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/state-machine/actions/exit-app.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | import { Action } from "../contracts"; 4 | 5 | @Container.injectable() 6 | export class ExitApp implements Action { 7 | @Container.inject(Container.Identifiers.Application) 8 | public readonly app!: Contracts.Kernel.Application; 9 | 10 | public async handle(): Promise { 11 | this.app.terminate("Failed to startup blockchain. Exiting ARK Core!"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/state-machine/actions/stopped.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | import { Action } from "../contracts"; 4 | 5 | @Container.injectable() 6 | export class Stopped implements Action { 7 | @Container.inject(Container.Identifiers.Application) 8 | public readonly app!: Contracts.Kernel.Application; 9 | 10 | @Container.inject(Container.Identifiers.LogService) 11 | private readonly logger!: Contracts.Kernel.Logger; 12 | 13 | public async handle(): Promise { 14 | this.logger.info("The blockchain has been stopped"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/state-machine/contracts.ts: -------------------------------------------------------------------------------- 1 | export interface Action { 2 | handle(): void; 3 | } 4 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/state-machine/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./state-machine"; 2 | -------------------------------------------------------------------------------- /packages/core-blockchain/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-cli/src/actions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./abort-running-process"; 2 | export * from "./abort-errored-process"; 3 | export * from "./abort-missing-process"; 4 | export * from "./abort-stopped-process"; 5 | export * from "./abort-unknown-process"; 6 | export * from "./daemonize-process"; 7 | export * from "./restart-process"; 8 | export * from "./restart-running-process-with-prompt"; 9 | export * from "./restart-running-process"; 10 | -------------------------------------------------------------------------------- /packages/core-cli/src/commands/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./command-help"; 2 | export * from "./command"; 3 | export * from "./discover-commands"; 4 | export * from "./discover-config"; 5 | export * from "./discover-network"; 6 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/clear.ts: -------------------------------------------------------------------------------- 1 | import { injectable } from "../ioc"; 2 | 3 | /** 4 | * @export 5 | * @class Clear 6 | */ 7 | @injectable() 8 | export class Clear { 9 | /** 10 | * @static 11 | * @memberof Clear 12 | */ 13 | public render(): void { 14 | process.stdout.write("\x1b[2J"); 15 | process.stdout.write("\x1b[0f"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/info.ts: -------------------------------------------------------------------------------- 1 | import { white } from "kleur"; 2 | 3 | import { Identifiers, inject, injectable } from "../ioc"; 4 | import { Logger } from "../services"; 5 | 6 | /** 7 | * @export 8 | * @class Info 9 | */ 10 | @injectable() 11 | export class Info { 12 | /** 13 | * @private 14 | * @type {Logger} 15 | * @memberof Command 16 | */ 17 | @inject(Identifiers.Logger) 18 | private readonly logger!: Logger; 19 | 20 | /** 21 | * @static 22 | * @param {string} message 23 | * @memberof Info 24 | */ 25 | public render(message: string): void { 26 | this.logger.info(white().bgBlue(`[INFO] ${message}`)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/log.ts: -------------------------------------------------------------------------------- 1 | import { Identifiers, inject, injectable } from "../ioc"; 2 | import { Logger } from "../services"; 3 | 4 | /** 5 | * @export 6 | * @class Log 7 | */ 8 | @injectable() 9 | export class Log { 10 | /** 11 | * @private 12 | * @type {Logger} 13 | * @memberof Command 14 | */ 15 | @inject(Identifiers.Logger) 16 | private readonly logger!: Logger; 17 | 18 | /** 19 | * @static 20 | * @param {string} message 21 | * @memberof Log 22 | */ 23 | public render(message: string): void { 24 | this.logger.log(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/new-line.ts: -------------------------------------------------------------------------------- 1 | import { Identifiers, inject, injectable } from "../ioc"; 2 | import { Logger } from "../services"; 3 | 4 | /** 5 | * @export 6 | * @class NewLine 7 | */ 8 | @injectable() 9 | export class NewLine { 10 | /** 11 | * @private 12 | * @type {Logger} 13 | * @memberof Command 14 | */ 15 | @inject(Identifiers.Logger) 16 | private readonly logger!: Logger; 17 | 18 | /** 19 | * @static 20 | * @param {number} [count=1] 21 | * @memberof NewLine 22 | */ 23 | public render(count: number = 1): void { 24 | this.logger.log("\n".repeat(count)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/prompt.ts: -------------------------------------------------------------------------------- 1 | import prompts from "prompts"; 2 | import { JsonObject } from "type-fest"; 3 | 4 | import { injectable } from "../ioc"; 5 | 6 | /** 7 | * @export 8 | * @class Prompt 9 | */ 10 | @injectable() 11 | export class Prompt { 12 | /** 13 | * @static 14 | * @param {object} options 15 | * @returns {Promise} 16 | * @memberof Prompt 17 | */ 18 | public async render(options: object): Promise { 19 | return prompts(options); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/spinner.ts: -------------------------------------------------------------------------------- 1 | import ora, { Options, Ora } from "ora"; 2 | 3 | import { injectable } from "../ioc"; 4 | 5 | /** 6 | * @export 7 | * @class Spinner 8 | */ 9 | @injectable() 10 | export class Spinner { 11 | /** 12 | * @static 13 | * @param {(string | Options | undefined)} [options] 14 | * @returns {Ora} 15 | * @memberof Spinner 16 | */ 17 | public render(options?: string | Options | undefined): Ora { 18 | return ora(options); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/core-cli/src/components/task-list.ts: -------------------------------------------------------------------------------- 1 | import Listr from "listr"; 2 | 3 | import { injectable } from "../ioc"; 4 | 5 | /** 6 | * @export 7 | * @class TaskList 8 | */ 9 | @injectable() 10 | export class TaskList { 11 | /** 12 | * @static 13 | * @param {{ title: string; task: any }[]} tasks 14 | * @returns {Promise} 15 | * @memberof TaskList 16 | */ 17 | public async render(tasks: { title: string; task: any }[]): Promise { 18 | return new Listr(tasks).run(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /packages/core-cli/src/exceptions/index.ts: -------------------------------------------------------------------------------- 1 | export * as Base from "./base"; 2 | export * as Runtime from "./runtime"; 3 | -------------------------------------------------------------------------------- /packages/core-cli/src/exceptions/runtime.ts: -------------------------------------------------------------------------------- 1 | import { Exception } from "./base"; 2 | 3 | /** 4 | * @export 5 | * @class RuntimeException 6 | * @extends {Exception} 7 | */ 8 | export class RuntimeException extends Exception {} 9 | 10 | /** 11 | * @export 12 | * @class OverflowException 13 | * @extends {Exception} 14 | */ 15 | export class FatalException extends RuntimeException {} 16 | -------------------------------------------------------------------------------- /packages/core-cli/src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Actions from "./actions"; 2 | export * as Commands from "./commands"; 3 | export * as Components from "./component-factory"; 4 | export * as Contracts from "./contracts"; 5 | export * as Container from "./ioc"; 6 | export * as Plugins from "./plugins"; 7 | export * as Services from "./services"; 8 | export * as Utils from "./utils"; 9 | 10 | export * from "./application"; 11 | export * from "./input"; 12 | export * from "./output"; 13 | 14 | export * from "./action-factory"; 15 | export * from "./application-factory"; 16 | export * from "./component-factory"; 17 | -------------------------------------------------------------------------------- /packages/core-cli/src/input/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./definition"; 2 | export * from "./input"; 3 | export * from "./parser"; 4 | export * from "./validator"; 5 | -------------------------------------------------------------------------------- /packages/core-cli/src/input/parser.ts: -------------------------------------------------------------------------------- 1 | import yargs from "yargs-parser"; 2 | 3 | /** 4 | * @export 5 | * @class InputParser 6 | */ 7 | export class InputParser { 8 | /** 9 | * @static 10 | * @param {string[]} args 11 | * @returns 12 | * @memberof InputParser 13 | */ 14 | public static parseArgv(args: string[]): { args: string[]; flags: yargs.Arguments } { 15 | const parsed: yargs.Arguments = yargs(args, { count: ["v"] }); 16 | 17 | 18 | const argv = parsed._.map((argument) => argument.toString()); 19 | 20 | // @ts-ignore 21 | delete parsed._; 22 | 23 | return { args: argv, flags: parsed }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/core-cli/src/ioc/index.ts: -------------------------------------------------------------------------------- 1 | import "reflect-metadata"; 2 | 3 | export * from "inversify"; 4 | 5 | export * from "./identifiers"; 6 | -------------------------------------------------------------------------------- /packages/core-cli/src/output/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./output"; 2 | -------------------------------------------------------------------------------- /packages/core-cli/src/plugins/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./suggest"; 2 | -------------------------------------------------------------------------------- /packages/core-cli/src/services/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./config"; 2 | export * from "./environment"; 3 | export * from "./installer"; 4 | export * from "./logger"; 5 | export * from "./plugin-manager"; 6 | export * from "./process-manager"; 7 | export * from "./updater"; 8 | -------------------------------------------------------------------------------- /packages/core-cli/src/services/source-providers/contracts.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @export 3 | * @interface Source 4 | */ 5 | export interface Source { 6 | exists(value: string, version?: string): Promise; 7 | 8 | install(value: string, version?: string): Promise; 9 | 10 | update(value: string): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-cli/src/services/source-providers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./contracts"; 2 | export * from "./file"; 3 | export * from "./git"; 4 | export * from "./npm"; 5 | export * as Errors from "./errors"; 6 | -------------------------------------------------------------------------------- /packages/core-cli/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./builder"; 2 | export * from "./flags"; 3 | export * from "./process"; 4 | -------------------------------------------------------------------------------- /packages/core-cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-database/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | connection: { 3 | type: "postgres", 4 | host: process.env.CORE_DB_HOST || "localhost", 5 | port: process.env.CORE_DB_PORT || 5432, 6 | database: process.env.CORE_DB_DATABASE || `${process.env.CORE_TOKEN}_${process.env.CORE_NETWORK_NAME}`, 7 | username: process.env.CORE_DB_USERNAME || process.env.CORE_TOKEN, 8 | password: process.env.CORE_DB_PASSWORD || "password", 9 | entityPrefix: "public.", 10 | synchronize: false, 11 | logging: false, 12 | }, 13 | apiConnectionTimeout: 3000, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-database/src/events.ts: -------------------------------------------------------------------------------- 1 | export enum DatabaseEvent { 2 | PRE_CONNECT = "database.preConnect", 3 | POST_CONNECT = "database.postConnect", 4 | PRE_DISCONNECT = "database.preDisconnect", 5 | POST_DISCONNECT = "database.postDisconnect", 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-database/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./database-service"; 2 | export * from "./service-provider"; 3 | 4 | export * as Models from "./models"; 5 | export * as Repositories from "./repositories"; 6 | export * as Utils from "./utils"; 7 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20181129400000-add-block_id-index-to-transactions-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddBlockIdIndexToTransactionsTable20181129400000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | CREATE INDEX "transactions_block_id" ON transactions ("block_id"); 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | DROP INDEX "transactions_block_id"; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20181204100000-add-generator_public_key-index-to-blocks-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddGeneratorPublicKeyIndexToBlocksTable20181204100000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | CREATE INDEX "blocks_generator_public_key" ON blocks ("generator_public_key"); 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | DROP INDEX "blocks_generator_public_key"; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20181204200000-add-timestamp-index-to-blocks-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddTimestampIndexToBlocksTable20181204200000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | CREATE INDEX "transactions_timestamp" ON transactions ("timestamp"); 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | DROP INDEX "transactions_timestamp"; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20181204400000-add-recipient_id-index-to-transactions-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddRecipientIdIndexToTransactionsTable20181204400000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | CREATE INDEX "transactions_recipient_id" ON transactions ("recipient_id"); 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | DROP INDEX "transactions_recipient_id"; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20190619000000-drop-id-column-from-rounds-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class DropIdColumnFromRoundsTable20190619000000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | ALTER TABLE rounds DROP COLUMN id, ADD PRIMARY KEY (round, public_key); 7 | DROP INDEX rounds_unique; 8 | `); 9 | } 10 | 11 | public async down(queryRunner: QueryRunner): Promise {} 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20190803000000-add-type_group-column-to-transactions-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddTypeGroupColumnToTransactionsTable20190803000000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | ALTER TABLE transactions ADD COLUMN type_group INTEGER NOT NULL DEFAULT 1; 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | ALTER TABLE transactions DROP COLUMN type_group; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20190917000000-add-asset-column-to-transactions-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddAssetColumnToTransactionsTable20190917000000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | ALTER TABLE transactions ADD COLUMN asset JSONB; 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | ALTER TABLE transactions DROP COLUMN asset; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20191008000000-add-type-index-to-transactions-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddTypeIndexToTransactionsTable20191008000000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | CREATE INDEX "transactions_type" ON transactions ("type"); 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | DROP INDEX "transactions_type"; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/migrations/20200304000000-add-type_group-index-to-transactions-table.ts: -------------------------------------------------------------------------------- 1 | import { MigrationInterface, QueryRunner } from "typeorm"; 2 | 3 | export class AddTypeGroupIndexToTransactionsTable20200304000000 implements MigrationInterface { 4 | public async up(queryRunner: QueryRunner): Promise { 5 | await queryRunner.query(` 6 | CREATE INDEX transactions_type_group ON transactions(type_group); 7 | `); 8 | } 9 | 10 | public async down(queryRunner: QueryRunner): Promise { 11 | await queryRunner.query(` 12 | DROP INDEX transactions_type_group; 13 | `); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-database/src/models/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block"; 2 | export * from "./migration"; 3 | export * from "./round"; 4 | export * from "./transaction"; 5 | -------------------------------------------------------------------------------- /packages/core-database/src/models/migration.ts: -------------------------------------------------------------------------------- 1 | import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; 2 | 3 | // TODO: check if can be replaced completely by TypeORM migrations 4 | @Entity() 5 | export class Migration { 6 | @PrimaryGeneratedColumn() 7 | public id!: number; 8 | 9 | @Column() 10 | public name!: string; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-database/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | export { AbstractRepository } from "./abstract-repository"; 2 | export { BlockRepository } from "./block-repository"; 3 | export { RoundRepository } from "./round-repository"; 4 | export { TransactionRepository } from "./transaction-repository"; 5 | -------------------------------------------------------------------------------- /packages/core-database/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./query-helper"; 2 | export * from "./snake-naming-strategy"; 3 | export * from "./transform"; 4 | -------------------------------------------------------------------------------- /packages/core-database/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-forger/src/actions/index.ts: -------------------------------------------------------------------------------- 1 | export { ForgeNewBlockAction } from "./forge-new-block"; 2 | export { IsForgingAllowedAction } from "./is-forging-allowed"; 3 | -------------------------------------------------------------------------------- /packages/core-forger/src/actions/is-forging-allowed.ts: -------------------------------------------------------------------------------- 1 | import { Contracts, Services, Types } from "@arkecosystem/core-kernel"; 2 | import { ForgerService } from "../forger-service"; 3 | import { Delegate } from "../interfaces"; 4 | 5 | export class IsForgingAllowedAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const forgerService: ForgerService = args.forgerService; 8 | const delegate: Delegate = args.delegate; 9 | const networkState: Contracts.P2P.NetworkState = args.networkState; 10 | 11 | return forgerService.isForgingAllowed(networkState, delegate); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-forger/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | hosts: [ 3 | { 4 | hostname: "127.0.0.1", 5 | port: process.env.CORE_P2P_PORT || 4000, 6 | }, 7 | ], 8 | tracker: false, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-forger/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./delegate-factory"; 2 | export * from "./service-provider"; 3 | -------------------------------------------------------------------------------- /packages/core-forger/src/process-actions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./current-delegate"; 2 | export * from "./next-slot"; 3 | export * from "./last-forged-block"; 4 | -------------------------------------------------------------------------------- /packages/core-forger/src/process-actions/next-slot.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | import { ForgerService } from "../forger-service"; 4 | 5 | @Container.injectable() 6 | export class NextSlotProcessAction implements Contracts.Kernel.ProcessAction { 7 | @Container.inject(Container.Identifiers.ForgerService) 8 | private readonly forger!: ForgerService; 9 | 10 | public name = "forger.nextSlot"; 11 | 12 | public async handler() { 13 | return { 14 | remainingTime: this.forger.getRemainingSlotTime(), 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-forger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/bootstrap/index.ts: -------------------------------------------------------------------------------- 1 | export * as app from "./app"; 2 | export * as serviceProviders from "./service-providers"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/bootstrap/interfaces.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @export 3 | * @interface Bootstrapper 4 | */ 5 | export interface Bootstrapper { 6 | /** 7 | * @returns {Promise} 8 | * @memberof Bootstrapper 9 | */ 10 | bootstrap(): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-kernel/src/bootstrap/service-providers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./register-service-providers"; 2 | export * from "./boot-service-providers"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/container.ts: -------------------------------------------------------------------------------- 1 | import { Container, interfaces } from "./ioc"; 2 | 3 | export const container: interfaces.Container = new Container(); 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/blockchain/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./blockchain"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/block-filter.ts: -------------------------------------------------------------------------------- 1 | import { Expression } from "../search"; 2 | import { OrBlockCriteria } from "../shared/block-history-service"; 3 | import { BlockModel } from "./models"; 4 | 5 | export interface BlockFilter { 6 | getExpression(...criteria: OrBlockCriteria[]): Promise>; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/event-types.ts: -------------------------------------------------------------------------------- 1 | // todo: move or remove these after the database rework 2 | export enum DatabaseEvents { 3 | PRE_CONNECT = "database.preConnect", 4 | POST_CONNECT = "database.postConnect", 5 | PRE_DISCONNECT = "database.preDisconnect", 6 | POST_DISCONNECT = "database.postDisconnect", 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block-filter"; 2 | export * from "./event-types"; 3 | export * from "./model-converter"; 4 | export * from "./models"; 5 | export * from "./transaction-filter"; 6 | export * from "./wallets-table-service"; 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/search/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./search-parameter-converter"; 2 | export * from "./search-parameters"; 3 | export * from "./query-parameters"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/search/query-parameters.ts: -------------------------------------------------------------------------------- 1 | export interface QueryParameters { 2 | [key: string]: object | number | string | boolean; 3 | } 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/search/search-parameter-converter.ts: -------------------------------------------------------------------------------- 1 | import { QueryParameters } from "./query-parameters"; 2 | import { SearchParameters } from "./search-parameters"; 3 | 4 | export interface SearchParameterConverter { 5 | convert(params: QueryParameters, orderBy?: any, paginate?: any): SearchParameters; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/transaction-filter.ts: -------------------------------------------------------------------------------- 1 | import { Expression } from "../search"; 2 | import { OrTransactionCriteria } from "../shared/transaction-history-service"; 3 | import { TransactionModel } from "./models"; 4 | 5 | export interface TransactionFilter { 6 | getExpression(...criteria: OrTransactionCriteria[]): Promise>; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/database/wallets-table-service.ts: -------------------------------------------------------------------------------- 1 | import { Contracts } from "../.."; 2 | 3 | export interface WalletsTableService { 4 | flush(): Promise; 5 | sync(wallets: readonly Contracts.State.Wallet[]): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/index.ts: -------------------------------------------------------------------------------- 1 | export * as Blockchain from "./blockchain"; 2 | export * as Database from "./database"; 3 | export * as Kernel from "./kernel"; 4 | export * as P2P from "./p2p"; 5 | export * as Search from "./search"; 6 | export * as Shared from "./shared"; 7 | export * as Snapshot from "./snapshot"; 8 | export * as State from "./state"; 9 | export * as TransactionPool from "./transaction-pool"; 10 | export * as Transactions from "./transactions"; 11 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/kernel/config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @export 3 | * @interface ConfigLoader 4 | */ 5 | export interface ConfigLoader { 6 | /** 7 | * @returns {Promise} 8 | * @memberof ConfigLoader 9 | */ 10 | loadEnvironmentVariables(): Promise; 11 | 12 | /** 13 | * @returns {Promise} 14 | * @memberof ConfigLoader 15 | */ 16 | loadConfiguration(): Promise; 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/kernel/container.ts: -------------------------------------------------------------------------------- 1 | import { interfaces as Container } from "inversify"; 2 | 3 | export { Container }; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/kernel/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./application"; 2 | export * from "./cache"; 3 | export * from "./config"; 4 | export * from "./container"; 5 | export * from "./events"; 6 | export * from "./filesystem"; 7 | export * from "./log"; 8 | export * from "./pipeline"; 9 | export * from "./queue"; 10 | export * from "./process-actions"; 11 | export * from "./validation"; 12 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/kernel/process-actions.ts: -------------------------------------------------------------------------------- 1 | export type ProcessActionHandler = () => Promise; 2 | 3 | export interface ProcessAction { 4 | name: string; 5 | handler: ProcessActionHandler; 6 | } 7 | 8 | export interface ProcessActionsService { 9 | register(remoteAction: ProcessAction): void; 10 | } 11 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/blocks.ts: -------------------------------------------------------------------------------- 1 | export type PostBlockResponse = { 2 | status: boolean; 3 | height: number; 4 | }; 5 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/chunk-cache.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface ChunkCache { 4 | has(key: string): boolean; 5 | get(key: string): Interfaces.IBlockData[]; 6 | set(key: string, data: Interfaces.IBlockData[]): void; 7 | remove(key: string): void; 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./blocks"; 2 | export * from "./chunk-cache"; 3 | export * from "./nes-client"; 4 | export * from "./network-monitor"; 5 | export * from "./network-state"; 6 | export * from "./peer-connector"; 7 | export * from "./peer-communicator"; 8 | export * from "./peer-processor"; 9 | export * from "./peer-repository"; 10 | export * from "./peer-verifier"; 11 | export * from "./peer"; 12 | export * from "./server"; 13 | export * from "./transaction-broadcaster"; 14 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/nes-client.ts: -------------------------------------------------------------------------------- 1 | export interface Client { 2 | connect(options: any): Promise; 3 | disconnect(): Promise; 4 | request(options: any): Promise; 5 | } 6 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/network-state.ts: -------------------------------------------------------------------------------- 1 | export interface NetworkState { 2 | readonly status: any; 3 | 4 | // static analyze(monitor: NetworkMonitor, repository: PeerRepository): NetworkState; 5 | // static parse(data: any): NetworkState; 6 | 7 | getNodeHeight(): number | undefined; 8 | getLastBlockId(): string | undefined; 9 | 10 | getQuorum(); 11 | getOverHeightBlockHeaders(); 12 | toJson(); 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/peer-connector.ts: -------------------------------------------------------------------------------- 1 | import { Client } from "./nes-client"; 2 | import { Peer } from "./peer"; 3 | 4 | export interface PeerConnector { 5 | all(): Client[]; 6 | 7 | connection(peer: Peer): Client | undefined; 8 | 9 | connect(peer: Peer, maxPayload?: number): Promise; 10 | 11 | disconnect(peer: Peer): void; 12 | 13 | emit(peer: Peer, event: string, payload: any, timeout?: number): Promise; 14 | 15 | getError(peer: Peer): string | undefined; 16 | 17 | setError(peer: Peer, error: string): void; 18 | 19 | hasError(peer: Peer, error: string): boolean; 20 | 21 | forgetError(peer: Peer): void; 22 | } 23 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/peer-processor.ts: -------------------------------------------------------------------------------- 1 | import { Peer } from "./peer"; 2 | 3 | export interface Headers { 4 | version?: string; 5 | } 6 | 7 | export interface AcceptNewPeerOptions { 8 | seed?: boolean; 9 | lessVerbose?: boolean; 10 | } 11 | 12 | export interface PeerProcessor { 13 | initialize(); 14 | 15 | validateAndAcceptPeer(peer: Peer, headers: Headers, options?: AcceptNewPeerOptions): Promise; 16 | 17 | validatePeerIp(peer, options?: AcceptNewPeerOptions): boolean; 18 | 19 | isWhitelisted(peer): boolean; 20 | } 21 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/peer-repository.ts: -------------------------------------------------------------------------------- 1 | import { Peer } from "./peer"; 2 | 3 | export interface PeerRepository { 4 | getPeers(): Peer[]; 5 | 6 | hasPeers(): boolean; 7 | 8 | getPeer(ip: string): Peer; 9 | 10 | setPeer(peer: Peer): void; 11 | 12 | forgetPeer(peer: Peer): void; 13 | 14 | hasPeer(ip: string): boolean; 15 | 16 | getPendingPeers(): Peer[]; 17 | 18 | hasPendingPeers(): boolean; 19 | 20 | getPendingPeer(ip: string): Peer; 21 | 22 | setPendingPeer(peer: Peer): void; 23 | 24 | forgetPendingPeer(peer: Peer): void; 25 | 26 | hasPendingPeer(ip: string): boolean; 27 | 28 | getSameSubnetPeers(ip: string): Peer[]; 29 | } 30 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/peer-verifier.ts: -------------------------------------------------------------------------------- 1 | import { FastPeerVerificationResult, Peer, PeerState, PeerVerificationResult } from "./peer"; 2 | 3 | export interface PeerVerifier { 4 | initialize(peer: Peer); 5 | 6 | checkState(claimedState: PeerState, deadline: number): Promise; 7 | 8 | checkStateFast(claimedState: PeerState, deadline: number): Promise; 9 | } 10 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/p2p/transaction-broadcaster.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface TransactionBroadcaster { 4 | broadcastTransactions(transactions: Interfaces.ITransaction[]): Promise; 5 | } 6 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/search/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./criteria"; 2 | export * from "./expressions"; 3 | 4 | export type Sorting = { 5 | property: string; 6 | direction: "asc" | "desc"; 7 | }[]; 8 | 9 | export type Pagination = { 10 | offset: number; 11 | limit: number; 12 | }; 13 | 14 | export type Options = { 15 | estimateTotalCount?: boolean; 16 | }; 17 | 18 | export type ResultsPage = { 19 | results: T[]; 20 | totalCount: number; 21 | meta: { totalCountIsEstimate: boolean }; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/shared/download-block.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface DownloadBlock extends Omit { 4 | transactions: string[]; 5 | } 6 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/shared/dynamic-fee.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface DynamicFeeContext { 4 | transaction: Interfaces.ITransaction; 5 | addonBytes: number; 6 | satoshiPerByte: number; 7 | height: number; 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/shared/forging-info.ts: -------------------------------------------------------------------------------- 1 | export interface ForgingInfo { 2 | currentForger: number; 3 | nextForger: number; 4 | blockTimestamp: number; 5 | canForge: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block-history-service"; 2 | export * from "./download-block"; 3 | export * from "./dynamic-fee"; 4 | export * from "./forging-info"; 5 | export * from "./rounds"; 6 | export * from "./transaction-history-service"; 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/shared/rounds.ts: -------------------------------------------------------------------------------- 1 | export interface RoundInfo { 2 | round: number; 3 | nextRound: number; 4 | maxDelegates: number; 5 | roundHeight: number; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/snapshot/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./snapshot-service"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/state/block-store.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface BlockStore { 4 | get(key: string | number): Interfaces.IBlockData | undefined; 5 | 6 | set(value: Interfaces.IBlock): void; 7 | 8 | has(value: Interfaces.IBlockData): boolean; 9 | 10 | delete(value: Interfaces.IBlockData): void; 11 | 12 | clear(): void; 13 | 14 | resize(maxSize: number): void; 15 | 16 | last(): Interfaces.IBlock | undefined; 17 | 18 | values(): Interfaces.IBlockData[]; 19 | 20 | count(): number; 21 | 22 | getIds(): string[]; 23 | 24 | getHeights(): number[]; 25 | } 26 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/state/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block-state"; 2 | export * from "./block-store"; 3 | export * from "./dpos"; 4 | export * from "./state-builder"; 5 | export * from "./state-store"; 6 | export * from "./transaction-store"; 7 | export * from "./transaction-validator"; 8 | export * from "./wallets"; 9 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/state/state-builder.ts: -------------------------------------------------------------------------------- 1 | export interface StateBuilder { 2 | run(): Promise; 3 | } 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/state/transaction-store.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | import { CappedMap } from "../../utils"; 4 | 5 | export interface TransactionStore extends CappedMap { 6 | push(value: Interfaces.ITransactionData): void; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/state/transaction-validator.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface TransactionValidator { 4 | validate(transaction: Interfaces.ITransaction): Promise; 5 | } 6 | 7 | export type TransactionValidatorFactory = () => TransactionValidator; 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/collator.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface Collator { 4 | getBlockCandidateTransactions(): Promise; 5 | } 6 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/dynamic-fee-matcher.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface DynamicFeeMatcher { 4 | throwIfCannotEnterPool(transaction: Interfaces.ITransaction): Promise; 5 | throwIfCannotBroadcast(transaction: Interfaces.ITransaction): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/errors.ts: -------------------------------------------------------------------------------- 1 | export class PoolError extends Error { 2 | public readonly type: string; 3 | 4 | public constructor(message: string, type: string) { 5 | super(message); 6 | this.type = type; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/expiration-service.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface ExpirationService { 4 | canExpire(transaction: Interfaces.ITransaction): boolean; 5 | isExpired(transaction: Interfaces.ITransaction): Promise; 6 | getExpirationHeight(transaction: Interfaces.ITransaction): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./collator"; 2 | export * from "./dynamic-fee-matcher"; 3 | export * from "./errors"; 4 | export * from "./expiration-service"; 5 | export * from "./mempool-index-registry"; 6 | export * from "./mempool-index"; 7 | export * from "./mempool"; 8 | export * from "./processor"; 9 | export * from "./query"; 10 | export * from "./sender-mempool"; 11 | export * from "./sender-state"; 12 | export * from "./service"; 13 | export * from "./storage"; 14 | export * from "./worker"; 15 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/mempool-index-registry.ts: -------------------------------------------------------------------------------- 1 | import { MempoolIndex } from "./mempool-index"; 2 | 3 | export interface MempoolIndexRegistry { 4 | get(indexName: string): MempoolIndex; 5 | clear(): void; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/mempool-index.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface MempoolIndex { 4 | set(key: string, transaction: Interfaces.ITransaction): void; 5 | has(key: string): boolean; 6 | get(key: string): Interfaces.ITransaction; 7 | forget(key: string): void; 8 | clear(): void; 9 | } 10 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/sender-mempool.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface SenderMempool { 4 | isDisposable(): boolean; 5 | getSize(): number; 6 | 7 | getFromEarliest(): Iterable; 8 | getFromLatest(): Iterable; 9 | 10 | addTransaction(transaction: Interfaces.ITransaction): Promise; 11 | removeTransaction(id: string): Promise; 12 | removeForgedTransaction(id: string): Promise; 13 | } 14 | 15 | export type SenderMempoolFactory = () => SenderMempool; 16 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/sender-state.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface SenderState { 4 | apply(transaction: Interfaces.ITransaction): Promise; 5 | revert(transaction: Interfaces.ITransaction): Promise; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/service.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface Service { 4 | getPoolSize(): number; 5 | 6 | applyBlock(block: Interfaces.IBlock): Promise; 7 | addTransaction(transaction: Interfaces.ITransaction): Promise; 8 | readdTransactions(previouslyForgedTransactions?: Interfaces.ITransaction[]): Promise; 9 | removeTransaction(transaction: Interfaces.ITransaction): Promise; 10 | cleanUp(): Promise; 11 | flush(): Promise; 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transaction-pool/storage.ts: -------------------------------------------------------------------------------- 1 | export type StoredTransaction = { 2 | height: number; 3 | id: string; 4 | senderPublicKey: string; 5 | serialized: Buffer; 6 | }; 7 | 8 | export interface Storage { 9 | addTransaction(storedTransaction: StoredTransaction): void; 10 | hasTransaction(id: string): boolean; 11 | getAllTransactions(): Iterable; 12 | getOldTransactions(height: number): Iterable; 13 | removeTransaction(id: string): void; 14 | flush(): void; 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transactions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./verification"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/contracts/transactions/verification.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces } from "@arkecosystem/crypto"; 2 | 3 | export interface SecondSignatureVerification { 4 | verifySecondSignature(transaction: Interfaces.ITransactionData, publicKey: string): boolean; 5 | 6 | clear(transactionId: string): void; 7 | } 8 | 9 | export interface MultiSignatureVerification { 10 | verifySignatures( 11 | transaction: Interfaces.ITransactionData, 12 | multiSignatureAsset: Interfaces.IMultiSignatureAsset, 13 | ): boolean; 14 | 15 | clear(transactionId: string): void; 16 | } 17 | -------------------------------------------------------------------------------- /packages/core-kernel/src/enums/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./events"; 2 | export * from "./shutdown-signals"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/enums/shutdown-signals.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @export 3 | * @enum {number} 4 | */ 5 | export enum ShutdownSignal { 6 | SIGHUP = "SIGHUP", 7 | SIGINT = "SIGINT", 8 | SIGQUIT = "SIGQUIT", 9 | SIGILL = "SIGILL", 10 | SIGTRAP = "SIGTRAP", 11 | SIGABRT = "SIGABRT", 12 | SIGBUS = "SIGBUS", 13 | SIGFPE = "SIGFPE", 14 | SIGSEGV = "SIGSEGV", 15 | SIGUSR2 = "SIGUSR2", 16 | SIGTERM = "SIGTERM", 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-kernel/src/exceptions/cache.ts: -------------------------------------------------------------------------------- 1 | import { Exception } from "./base"; 2 | 3 | /** 4 | * @export 5 | * @class CacheException 6 | * @extends {Exception} 7 | */ 8 | export class CacheException extends Exception {} 9 | 10 | /** 11 | * @export 12 | * @class InvalidArgument 13 | * @extends {CacheException} 14 | */ 15 | export class InvalidArgument extends CacheException {} 16 | -------------------------------------------------------------------------------- /packages/core-kernel/src/exceptions/index.ts: -------------------------------------------------------------------------------- 1 | export * as Base from "./base"; 2 | export * as Cache from "./cache"; 3 | export * as Config from "./config"; 4 | export * as Container from "./container"; 5 | export * as Filesystem from "./filesystem"; 6 | export * as Logic from "./logic"; 7 | export * as Plugins from "./plugins"; 8 | export * as Runtime from "./runtime"; 9 | export * as Validation from "./validation"; 10 | -------------------------------------------------------------------------------- /packages/core-kernel/src/exceptions/validation.ts: -------------------------------------------------------------------------------- 1 | import { InvalidArgumentException } from "./logic"; 2 | 3 | /** 4 | * @export 5 | * @class ValidationFailed 6 | * @extends {InvalidArgumentException} 7 | */ 8 | export class ValidationFailed extends InvalidArgumentException { 9 | public constructor() { 10 | super("The given data was invalid."); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-kernel/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Application } from "./application"; 2 | export * as Contracts from "./contracts"; 3 | export * as Enums from "./enums"; 4 | export * as Exceptions from "./exceptions"; 5 | export * as Container from "./ioc"; 6 | export * as Providers from "./providers"; 7 | export * as Services from "./services"; 8 | export * as Support from "./support"; 9 | export * as Types from "./types"; 10 | export * as Utils from "./utils"; 11 | 12 | export { Application }; 13 | -------------------------------------------------------------------------------- /packages/core-kernel/src/ioc/decorator.ts: -------------------------------------------------------------------------------- 1 | import { decorate, injectable } from "inversify"; 2 | 3 | export const decorateInjectable = (target: any) => { 4 | try { 5 | decorate(injectable(), target); 6 | } catch {} 7 | }; 8 | -------------------------------------------------------------------------------- /packages/core-kernel/src/ioc/index.ts: -------------------------------------------------------------------------------- 1 | import "reflect-metadata"; 2 | 3 | export * as Selectors from "./selectors"; 4 | 5 | export * from "inversify"; 6 | 7 | export * from "./identifiers"; 8 | 9 | export * from "./decorator"; 10 | -------------------------------------------------------------------------------- /packages/core-kernel/src/providers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin-configuration"; 2 | export * from "./plugin-manifest"; 3 | export * from "./service-provider-repository"; 4 | export * from "./service-provider"; 5 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/attributes/contracts.ts: -------------------------------------------------------------------------------- 1 | export interface IndexOptions { 2 | scope: string; 3 | } 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/attributes/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./attribute-map"; 2 | export * from "./attribute-set"; 3 | export * from "./contracts"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/cache/drivers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./memory"; 2 | export * from "./null"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/cache/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | export * from "./drivers"; 3 | export * from "./manager"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/config/drivers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./local"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/config/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./manager"; 2 | export * from "./repository"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/events/drivers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./memory"; 2 | export * from "./null"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/events/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | export * from "./manager"; 3 | export * from "./drivers"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/filesystem/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | export * from "./manager"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/index.ts: -------------------------------------------------------------------------------- 1 | export * as Attributes from "./attributes"; 2 | export * as Cache from "./cache"; 3 | export * as Config from "./config"; 4 | export * as Events from "./events"; 5 | export * as Filesystem from "./filesystem"; 6 | export * as Log from "./log"; 7 | export * as Pipeline from "./pipeline"; 8 | export * as Queue from "./queue"; 9 | export * as Schedule from "./schedule"; 10 | export * as Search from "./search"; 11 | export * as Triggers from "./triggers"; 12 | export * as ProcessActions from "./process-actions"; 13 | export * as Validation from "./validation"; 14 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/log/enums.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @remarks 3 | * Log levels as defined by {@link https://tools.ietf.org/html/rfc5424 | RFC 5424} 4 | * 5 | * @export 6 | * @enum {number} 7 | */ 8 | export enum LogLevel { 9 | Emergency = 0, 10 | Alert = 1, 11 | Critical = 2, 12 | Error = 3, 13 | Warning = 4, 14 | Notice = 5, 15 | Informational = 6, 16 | Debug = 7, 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/log/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./enums"; 2 | export * from "./manager"; 3 | export * from "./service-provider"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/mixins/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/mixins/service-provider.ts: -------------------------------------------------------------------------------- 1 | import { Identifiers } from "../../ioc"; 2 | import { ServiceProvider as BaseServiceProvider } from "../../providers"; 3 | import { MixinService } from "./mixins"; 4 | 5 | export class ServiceProvider extends BaseServiceProvider { 6 | /** 7 | * Register the service provider. 8 | * 9 | * @returns {Promise} 10 | * @memberof ServiceProvider 11 | */ 12 | public async register(): Promise { 13 | this.app.bind(Identifiers.MixinService).to(MixinService).inSingletonScope(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/pipeline/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/process-actions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | export * from "./manager"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/queue/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/schedule/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block-job"; 2 | export * from "./cron-job"; 3 | export * from "./service-provider"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/schedule/interfaces.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @export 3 | * @interface Job 4 | */ 5 | export interface Job { 6 | /** 7 | * @param {() => void} callback 8 | * @memberof Job 9 | */ 10 | execute(callback: () => void): void; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/schedule/service-provider.ts: -------------------------------------------------------------------------------- 1 | import { Identifiers } from "../../ioc"; 2 | import { ServiceProvider as BaseServiceProvider } from "../../providers"; 3 | import { Schedule } from "./schedule"; 4 | 5 | /** 6 | * @export 7 | * @class ServiceProvider 8 | * @extends {ServiceProvider} 9 | */ 10 | export class ServiceProvider extends BaseServiceProvider { 11 | /** 12 | * @returns {Promise} 13 | * @memberof ServiceProvider 14 | */ 15 | public async register(): Promise { 16 | this.app.bind(Identifiers.ScheduleService).to(Schedule).inSingletonScope(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/search/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./standard-criteria-service"; 2 | export * from "./pagination-service"; 3 | export * from "./service-provider"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/triggers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./action"; 2 | export * from "./service-provider"; 3 | export * from "./triggers"; 4 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/triggers/service-provider.ts: -------------------------------------------------------------------------------- 1 | import { Identifiers } from "../../ioc"; 2 | import { ServiceProvider as BaseServiceProvider } from "../../providers"; 3 | import { Triggers } from "./triggers"; 4 | 5 | export class ServiceProvider extends BaseServiceProvider { 6 | /** 7 | * Register the service provider. 8 | * 9 | * @returns {Promise} 10 | * @memberof ServiceProvider 11 | */ 12 | public async register(): Promise { 13 | this.app.bind(Identifiers.TriggerService).to(Triggers).inSingletonScope(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/core-kernel/src/services/validation/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./manager"; 2 | export * from "./service-provider"; 3 | -------------------------------------------------------------------------------- /packages/core-kernel/src/support/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./instance-manager"; 2 | -------------------------------------------------------------------------------- /packages/core-kernel/src/types/container.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * A class constructor. 3 | */ 4 | export type Constructor = new (...args: any[]) => T; 5 | 6 | /** 7 | * Function that returns T. 8 | */ 9 | export type FunctionReturning = (...args: Array) => T; 10 | 11 | /** 12 | * A class or function returning T. 13 | */ 14 | export type ClassOrFunctionReturning = FunctionReturning | Constructor; 15 | -------------------------------------------------------------------------------- /packages/core-kernel/src/types/index.ts: -------------------------------------------------------------------------------- 1 | import { CacheStore, Pipeline, Queue } from "../contracts/kernel"; 2 | 3 | export type { Class, JsonObject, PackageJson, Primitive } from "type-fest"; 4 | 5 | export type KeyValuePair = Record; 6 | 7 | export type ActionArguments = Record; 8 | 9 | export type CacheFactory = () => CacheStore; 10 | 11 | export type PipelineFactory = () => Pipeline; 12 | 13 | export type QueueFactory = () => Queue; 14 | -------------------------------------------------------------------------------- /packages/core-kernel/src/utils/format-timestamp.ts: -------------------------------------------------------------------------------- 1 | import { Managers } from "@arkecosystem/crypto"; 2 | import dayjs, { Dayjs } from "dayjs"; 3 | import utc from "dayjs/plugin/utc"; 4 | 5 | dayjs.extend(utc); 6 | 7 | export const formatTimestamp = ( 8 | epochStamp: number, 9 | ): { 10 | epoch: number; 11 | unix: number; 12 | human: string; 13 | } => { 14 | const timestamp: Dayjs = dayjs.utc(Managers.configManager.getMilestone().epoch).add(epochStamp, "second"); 15 | 16 | return { 17 | epoch: epochStamp, 18 | unix: timestamp.unix(), 19 | human: timestamp.toISOString(), 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /packages/core-kernel/src/utils/ip-address.ts: -------------------------------------------------------------------------------- 1 | import ipaddr from "ipaddr.js"; 2 | 3 | export const isValidAddress = (ip: string) => { 4 | return ipaddr.isValid(cleanAddress(ip)); 5 | }; 6 | 7 | export const isIPv6Address = (ip: string) => { 8 | try { 9 | return ipaddr.parse(cleanAddress(ip)).kind() === "ipv6"; 10 | } catch {} 11 | 12 | return false; 13 | }; 14 | 15 | export const normalizeAddress = (ip: string) => { 16 | ip = cleanAddress(ip); 17 | 18 | if (isIPv6Address(ip)) { 19 | return `[${ip}]`; 20 | } 21 | 22 | return ip; 23 | }; 24 | 25 | export const cleanAddress = (ip: string) => { 26 | return ip.replace("[", "").replace("]", ""); 27 | }; 28 | -------------------------------------------------------------------------------- /packages/core-kernel/src/utils/is-blacklisted.ts: -------------------------------------------------------------------------------- 1 | import nm from "nanomatch"; 2 | 3 | // todo: review the implementation 4 | export const isBlacklisted = (blacklist: string[], remoteAddress: string): boolean => { 5 | if (!Array.isArray(blacklist) || !blacklist.length) { 6 | return false; 7 | } 8 | 9 | for (const ip of blacklist) { 10 | try { 11 | if (nm.isMatch(remoteAddress, ip)) { 12 | return true; 13 | } 14 | } catch {} 15 | } 16 | 17 | return false; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/core-kernel/src/utils/is-whitelisted.ts: -------------------------------------------------------------------------------- 1 | import nm from "nanomatch"; 2 | 3 | // todo: review the implementation 4 | export const isWhitelisted = (whitelist: string[], remoteAddress: string): boolean => { 5 | if (!Array.isArray(whitelist) || !whitelist.length) { 6 | return true; 7 | } 8 | 9 | for (const ip of whitelist) { 10 | try { 11 | if (nm.isMatch(remoteAddress, ip)) { 12 | return true; 13 | } 14 | } catch {} 15 | } 16 | 17 | return false; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/core-kernel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-logger-pino/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | levels: { 3 | console: process.env.CORE_LOG_LEVEL || "info", 4 | file: process.env.CORE_LOG_LEVEL_FILE || "debug", 5 | }, 6 | fileRotator: { 7 | interval: "1d", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-logger-pino/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | -------------------------------------------------------------------------------- /packages/core-logger-pino/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-magistrate-api/src/handlers.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | 3 | import * as Entities from "./routes/entities"; 4 | 5 | export = { 6 | async register(server: Hapi.Server): Promise { 7 | Entities.register(server); 8 | }, 9 | name: "Magistrate API", 10 | version: "2.0.0", 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-magistrate-api/src/identifiers.ts: -------------------------------------------------------------------------------- 1 | export const Identifiers = { 2 | EntitySearchService: Symbol.for("MagistrateApi"), 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-magistrate-api/src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Resources from "./resources"; 2 | 3 | export * from "./services"; 4 | export * from "./identifiers"; 5 | export * from "./service-provider"; 6 | -------------------------------------------------------------------------------- /packages/core-magistrate-api/src/resources/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./entity"; 2 | -------------------------------------------------------------------------------- /packages/core-magistrate-api/src/services/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./entity-search-service"; 2 | -------------------------------------------------------------------------------- /packages/core-magistrate-api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-magistrate-crypto/src/builders/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./business-registration"; 2 | export * from "./business-resignation"; 3 | export * from "./business-update"; 4 | export * from "./bridgechain-registration"; 5 | export * from "./bridgechain-resignation"; 6 | export * from "./bridgechain-update"; 7 | export * from "./entity"; 8 | -------------------------------------------------------------------------------- /packages/core-magistrate-crypto/src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Builders from "./builders"; 2 | export * as Enums from "./enums"; 3 | export * as Interfaces from "./interfaces"; 4 | export * as Transactions from "./transactions"; 5 | -------------------------------------------------------------------------------- /packages/core-magistrate-crypto/src/transactions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./business-registration"; 2 | export * from "./business-resignation"; 3 | export * from "./business-update"; 4 | export * from "./bridgechain-registration"; 5 | export * from "./bridgechain-resignation"; 6 | export * from "./bridgechain-update"; 7 | export * from "./entity"; 8 | -------------------------------------------------------------------------------- /packages/core-magistrate-crypto/src/transactions/utils/business-schema.ts: -------------------------------------------------------------------------------- 1 | export const businessSchema = { 2 | name: { 3 | $ref: "genericName", 4 | }, 5 | website: { 6 | $ref: "uri", 7 | }, 8 | vat: { 9 | type: "string", 10 | minLength: 8, 11 | maxLength: 15, 12 | $ref: "alphanumeric", 13 | }, 14 | repository: { 15 | $ref: "uri", 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/core-magistrate-crypto/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-magistrate-transactions/src/enums.ts: -------------------------------------------------------------------------------- 1 | export enum MempoolIndexes { 2 | EntityName = "entity-name", 3 | } 4 | -------------------------------------------------------------------------------- /packages/core-magistrate-transactions/src/events.ts: -------------------------------------------------------------------------------- 1 | export enum MagistrateApplicationEvents { 2 | BusinessRegistered = "business.registered", 3 | BusinessResigned = "business.resigned", 4 | BusinessUpdate = "business.updated", 5 | BridgechainRegistered = "bridgechain.registered", 6 | BridgechainResigned = "bridgechain.resigned", 7 | BridgechainUpdate = "bridgechain.updated", 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-magistrate-transactions/src/handlers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./business-registration"; 2 | export * from "./business-resignation"; 3 | export * from "./business-update"; 4 | export * from "./bridgechain-registration"; 5 | export * from "./bridgechain-resignation"; 6 | export * from "./bridgechain-update"; 7 | export * from "./entity"; 8 | -------------------------------------------------------------------------------- /packages/core-magistrate-transactions/src/handlers/utils.ts: -------------------------------------------------------------------------------- 1 | export const packageNameRegex = new RegExp("^[a-z0-9@/.~_-]{1,214}$"); 2 | -------------------------------------------------------------------------------- /packages/core-magistrate-transactions/src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Handlers from "./handlers"; 2 | export * from "./service-provider"; 3 | export * from "./interfaces"; 4 | -------------------------------------------------------------------------------- /packages/core-magistrate-transactions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-p2p/src/actions/index.ts: -------------------------------------------------------------------------------- 1 | export { ValidateAndAcceptPeerAction } from "./validate-and-accept-peer"; 2 | -------------------------------------------------------------------------------- /packages/core-p2p/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const constants = { 2 | MAX_DOWNLOAD_BLOCKS: 400, // maximum number of blocks we can download at once 3 | DEFAULT_MAX_PAYLOAD: 20 * 1024 * 1024, // default maxPayload value on the server WS socket 4 | DEFAULT_MAX_PAYLOAD_CLIENT: 100 * 1024, // default maxPayload value on the client WS socket 5 | KILOBYTE: 1024, 6 | MAX_PEERS_GETPEERS: 2000, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/core-p2p/src/contracts.ts: -------------------------------------------------------------------------------- 1 | import { Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | export type PeerFactory = (ip: string) => Contracts.P2P.Peer; 4 | 5 | export interface PeerService { 6 | connector: Contracts.P2P.PeerConnector; 7 | repository: Contracts.P2P.PeerRepository; 8 | communicator: Contracts.P2P.PeerCommunicator; 9 | processor: Contracts.P2P.PeerProcessor; 10 | networkMonitor: Contracts.P2P.NetworkMonitor; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-p2p/src/event-listener.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts, Enums } from "@arkecosystem/core-kernel"; 2 | 3 | import { DisconnectPeer } from "./listeners"; 4 | 5 | // todo: review the implementation 6 | @Container.injectable() 7 | export class EventListener { 8 | @Container.inject(Container.Identifiers.Application) 9 | protected readonly app!: Contracts.Kernel.Application; 10 | 11 | @Container.inject(Container.Identifiers.EventDispatcherService) 12 | private readonly events!: Contracts.Kernel.EventDispatcher; 13 | 14 | public initialize(): void { 15 | this.events.listen(Enums.PeerEvent.Disconnect, this.app.resolve(DisconnectPeer)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-p2p/src/hapi-nes/index.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | import { Client } from "./client"; 3 | import { plugin } from "./plugin"; 4 | 5 | export { plugin, Client }; 6 | -------------------------------------------------------------------------------- /packages/core-p2p/src/hapi-nes/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface NesMessage { 2 | type?: string; // 0-9 3 | id?: number; 4 | path?: string; 5 | payload?: Buffer; 6 | statusCode?: number; 7 | version?: string; 8 | socket?: string; 9 | heartbeat?: { 10 | interval?: number; 11 | timeout?: number; 12 | }; 13 | } -------------------------------------------------------------------------------- /packages/core-p2p/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as Nes from "./hapi-nes"; 2 | 3 | export * from "./enums"; 4 | export * from "./network-state"; 5 | export * from "./network-monitor"; 6 | export * from "./peer"; 7 | export * from "./peer-repository"; 8 | export * from "./service-provider"; 9 | export * from "./socket-server/codecs"; 10 | export * from "./utils"; 11 | export { Nes }; 12 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/codecs/index.ts: -------------------------------------------------------------------------------- 1 | import * as Blocks from "./blocks"; 2 | import * as Internal from "./internal"; 3 | import * as Peer from "./peer"; 4 | import * as Transactions from "./transactions"; 5 | 6 | export const Codecs = { 7 | ...Blocks, 8 | ...Internal, 9 | ...Peer, 10 | ...Transactions, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/codecs/proto/shared.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package shared; 4 | 5 | message Headers { 6 | string version = 1; 7 | } -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/codecs/proto/transactions.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package transactions; 4 | 5 | message PostTransactionsRequest { 6 | bytes transactions = 1; 7 | shared.Headers headers = 2; 8 | } 9 | 10 | message PostTransactionsResponse { 11 | repeated string accept = 1; 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/controllers/controller.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | 3 | @Container.injectable() 4 | export class Controller { 5 | @Container.inject(Container.Identifiers.Application) 6 | protected readonly app!: Contracts.Kernel.Application; 7 | 8 | @Container.inject(Container.Identifiers.LogService) 9 | protected readonly logger!: Contracts.Kernel.Logger; 10 | } 11 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/controllers/transactions.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | import Hapi from "@hapi/hapi"; 3 | 4 | import { Controller } from "./controller"; 5 | 6 | export class TransactionsController extends Controller { 7 | @Container.inject(Container.Identifiers.TransactionPoolProcessor) 8 | private readonly processor!: Contracts.TransactionPool.Processor; 9 | 10 | public async postTransactions(request: Hapi.Request, h: Hapi.ResponseToolkit): Promise { 11 | const result = await this.processor.process((request.payload as any).transactions as Buffer[]); 12 | return result.accept; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/schemas/blocks.ts: -------------------------------------------------------------------------------- 1 | import Joi from "joi"; 2 | 3 | import { headers } from "./shared"; 4 | 5 | export const blocksSchemas = { 6 | getBlocks: Joi.object({ 7 | lastBlockHeight: Joi.number().integer().min(1), 8 | blockLimit: Joi.number().integer().min(1).max(400), 9 | headersOnly: Joi.boolean(), 10 | serialized: Joi.boolean(), 11 | headers, 12 | }), 13 | 14 | postBlock: Joi.object({ 15 | block: Joi.binary(), 16 | headers, 17 | }), 18 | }; 19 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/schemas/internal.ts: -------------------------------------------------------------------------------- 1 | import Joi from "joi"; 2 | 3 | export const internalSchemas = { 4 | emitEvent: Joi.object({ 5 | event: Joi.string(), 6 | body: Joi.object(), 7 | }), 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/schemas/peer.ts: -------------------------------------------------------------------------------- 1 | import Joi from "joi"; 2 | 3 | import { headers } from "./shared"; 4 | 5 | export const peerSchemas = { 6 | getPeers: Joi.object({ 7 | headers, 8 | }), 9 | 10 | getCommonBlocks: Joi.object({ 11 | ids: Joi.array().min(1).max(10).items(Joi.string()), // TODO strings are block ids 12 | headers, 13 | }), 14 | 15 | getStatus: Joi.object({ 16 | headers, 17 | }), 18 | }; 19 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/schemas/shared.ts: -------------------------------------------------------------------------------- 1 | import Joi from "joi"; 2 | 3 | export const headers = Joi.object({ 4 | version: Joi.string(), 5 | }); 6 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/utils/map-addr.ts: -------------------------------------------------------------------------------- 1 | import { process } from "ipaddr.js"; 2 | 3 | export const mapAddr = (addr: string) => process(addr).toString(); 4 | -------------------------------------------------------------------------------- /packages/core-p2p/src/socket-server/utils/validate.ts: -------------------------------------------------------------------------------- 1 | import { Validation } from "@arkecosystem/crypto"; 2 | 3 | import { SocketErrors } from "../../enums"; 4 | 5 | export const validate = (schema, data) => { 6 | const { error: validationError } = Validation.validator.validate(schema, data); 7 | 8 | if (validationError) { 9 | const error = new Error(`Data validation error : ${validationError}`); 10 | error.name = SocketErrors.Validation; 11 | 12 | throw error; 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-p2p/src/utils/get-peer-ip.ts: -------------------------------------------------------------------------------- 1 | import { Socket } from "../hapi-nes/socket"; 2 | 3 | export const getPeerIp = (socket: Socket) => { 4 | return socket.info["x-forwarded-for"]?.split(",")[0]?.trim() ?? socket.info.remoteAddress; 5 | }; 6 | -------------------------------------------------------------------------------- /packages/core-p2p/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export { checkDNS } from "./check-dns"; 2 | export { checkNTP } from "./check-ntp"; 3 | export { buildRateLimiter } from "./build-rate-limiter"; 4 | export { isValidVersion } from "./is-valid-version"; 5 | -------------------------------------------------------------------------------- /packages/core-p2p/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "allowJs" : true 6 | }, 7 | "include": ["src/**/**.ts", "src/socket-server/codecs/proto/*.js"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/codecs/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./message-pack-codec"; 2 | export * from "./json-codec"; 3 | export * from "../filesystem/stream-writer"; 4 | export * from "../filesystem/stream-reader"; 5 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/contracts/codec.ts: -------------------------------------------------------------------------------- 1 | import { Models } from "@arkecosystem/core-database"; 2 | 3 | export interface Codec { 4 | encodeBlock(block: any): Buffer; 5 | decodeBlock(buffer: Buffer): Models.Block; 6 | 7 | encodeTransaction(transaction: any): Buffer; 8 | decodeTransaction(buffer: Buffer): Models.Transaction; 9 | 10 | encodeRound(round: any): Buffer; 11 | decodeRound(buffer: Buffer): Models.Round; 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/contracts/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./codec"; 2 | export * from "./repository"; 3 | import * as Database from "./database"; 4 | import * as Meta from "./meta-data"; 5 | import * as Options from "./options"; 6 | import * as Stream from "./stream"; 7 | import * as Worker from "./worker"; 8 | 9 | export { Database, Meta, Options, Stream, Worker }; 10 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/contracts/meta-data.ts: -------------------------------------------------------------------------------- 1 | export interface MetaData { 2 | blocks: TableMetaData; 3 | transactions: TableMetaData; 4 | rounds: TableMetaData; 5 | 6 | folder: string; 7 | skipCompression: boolean; 8 | network: string; 9 | packageVersion: string; 10 | 11 | codec: string; 12 | } 13 | 14 | export interface TableMetaData { 15 | count: number; 16 | start: number; 17 | end: number; 18 | } 19 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/contracts/options.ts: -------------------------------------------------------------------------------- 1 | export interface DumpOptions { 2 | network: string; 3 | skipCompression?: boolean; 4 | codec?: string; 5 | start?: number; 6 | end?: number; 7 | } 8 | 9 | export interface RestoreOptions { 10 | truncate: boolean; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/contracts/repository.ts: -------------------------------------------------------------------------------- 1 | import { Readable } from "stream"; 2 | 3 | export interface Repository { 4 | getReadStream(start: number, end: number): Promise; 5 | countInRange(start: number, end: number): Promise; 6 | save(data: any): Promise; 7 | } 8 | 9 | export type RepositoryFactory = (table: string) => Repository; 10 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/contracts/stream.ts: -------------------------------------------------------------------------------- 1 | import { Readable } from "stream"; 2 | 3 | import { StreamReader, StreamWriter } from "../filesystem"; 4 | 5 | export type StreamReaderFactory = (file: string, useCompression: boolean, decode: Function) => StreamReader; 6 | 7 | export type StreamWriterFactory = ( 8 | dbStream: Readable, 9 | file: string, 10 | useCompression: boolean, 11 | encode: Function, 12 | ) => StreamWriter; 13 | 14 | type ListenerFunction = (...data) => void; 15 | 16 | export interface EventListenerPair { 17 | event: string; 18 | listener: ListenerFunction; 19 | } 20 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | updateStep: 1000, 3 | cryptoPackages: ["@arkecosystem/core-magistrate-crypto"], 4 | }; 5 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/events.ts: -------------------------------------------------------------------------------- 1 | export enum SnapshotApplicationEvents { 2 | SnapshotStart = "snapshot.start", 3 | SnapshotProgress = "snapshot.progress", 4 | SnapshotComplete = "snapshot.complete", 5 | } 6 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/exceptions/index.ts: -------------------------------------------------------------------------------- 1 | import * as Codec from "./codec"; 2 | import * as Stream from "./stream"; 3 | import * as Verifier from "./verifier"; 4 | 5 | export { Codec, Stream, Verifier }; 6 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/exceptions/stream.ts: -------------------------------------------------------------------------------- 1 | import { Exceptions } from "@arkecosystem/core-kernel"; 2 | 3 | export class StreamNotOpen extends Exceptions.Base.Exception { 4 | public constructor(file: string) { 5 | super(`Stream file file ${file} is not open.`); 6 | } 7 | } 8 | 9 | export class EndOfFile extends Exceptions.Base.Exception { 10 | public constructor(file: string) { 11 | super(`End of file`); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/filesystem/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./filesystem"; 2 | export * from "./stream-reader"; 3 | export * from "./stream-writer"; 4 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/filesystem/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./remove-listeners"; 2 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/filesystem/utils/remove-listeners.ts: -------------------------------------------------------------------------------- 1 | import { Stream } from "../../contracts"; 2 | 3 | export const removeListeners = (emitter: NodeJS.EventEmitter, eventListenerPairs: Stream.EventListenerPair[]): void => { 4 | for (const eventListenerPair of eventListenerPairs) { 5 | emitter.removeListener(eventListenerPair.event, eventListenerPair.listener); 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./ioc"; 2 | export * from "./events"; 3 | export * from "./progress-renderer"; 4 | export * from "./service-provider"; 5 | export * from "./snapshot-service"; 6 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/ioc/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./identifiers"; 2 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block-repository"; 2 | export * from "./round-repository"; 3 | export * from "./transaction-repository"; 4 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/workers/actions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./dump-worker-action"; 2 | export * from "./restore-worker-action"; 3 | export * from "./verify-worker-action"; 4 | export * from "./test-worker-action"; 5 | -------------------------------------------------------------------------------- /packages/core-snapshots/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-state/src/actions/build-delegate-ranking.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | 3 | import { DposState } from "../dpos"; 4 | 5 | export class BuildDelegateRankingAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const dposState: DposState = args.dposState; 8 | 9 | return dposState.buildDelegateRanking(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-state/src/actions/index.ts: -------------------------------------------------------------------------------- 1 | export { BuildDelegateRankingAction } from "./build-delegate-ranking"; 2 | export { GetActiveDelegatesAction } from "./get-active-delegates"; 3 | -------------------------------------------------------------------------------- /packages/core-state/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | storage: { 3 | maxLastBlocks: 100, 4 | maxLastTransactionIds: 10000, 5 | }, 6 | walletSync: { 7 | enabled: !!process.env.CORE_WALLET_SYNC_ENABLED, 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-state/src/dpos/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./dpos"; 2 | export * from "./dpos-previous-round"; 3 | -------------------------------------------------------------------------------- /packages/core-state/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | export * as Wallets from "./wallets"; 3 | export { DatabaseInteraction } from "./database-interactions"; 4 | export { DatabaseInterceptor } from "./database-interceptor"; 5 | export { StateBuilder } from "./state-builder"; 6 | export * as Stores from "./stores"; 7 | -------------------------------------------------------------------------------- /packages/core-state/src/stores/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./blocks"; 2 | export * from "./state"; 3 | export * from "./transactions"; 4 | -------------------------------------------------------------------------------- /packages/core-state/src/stores/transactions.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts, Utils } from "@arkecosystem/core-kernel"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | // todo: review its implementation and finally integrate it as planned in v2 5 | @Container.injectable() 6 | export class TransactionStore extends Utils.CappedMap 7 | implements Contracts.State.TransactionStore { 8 | public push(value: Interfaces.ITransactionData): void { 9 | Utils.assert.defined(value.id); 10 | 11 | super.set(value.id, value); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-state/src/wallets/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./wallet-repository"; 2 | export * from "./wallet-repository-clone"; 3 | export * from "./wallet-repository-copy-on-write"; 4 | export * from "./wallet-event"; 5 | export * from "./wallet"; 6 | export * from "./wallet-index"; 7 | export * from "./indexers"; 8 | -------------------------------------------------------------------------------- /packages/core-state/src/wallets/indexers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./wallet-indexes"; 2 | export * from "./indexers"; 3 | -------------------------------------------------------------------------------- /packages/core-state/src/wallets/wallet-event.ts: -------------------------------------------------------------------------------- 1 | export enum WalletEvent { 2 | PropertySet = "wallet.property.set", 3 | AttributeSet = "wallet.attribute.set", 4 | AttributeForget = "wallet.attribute.forget", 5 | } 6 | -------------------------------------------------------------------------------- /packages/core-state/src/wallets/wallet-factory.ts: -------------------------------------------------------------------------------- 1 | import { Contracts, Services } from "@arkecosystem/core-kernel"; 2 | import { Wallet } from "./wallet"; 3 | 4 | export const walletFactory = ( 5 | attributeSet: Services.Attributes.AttributeSet, 6 | events?: Contracts.Kernel.EventDispatcher, 7 | ) => { 8 | return (address: string) => { 9 | return new Wallet(address, new Services.Attributes.AttributeMap(attributeSet), events); 10 | }; 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-state/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/app/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./contracts"; 2 | export * from "./sandbox"; 3 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/cli/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./console"; 2 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/factories/factories/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block"; 2 | export * from "./identity"; 3 | export * from "./peer"; 4 | export * from "./round"; 5 | export * from "./transaction"; 6 | export * from "./wallet"; 7 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/factories/factories/peer.ts: -------------------------------------------------------------------------------- 1 | import { Peer } from "@arkecosystem/core-p2p"; 2 | import Chance from "chance"; 3 | 4 | import { FactoryBuilder } from "../factory-builder"; 5 | 6 | const chance: Chance = new Chance(); 7 | 8 | export const registerPeerFactory = (factory: FactoryBuilder): void => { 9 | factory.set("Peer", () => { 10 | const peer: Peer = new Peer(chance.ip(), chance.port()); 11 | peer.version = chance.pickone(["3.0.0", "3.0.0-next.0"]); 12 | peer.latency = chance.integer({ min: 1, max: 1000 }); 13 | 14 | return peer; 15 | }); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/factories/index.ts: -------------------------------------------------------------------------------- 1 | export * as Factories from "./factories"; 2 | 3 | export * from "./factory-builder"; 4 | export * from "./types"; 5 | export * from "./helpers"; 6 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/factories/types.ts: -------------------------------------------------------------------------------- 1 | export type FactoryFunctionOptions = Record; 2 | 3 | export type FactoryFunction = ({ entity, options }: { entity?: any; options: FactoryFunctionOptions }) => any; 4 | 5 | export type HookFunction = ({ entity, options }: { entity?: any; options: FactoryFunctionOptions }) => void; 6 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/internal/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./delegates"; 2 | export * from "./signer"; 3 | export * from "./wallet-attributes"; 4 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/api/index.ts: -------------------------------------------------------------------------------- 1 | import "./block"; 2 | import "./peer"; 3 | import "./response"; 4 | import "./transaction"; 5 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/blockchain/index.ts: -------------------------------------------------------------------------------- 1 | import "./dispatch"; 2 | import "./execute-on-entry"; 3 | import "./transition"; 4 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/fields/address.ts: -------------------------------------------------------------------------------- 1 | import { Identities } from "@arkecosystem/crypto"; 2 | 3 | export {}; 4 | 5 | declare global { 6 | namespace jest { 7 | // @ts-ignore - All declarations of 'Matchers' must have identical type parameters. 8 | interface Matchers { 9 | toBeAddress(): R; 10 | } 11 | } 12 | } 13 | 14 | expect.extend({ 15 | toBeAddress: (received, argument) => { 16 | return { 17 | message: /* istanbul ignore next */ () => "Expected value to be a valid address", 18 | pass: Identities.Address.validate(received, argument), 19 | }; 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/fields/index.ts: -------------------------------------------------------------------------------- 1 | import "./address"; 2 | import "./public-key"; 3 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/functional/index.ts: -------------------------------------------------------------------------------- 1 | import "./accepted"; 2 | import "./forged"; 3 | import "./rejected"; 4 | import "./entity"; 5 | import "./unconfirmed"; 6 | import "./vote-balance"; 7 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/index.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | import "./api"; 3 | import "./blockchain"; 4 | import "./fields"; 5 | import "./functional"; 6 | import "./models"; 7 | import "./transactions"; 8 | import "./fields"; 9 | import "./models"; 10 | import "./transactions"; 11 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/models/index.ts: -------------------------------------------------------------------------------- 1 | import "./delegate"; 2 | import "./transaction"; 3 | import "./wallet"; 4 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/models/wallet.ts: -------------------------------------------------------------------------------- 1 | import { Utils } from "@arkecosystem/core-kernel"; 2 | 3 | export {}; 4 | 5 | declare global { 6 | namespace jest { 7 | // @ts-ignore - All declarations of 'Matchers' must have identical type parameters. 8 | interface Matchers { 9 | toBeWallet(): R; 10 | } 11 | } 12 | } 13 | 14 | expect.extend({ 15 | toBeWallet: (actual) => { 16 | return { 17 | message: /* istanbul ignore next */ () => "Expected value to be a valid wallet", 18 | pass: Utils.isEqual(Utils.sortBy(Object.keys(actual)), ["address", "publicKey"]), 19 | }; 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/transactions/index.ts: -------------------------------------------------------------------------------- 1 | import "./types"; 2 | import "./valid"; 3 | import "./valid-second-signature"; 4 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/matchers/transactions/types/index.ts: -------------------------------------------------------------------------------- 1 | import "./delegate-registration"; 2 | import "./delegate-resignation"; 3 | import "./ipfs"; 4 | import "./multi-payment"; 5 | import "./multi-signature"; 6 | import "./second-signature"; 7 | import "./transfer"; 8 | import "./vote"; 9 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/mocks/network-monitor.ts: -------------------------------------------------------------------------------- 1 | import { NetworkMonitor } from "@arkecosystem/core-p2p"; 2 | 3 | let mockNetworkHeight: number = 0; 4 | 5 | export const setNetworkHeight = (networkHeight: number) => { 6 | mockNetworkHeight = networkHeight; 7 | }; 8 | 9 | class NetworkMonitorMock implements Partial { 10 | public getNetworkHeight(): number { 11 | return mockNetworkHeight; 12 | } 13 | } 14 | 15 | export const instance = new NetworkMonitorMock(); 16 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/mocks/round-repository.ts: -------------------------------------------------------------------------------- 1 | import { Models, Repositories } from "@arkecosystem/core-database"; 2 | 3 | let mockRounds: Partial[] = []; 4 | 5 | export const setRounds = (rounds: Partial[]) => { 6 | mockRounds = rounds; 7 | }; 8 | 9 | class RoundRepositoryMock implements Partial { 10 | public async findById(id: string): Promise { 11 | return mockRounds as Models.Round[]; 12 | } 13 | } 14 | 15 | export const instance = new RoundRepositoryMock(); 16 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/mocks/service-provider-repository.ts: -------------------------------------------------------------------------------- 1 | import { Providers } from "@arkecosystem/core-kernel"; 2 | 3 | let mockServiceProviders: Providers.ServiceProvider[] = []; 4 | 5 | export const setServiceProviders = (serviceProviders: Providers.ServiceProvider[]) => { 6 | mockServiceProviders = serviceProviders; 7 | }; 8 | 9 | class ServiceProviderRepositoryMocks implements Partial { 10 | public allLoadedProviders(): Providers.ServiceProvider[] { 11 | return mockServiceProviders; 12 | } 13 | } 14 | 15 | export const instance = new ServiceProviderRepositoryMocks(); 16 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/mocks/wallet-respository.ts: -------------------------------------------------------------------------------- 1 | import { Wallets } from "@arkecosystem/core-state"; 2 | import { Utils } from "@arkecosystem/crypto"; 3 | 4 | let mockNonce: Utils.BigNumber = Utils.BigNumber.make(1); 5 | 6 | export const setNonce = (nonce: Utils.BigNumber) => { 7 | mockNonce = nonce; 8 | }; 9 | 10 | class WalletRepositoryMock implements Partial { 11 | public getNonce(publicKey: string): Utils.BigNumber { 12 | return mockNonce; 13 | } 14 | } 15 | 16 | export const instance = new WalletRepositoryMock(); 17 | -------------------------------------------------------------------------------- /packages/core-test-framework/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./api-http-client"; 3 | export * from "./api-inject-client"; 4 | export * from "./generic"; 5 | export * from "./rest-client"; 6 | export * from "./transaction-factory"; 7 | 8 | export * as Mapper from "./mapper"; 9 | -------------------------------------------------------------------------------- /packages/core-test-framework/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/apply-transaction.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Handlers } from "@arkecosystem/core-transactions"; 3 | import { Interfaces } from "@arkecosystem/crypto"; 4 | 5 | export class ApplyTransactionAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const handler: Handlers.TransactionHandler = args.handler; 8 | const transaction: Interfaces.ITransaction = args.transaction; 9 | 10 | return handler.apply(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/index.ts: -------------------------------------------------------------------------------- 1 | export { ApplyTransactionAction } from "./apply-transaction"; 2 | export { RevertTransactionAction } from "./revert-transaction"; 3 | export { ThrowIfCannotEnterPoolAction } from "./throw-if-cannot-enter-pool"; 4 | export { VerifyTransactionAction } from "./verify-transaction"; 5 | export { OnPoolEnterAction } from "./on-pool-enter"; 6 | export { OnPoolLeaveAction } from "./on-pool-leave"; 7 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/on-pool-enter.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Handlers } from "@arkecosystem/core-transactions"; 3 | import { Interfaces } from "@arkecosystem/crypto"; 4 | 5 | export class OnPoolEnterAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const handler: Handlers.TransactionHandler = args.handler; 8 | const transaction: Interfaces.ITransaction = args.transaction; 9 | 10 | handler.onPoolEnter(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/on-pool-leave.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Handlers } from "@arkecosystem/core-transactions"; 3 | import { Interfaces } from "@arkecosystem/crypto"; 4 | 5 | export class OnPoolLeaveAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const handler: Handlers.TransactionHandler = args.handler; 8 | const transaction: Interfaces.ITransaction = args.transaction; 9 | 10 | handler.onPoolLeave(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/revert-transaction.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Handlers } from "@arkecosystem/core-transactions"; 3 | import { Interfaces } from "@arkecosystem/crypto"; 4 | 5 | export class RevertTransactionAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const handler: Handlers.TransactionHandler = args.handler; 8 | const transaction: Interfaces.ITransaction = args.transaction; 9 | 10 | return handler.revert(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/throw-if-cannot-enter-pool.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Handlers } from "@arkecosystem/core-transactions"; 3 | import { Interfaces } from "@arkecosystem/crypto"; 4 | 5 | export class ThrowIfCannotEnterPoolAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const handler: Handlers.TransactionHandler = args.handler; 8 | const transaction: Interfaces.ITransaction = args.transaction; 9 | 10 | return handler.throwIfCannotEnterPool(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/actions/verify-transaction.ts: -------------------------------------------------------------------------------- 1 | import { Services, Types } from "@arkecosystem/core-kernel"; 2 | import { Handlers } from "@arkecosystem/core-transactions"; 3 | import { Interfaces } from "@arkecosystem/crypto"; 4 | 5 | export class VerifyTransactionAction extends Services.Triggers.Action { 6 | public async execute(args: Types.ActionArguments): Promise { 7 | const handler: Handlers.TransactionHandler = args.handler; 8 | const transaction: Interfaces.ITransaction = args.transaction; 9 | 10 | return handler.verify(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./actions"; 2 | export * from "./collator"; 3 | export * from "./dynamic-fee-matcher"; 4 | export * from "./errors"; 5 | export * from "./expiration-service"; 6 | export * from "./mempool"; 7 | export * from "./processor-dynamic-fee-extension"; 8 | export * from "./processor"; 9 | export * from "./query"; 10 | export * from "./sender-mempool"; 11 | export * from "./sender-state"; 12 | export * from "./service-provider"; 13 | export * from "./service"; 14 | export * from "./storage"; 15 | export * from "./utils"; 16 | export * from "./worker-pool"; 17 | export * from "./worker"; 18 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/processor-dynamic-fee-extension.ts: -------------------------------------------------------------------------------- 1 | import { Container, Contracts } from "@arkecosystem/core-kernel"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | @Container.injectable() 5 | export class ProcessorDynamicFeeExtension extends Contracts.TransactionPool.ProcessorExtension { 6 | @Container.inject(Container.Identifiers.TransactionPoolDynamicFeeMatcher) 7 | private readonly dynamicFeeMatcher!: Contracts.TransactionPool.DynamicFeeMatcher; 8 | 9 | public async throwIfCannotBroadcast(transaction: Interfaces.ITransaction): Promise { 10 | await this.dynamicFeeMatcher.throwIfCannotBroadcast(transaction); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/worker-script.ts: -------------------------------------------------------------------------------- 1 | import { Utils as AppUtils } from "@arkecosystem/core-kernel"; 2 | 3 | import { WorkerScriptHandler } from "./worker-script-handler"; 4 | 5 | const ipcHandler = new AppUtils.IpcHandler(new WorkerScriptHandler()); 6 | ipcHandler.handleAction("loadCryptoPackage"); 7 | ipcHandler.handleAction("setConfig"); 8 | ipcHandler.handleAction("setHeight"); 9 | ipcHandler.handleRequest("getTransactionFromData"); 10 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-transactions/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | memoizerCacheSize: process.env.CORE_TRANSACTIONS_MEMOIZER_CACHE_SIZE || 20000, 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-transactions/src/enums.ts: -------------------------------------------------------------------------------- 1 | export enum MempoolIndexes { 2 | DelegateUsername = "delegate-username", 3 | HtlcClaimTransactionId = "htlc-claim-transaction-id", 4 | HtlcRefundTransactionId = "htlc-refund-transaction-id", 5 | Ipfs = "ipfs", 6 | MultiSignatureAddress = "multi-signature-address", 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-transactions/src/handlers/index.ts: -------------------------------------------------------------------------------- 1 | import { TransactionHandlerProvider } from "./handler-provider"; 2 | import { TransactionHandlerRegistry } from "./handler-registry"; 3 | export * as One from "./one"; 4 | import { TransactionHandler, TransactionHandlerConstructor } from "./transaction"; 5 | export * as Two from "./two"; 6 | 7 | export { 8 | TransactionHandler, 9 | TransactionHandlerConstructor, 10 | TransactionHandlerRegistry as Registry, 11 | TransactionHandlerProvider, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/core-transactions/src/handlers/one/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./transfer"; 2 | export * from "./second-signature-registration"; 3 | export * from "./delegate-registration"; 4 | export * from "./vote"; 5 | export * from "./multi-signature-registration"; 6 | -------------------------------------------------------------------------------- /packages/core-transactions/src/handlers/two/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./transfer"; 2 | export * from "./second-signature-registration"; 3 | export * from "./delegate-registration"; 4 | export * from "./vote"; 5 | export * from "./multi-signature-registration"; 6 | export * from "./ipfs"; 7 | export * from "./multi-payment"; 8 | export * from "./delegate-resignation"; 9 | export * from "./htlc-lock"; 10 | export * from "./htlc-claim"; 11 | export * from "./htlc-refund"; 12 | -------------------------------------------------------------------------------- /packages/core-transactions/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | 3 | export * as Errors from "./errors"; 4 | export * as Handlers from "./handlers"; 5 | -------------------------------------------------------------------------------- /packages/core-transactions/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { Managers, Utils } from "@arkecosystem/crypto"; 2 | 3 | export const isRecipientOnActiveNetwork = (recipientId: string): boolean => 4 | Utils.Base58.decodeCheck(recipientId).readUInt8(0) === Managers.configManager.get("network.pubKeyHash"); 5 | -------------------------------------------------------------------------------- /packages/core-transactions/src/verification/cache.ts: -------------------------------------------------------------------------------- 1 | import { Container, Utils } from "@arkecosystem/core-kernel"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | @Container.injectable() 5 | export class Cache { 6 | protected cache: Map = new Map(); 7 | 8 | public clear(transactionId: string): void { 9 | this.cache.delete(transactionId); 10 | } 11 | 12 | protected getKey(transaction: Interfaces.ITransactionData): string { 13 | Utils.assert.defined(transaction.id); 14 | return transaction.id; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/core-transactions/src/verification/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./multi-signature-verification-memoized"; 2 | export * from "./multi-signature-verification"; 3 | export * from "./second-signature-verification-memoized"; 4 | export * from "./second-signature-verification"; 5 | -------------------------------------------------------------------------------- /packages/core-transactions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | enabled: !!process.env.CORE_WEBHOOKS_ENABLED, 3 | server: { 4 | http: { 5 | host: process.env.CORE_WEBHOOKS_HOST || "0.0.0.0", 6 | port: process.env.CORE_WEBHOOKS_PORT || 4004, 7 | }, 8 | whitelist: ["127.0.0.1", "::ffff:127.0.0.1"], 9 | }, 10 | timeout: process.env.CORE_WEBHOOKS_TIMEOUT || 1500, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/events.ts: -------------------------------------------------------------------------------- 1 | export enum WebhookEvent { 2 | Broadcasted = "webhooks.broadcasted", 3 | Failed = "webhooks.failed", 4 | } 5 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/identifiers.ts: -------------------------------------------------------------------------------- 1 | export const Identifiers = { 2 | Broadcaster: Symbol.for("Webhook"), 3 | Database: Symbol.for("Webhook"), 4 | Listener: Symbol.for("Webhook"), 5 | Server: Symbol.for("Webhook"), 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service-provider"; 2 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @export 3 | * @interface Webhook 4 | */ 5 | export interface Webhook { 6 | id?: string; 7 | token?: string; 8 | 9 | event: string; 10 | target: string; 11 | enabled: boolean; 12 | conditions: Array<{ 13 | key: string; 14 | value: any; 15 | condition: string; 16 | }>; 17 | } 18 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/server/utils.ts: -------------------------------------------------------------------------------- 1 | import { Boom, notFound } from "@hapi/boom"; 2 | 3 | import { Webhook } from "../interfaces"; 4 | 5 | /** 6 | * @param {*} model 7 | * @returns {Webhook} 8 | */ 9 | export const transformResource = (model): Webhook => ({ 10 | id: model.id, 11 | event: model.event, 12 | target: model.target, 13 | token: model.token, 14 | enabled: model.enabled, 15 | conditions: model.conditions, 16 | }); 17 | 18 | /** 19 | * @param {*} data 20 | * @returns {{ data: Webhook }} 21 | */ 22 | export const respondWithResource = (data): { data: Webhook } | Boom => 23 | data ? { data: transformResource(data) } : notFound(); 24 | -------------------------------------------------------------------------------- /packages/core-webhooks/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core/bin/config/devnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=debug 3 | 4 | CORE_DB_HOST=localhost 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4002 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_MANAGER_HOST=0.0.0.0 14 | CORE_MANAGER_PORT=4005 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | -------------------------------------------------------------------------------- /packages/core/bin/config/devnet/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "ark", 3 | "network": "devnet" 4 | } 5 | -------------------------------------------------------------------------------- /packages/core/bin/config/devnet/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/devnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "167.114.29.51", 5 | "port": 4002 6 | }, 7 | { 8 | "ip": "167.114.29.52", 9 | "port": 4002 10 | }, 11 | { 12 | "ip": "167.114.29.53", 13 | "port": 4002 14 | }, 15 | { 16 | "ip": "167.114.29.54", 17 | "port": 4002 18 | }, 19 | { 20 | "ip": "167.114.29.55", 21 | "port": 4002 22 | } 23 | ], 24 | "sources": ["https://raw.githubusercontent.com/ARKEcosystem/peers/master/devnet.json"] 25 | } 26 | -------------------------------------------------------------------------------- /packages/core/bin/config/mainnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=info 2 | CORE_LOG_LEVEL_FILE=debug 3 | 4 | CORE_DB_HOST=localhost 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4001 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_MANAGER_HOST=0.0.0.0 14 | CORE_MANAGER_PORT=4005 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | -------------------------------------------------------------------------------- /packages/core/bin/config/mainnet/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "ark", 3 | "network": "mainnet" 4 | } 5 | -------------------------------------------------------------------------------- /packages/core/bin/config/mainnet/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/testnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=info 2 | CORE_LOG_LEVEL_FILE=debug 3 | 4 | CORE_DB_HOST=localhost 5 | CORE_DB_PORT=5432 6 | 7 | CORE_P2P_HOST=0.0.0.0 8 | CORE_P2P_PORT=4000 9 | 10 | CORE_WEBHOOKS_HOST=0.0.0.0 11 | CORE_WEBHOOKS_PORT=4004 12 | 13 | CORE_MANAGER_HOST=0.0.0.0 14 | CORE_MANAGER_PORT=4005 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | -------------------------------------------------------------------------------- /packages/core/bin/config/testnet/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "ark", 3 | "network": "testnet" 4 | } 5 | -------------------------------------------------------------------------------- /packages/core/bin/config/testnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "127.0.0.1", 5 | "port": 4000 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /packages/core/src/exceptions/index.ts: -------------------------------------------------------------------------------- 1 | export * as Base from "./base"; 2 | export * as Crypto from "./crypto"; 3 | -------------------------------------------------------------------------------- /packages/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./cli"; 2 | export * from "./exceptions"; 3 | -------------------------------------------------------------------------------- /packages/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/crypto/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArkEcosystem/core/1812cb2b88e279448133e4df93eadbc82e8116e8/packages/crypto/banner.png -------------------------------------------------------------------------------- /packages/crypto/src/blocks/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block"; 2 | export * from "./deserializer"; 3 | export * from "./factory"; 4 | export * from "./serializer"; 5 | -------------------------------------------------------------------------------- /packages/crypto/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const SATOSHI = 1e8; 2 | export const ARKTOSHI: number = SATOSHI; 3 | -------------------------------------------------------------------------------- /packages/crypto/src/crypto/index.ts: -------------------------------------------------------------------------------- 1 | export * as bip38 from "./bip38"; 2 | export { Hash } from "./hash"; 3 | export { HashAlgorithms } from "./hash-algorithms"; 4 | export { HDWallet } from "./hdwallet"; 5 | export { Message } from "./message"; 6 | export { Slots, GetBlockTimeStampLookup } from "./slots"; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/enums.ts: -------------------------------------------------------------------------------- 1 | export enum TransactionType { 2 | Transfer = 0, 3 | SecondSignature = 1, 4 | DelegateRegistration = 2, 5 | Vote = 3, 6 | MultiSignature = 4, 7 | Ipfs = 5, 8 | MultiPayment = 6, 9 | DelegateResignation = 7, 10 | HtlcLock = 8, 11 | HtlcClaim = 9, 12 | HtlcRefund = 10, 13 | } 14 | 15 | export enum TransactionTypeGroup { 16 | Test = 0, 17 | Core = 1, 18 | 19 | // Everything above is available to anyone 20 | Reserved = 1000, 21 | } 22 | 23 | export enum HtlcLockExpirationType { 24 | EpochTimestamp = 1, 25 | BlockHeight = 2, 26 | } 27 | -------------------------------------------------------------------------------- /packages/crypto/src/identities/helpers.ts: -------------------------------------------------------------------------------- 1 | import { Network } from "../interfaces/networks"; 2 | import { configManager } from "../managers"; 3 | 4 | export const getWifFromNetwork = (network?: Network): number => network ? network.wif : configManager.get("network.wif"); 5 | export const getPubKeyHashFromNetwork = (network?: Network): number => network ? network.pubKeyHash : configManager.get("network.pubKeyHash"); 6 | 7 | export const getPubKeyHash = (networkVersion?: number): number => networkVersion || configManager.get("network.pubKeyHash"); 8 | -------------------------------------------------------------------------------- /packages/crypto/src/identities/index.ts: -------------------------------------------------------------------------------- 1 | export { Address } from "./address"; 2 | export { Keys } from "./keys"; 3 | export { PrivateKey } from "./private-key"; 4 | export { PublicKey } from "./public-key"; 5 | export { WIF } from "./wif"; 6 | -------------------------------------------------------------------------------- /packages/crypto/src/identities/private-key.ts: -------------------------------------------------------------------------------- 1 | import { PrivateKey as Identity } from "@arkecosystem/crypto-identities"; 2 | 3 | import { Network } from "../interfaces"; 4 | import { getWifFromNetwork } from "./helpers"; 5 | 6 | export class PrivateKey { 7 | public static fromPassphrase(passphrase: string): string { 8 | return Identity.fromPassphrase(passphrase); 9 | } 10 | 11 | public static fromWIF(wif: string, network?: Network): string { 12 | return Identity.fromWIF(wif, { wif: getWifFromNetwork(network) }); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/crypto/src/identities/wif.ts: -------------------------------------------------------------------------------- 1 | import { WIF as Identity } from "@arkecosystem/crypto-identities"; 2 | 3 | import { IKeyPair } from "../interfaces"; 4 | import { Network } from "../interfaces/networks"; 5 | import { getWifFromNetwork } from "./helpers"; 6 | 7 | export class WIF { 8 | public static fromPassphrase(passphrase: string, network?: Network): string { 9 | return Identity.fromPassphrase(passphrase, { wif: getWifFromNetwork(network) }); 10 | } 11 | 12 | public static fromKeys(keys: IKeyPair, network?: Network): string { 13 | return Identity.fromKeys(keys, { wif: getWifFromNetwork(network) }); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/crypto/src/index.ts: -------------------------------------------------------------------------------- 1 | export * as Blocks from "./blocks"; 2 | export * as Constants from "./constants"; 3 | export * as Crypto from "./crypto"; 4 | export * as Enums from "./enums"; 5 | export * as Errors from "./errors"; 6 | export * as Identities from "./identities"; 7 | export * as Interfaces from "./interfaces"; 8 | export * as Managers from "./managers"; 9 | export * as Networks from "./networks"; 10 | export * as Transactions from "./transactions"; 11 | export * as Types from "./types"; 12 | export * as Utils from "./utils"; 13 | export * as Validation from "./validation"; 14 | -------------------------------------------------------------------------------- /packages/crypto/src/interfaces/crypto.ts: -------------------------------------------------------------------------------- 1 | export interface IDecryptResult { 2 | privateKey: Buffer; 3 | compressed: boolean; 4 | } 5 | -------------------------------------------------------------------------------- /packages/crypto/src/interfaces/identities.ts: -------------------------------------------------------------------------------- 1 | export interface IKeyPair { 2 | publicKey: string; 3 | privateKey: string; 4 | compressed: boolean; 5 | } 6 | -------------------------------------------------------------------------------- /packages/crypto/src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./block"; 2 | export * from "./crypto"; 3 | export * from "./identities"; 4 | export * from "./managers"; 5 | export * from "./message"; 6 | export * from "./networks"; 7 | export * from "./transactions"; 8 | -------------------------------------------------------------------------------- /packages/crypto/src/interfaces/managers.ts: -------------------------------------------------------------------------------- 1 | export interface IMilestone { 2 | index: number; 3 | data: { [key: string]: any }; 4 | } 5 | -------------------------------------------------------------------------------- /packages/crypto/src/interfaces/message.ts: -------------------------------------------------------------------------------- 1 | export interface IMessage { 2 | readonly publicKey: string; 3 | readonly signature: string; 4 | readonly message: string; 5 | } 6 | -------------------------------------------------------------------------------- /packages/crypto/src/managers/index.ts: -------------------------------------------------------------------------------- 1 | export { configManager } from "./config"; 2 | export { NetworkManager } from "./network"; 3 | -------------------------------------------------------------------------------- /packages/crypto/src/managers/network.ts: -------------------------------------------------------------------------------- 1 | import { NetworkConfig } from "../interfaces/networks"; 2 | import * as networks from "../networks"; 3 | import { NetworkName } from "../types"; 4 | 5 | export class NetworkManager { 6 | public static all(): Record { 7 | // @ts-ignore - the newly generated unitnet doesn't match the old configs because it has things like a nonce field 8 | return (networks as unknown) as Record; 9 | } 10 | 11 | public static findByName(name: NetworkName): NetworkConfig { 12 | return networks[name.toLowerCase()]; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/index.ts: -------------------------------------------------------------------------------- 1 | export * from "@arkecosystem/crypto-networks"; 2 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./builders"; 2 | export * from "./deserializer"; 3 | export * from "./factory"; 4 | export * from "./serializer"; 5 | export * from "./signer"; 6 | export * from "./types"; 7 | export * from "./utils"; 8 | export * from "./verifier"; 9 | 10 | export { transactionRegistry as TransactionRegistry, TransactionConstructor } from "./registry"; 11 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./transaction"; 2 | export * from "./factory"; 3 | export * from "./internal-transaction-type"; 4 | 5 | export * as One from "./one"; 6 | export * as schemas from "./schemas"; 7 | export * as Two from "./two"; 8 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/one/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./transfer"; 2 | export * from "./second-signature-registration"; 3 | export * from "./delegate-registration"; 4 | export * from "./vote"; 5 | export * from "./multi-signature-registration"; 6 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/two/delegate-registration.ts: -------------------------------------------------------------------------------- 1 | import { One } from "../index"; 2 | 3 | export class DelegateRegistrationTransaction extends One.DelegateRegistrationTransaction { 4 | public static version: number = 2; 5 | } 6 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/two/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./transfer"; 2 | export * from "./second-signature-registration"; 3 | export * from "./delegate-registration"; 4 | export * from "./vote"; 5 | export * from "./multi-signature-registration"; 6 | export * from "./ipfs"; 7 | export * from "./multi-payment"; 8 | export * from "./delegate-resignation"; 9 | export * from "./htlc-lock"; 10 | export * from "./htlc-claim"; 11 | export * from "./htlc-refund"; 12 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/two/second-signature-registration.ts: -------------------------------------------------------------------------------- 1 | import { One } from "../index"; 2 | 3 | export class SecondSignatureRegistrationTransaction extends One.SecondSignatureRegistrationTransaction { 4 | public static version: number = 2; 5 | } 6 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/two/transfer.ts: -------------------------------------------------------------------------------- 1 | import { One } from "../index"; 2 | 3 | export class TransferTransaction extends One.TransferTransaction { 4 | public static version: number = 2; 5 | } 6 | -------------------------------------------------------------------------------- /packages/crypto/src/transactions/types/two/vote.ts: -------------------------------------------------------------------------------- 1 | import { One } from "../index"; 2 | 3 | export class VoteTransaction extends One.VoteTransaction { 4 | public static version: number = 2; 5 | } 6 | -------------------------------------------------------------------------------- /packages/crypto/src/types.ts: -------------------------------------------------------------------------------- 1 | import * as networks from "./networks"; 2 | 3 | export type NetworkType = 4 | | typeof networks.mainnet.network 5 | | typeof networks.devnet.network 6 | | typeof networks.testnet.network; 7 | 8 | export type NetworkName = keyof typeof networks; 9 | -------------------------------------------------------------------------------- /packages/crypto/src/utils/bignum.ts: -------------------------------------------------------------------------------- 1 | import { BigNumber } from "@arkecosystem/utils"; 2 | 3 | export { BigNumber }; 4 | -------------------------------------------------------------------------------- /packages/crypto/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base", ":preserveSemverRanges"], 3 | "baseBranches": ["develop"] 4 | } 5 | -------------------------------------------------------------------------------- /scripts/deps/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do 4 | cd $dir 5 | echo $PWD 6 | ../../node_modules/npm-check-updates/bin/npm-check-updates -u 7 | cd ../.. 8 | done 9 | -------------------------------------------------------------------------------- /scripts/docker/templates/devnet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | WORKDIR /core 4 | 5 | COPY entrypoint.sh / 6 | 7 | RUN apt-get update && \ 8 | apt-get -y install --no-install-recommends \ 9 | build-essential \ 10 | jq \ 11 | iptables \ 12 | python \ 13 | vim && \ 14 | rm -rf /var/lib/apt/lists/* 15 | 16 | EXPOSE 4002 4003 4012 4022 4040 17 | -------------------------------------------------------------------------------- /scripts/docker/templates/devnet/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sysctl -w net.ipv4.conf.all.route_localnet=1 4 | 5 | POSTGRES=$(ping -c 1 {token}-devnet-postgres | awk -F'[()]' '/PING/{print $2}') 6 | CORE=$(ping -c 1 {token}-devnet-core | awk -F'[()]' '/PING/{print $2}') 7 | 8 | iptables -I OUTPUT -t nat -o lo -d localhost -p tcp --dport 5432 -j DNAT --to-destination ${POSTGRES}:5432 9 | iptables -I POSTROUTING -t nat -p tcp --dport 5432 -d ${POSTGRES} -j SNAT --to ${CORE} 10 | 11 | cd /core 12 | rm -rf node_modules package-lock.json > /dev/null 2>&1 13 | rm -rf packages/core/node_modules packages/core/package-lock.json 2>&1 14 | yarn setup 15 | 16 | bash 17 | -------------------------------------------------------------------------------- /scripts/docker/templates/devnet/purge_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker stop $(docker ps -aq) 4 | docker rm $(docker ps -aq) 5 | docker rmi $(docker images -q) 6 | docker volume prune -f 7 | docker network prune -f 8 | -------------------------------------------------------------------------------- /scripts/docker/templates/devnet/restore.sh: -------------------------------------------------------------------------------- 1 | DOCKER_DB_NAME="$(docker-compose ps -q postgres)" 2 | DB_HOSTNAME=postgres 3 | DB_USER={token} 4 | LOCAL_DUMP_PATH="snapshot.dump" 5 | 6 | docker-compose up -d postgres 7 | docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" 8 | docker-compose stop postgres 9 | -------------------------------------------------------------------------------- /scripts/docker/templates/mainnet/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | 4 | postgres: 5 | image: "postgres:alpine" 6 | container_name: {token}-mainnet-postgres 7 | ports: 8 | - '127.0.0.1:5432:5432' 9 | volumes: 10 | - 'postgres:/var/lib/postgresql/data' 11 | environment: 12 | POSTGRES_PASSWORD: password 13 | POSTGRES_DB: {token}_mainnet 14 | POSTGRES_USER: {token} 15 | 16 | volumes: 17 | postgres: 18 | -------------------------------------------------------------------------------- /scripts/docker/templates/testnet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:12 2 | 3 | WORKDIR /core 4 | 5 | COPY entrypoint.sh / 6 | 7 | RUN apt-get update && \ 8 | apt-get -y install --no-install-recommends \ 9 | build-essential \ 10 | jq \ 11 | iptables \ 12 | python \ 13 | vim && \ 14 | rm -rf /var/lib/apt/lists/* 15 | 16 | EXPOSE 4000 4003 4010 4020 4040 17 | 18 | -------------------------------------------------------------------------------- /scripts/docker/templates/testnet/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sysctl -w net.ipv4.conf.all.route_localnet=1 4 | 5 | POSTGRES=$(ping -c 1 {token}-testnet-postgres | awk -F'[()]' '/PING/{print $2}') 6 | CORE=$(ping -c 1 {token}-testnet-core | awk -F'[()]' '/PING/{print $2}') 7 | 8 | iptables -I OUTPUT -t nat -o lo -d localhost -p tcp --dport 5432 -j DNAT --to-destination ${POSTGRES}:5432 9 | iptables -I POSTROUTING -t nat -p tcp --dport 5432 -d ${POSTGRES} -j SNAT --to ${CORE} 10 | 11 | cd /core 12 | rm -rf node_modules package-lock.json > /dev/null 2>&1 13 | rm -rf packages/core/node_modules packages/core/package-lock.json 2>&1 14 | yarn setup 15 | 16 | bash 17 | -------------------------------------------------------------------------------- /scripts/docker/templates/testnet/purge_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker stop $(docker ps -aq) 4 | docker rm $(docker ps -aq) 5 | docker rmi $(docker images -q) 6 | docker volume prune -f 7 | docker network prune -f 8 | -------------------------------------------------------------------------------- /scripts/docker/templates/testnet/restore.sh: -------------------------------------------------------------------------------- 1 | DOCKER_DB_NAME="$(docker-compose ps -q postgres)" 2 | DB_HOSTNAME=postgres 3 | DB_USER={token} 4 | LOCAL_DUMP_PATH="snapshot.dump" 5 | 6 | docker-compose up -d postgres 7 | docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" 8 | docker-compose stop postgres 9 | -------------------------------------------------------------------------------- /scripts/docker/templates/unitnet/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | 4 | postgres: 5 | image: "postgres:alpine" 6 | container_name: {token}-unitnet-postgres 7 | ports: 8 | - '127.0.0.1:5432:5432' 9 | volumes: 10 | - 'postgres:/var/lib/postgresql/data' 11 | environment: 12 | POSTGRES_PASSWORD: password 13 | POSTGRES_DB: {token}_unitnet 14 | POSTGRES_USER: {token} 15 | 16 | volumes: 17 | postgres: 18 | -------------------------------------------------------------------------------- /scripts/docker/templates/unitnet/purge.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | docker stop {token}-unitnet-postgres 4 | docker rm -v {token}-unitnet-postgres 5 | docker volume rm unitnet_postgres 6 | docker network rm unitnet_default 7 | -------------------------------------------------------------------------------- /scripts/pre-test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | yarn lint 4 | yarn build 5 | rm -rf ~/.core/database 6 | -------------------------------------------------------------------------------- /scripts/publish/alpha.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do 4 | git checkout develop 5 | cd $dir 6 | echo $PWD 7 | npm publish --tag alpha 8 | cd ../.. 9 | done 10 | -------------------------------------------------------------------------------- /scripts/publish/beta.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do 4 | git checkout develop 5 | cd $dir 6 | echo $PWD 7 | npm publish --tag beta 8 | cd ../.. 9 | done 10 | -------------------------------------------------------------------------------- /scripts/publish/latest.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do 4 | git checkout master 5 | cd $dir 6 | echo $PWD 7 | npm publish --tag latest 8 | cd ../.. 9 | done 10 | -------------------------------------------------------------------------------- /scripts/publish/next.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do 4 | git checkout develop 5 | cd $dir 6 | echo $PWD 7 | npm publish --tag next 8 | cd ../.. 9 | done 10 | -------------------------------------------------------------------------------- /scripts/publish/rc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | for dir in `find packages -mindepth 1 -maxdepth 1 -type d | sort -nr`; do 4 | git checkout develop 5 | cd $dir 6 | echo $PWD 7 | npm publish --tag rc 8 | cd ../.. 9 | done 10 | -------------------------------------------------------------------------------- /scripts/upgrade/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | rm -rf /home/ark/ark-core 4 | git clone https://github.com/ARKEcosystem/core -b upgrade /home/ark/ark-core 5 | 6 | mkdir /home/ark/.ark 7 | touch /home/ark/.ark/.env 8 | 9 | mkdir /home/ark/.ark/config 10 | 11 | mkdir /home/ark/.ark/database 12 | touch /home/ark/.ark/database/json-rpc.sqlite 13 | touch /home/ark/.ark/database/transaction-pool.sqlite 14 | touch /home/ark/.ark/database/webhooks.sqlite 15 | 16 | mkdir /home/ark/.ark/logs 17 | mkdir /home/ark/.ark/logs/mainnet 18 | touch /home/ark/.ark/logs/mainnet/test.log 19 | -------------------------------------------------------------------------------- /scripts/version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | lerna version $1 --exact --no-git-tag-version --yes 4 | -------------------------------------------------------------------------------- /tsconfig.eslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules"] 4 | } 5 | -------------------------------------------------------------------------------- /tsconfig.test.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "strict": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /upgrade/2.1.0/exchange.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd ~/ark-core 4 | pm2 delete ark-core 5 | pm2 delete ark-core-relay 6 | git reset --hard 7 | git pull 8 | git checkout master 9 | yarn run bootstrap 10 | yarn run upgrade 11 | 12 | pm2 --name 'ark-core-relay' start ~/ark-core/packages/core/dist/index.js -- relay --network mainnet 13 | -------------------------------------------------------------------------------- /upgrade/2.1.0/normal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | cd ~/ark-core 4 | pm2 delete all 5 | git reset --hard 6 | git pull 7 | git checkout master 8 | yarn run bootstrap 9 | yarn run upgrade 10 | 11 | # If you do not use Core Commander you can skip this step. 12 | cd ~/core-commander 13 | git reset --hard 14 | git pull 15 | git checkout master 16 | bash commander.sh 17 | -------------------------------------------------------------------------------- /vagrant/centos/6/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "centos/6" 3 | config.vm.provision :shell, path: "../../bootstrap.sh" 4 | config.vm.network "private_network", ip: "192.168.33.10" 5 | config.vm.provider "virtualbox" do |vb| 6 | vb.memory = "2048" 7 | vb.cpus = 2 8 | end 9 | config.vm.synced_folder "../../../", "/vagrant" 10 | end 11 | -------------------------------------------------------------------------------- /vagrant/centos/7/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "centos/7" 3 | config.vm.provision :shell, path: "../../bootstrap.sh" 4 | config.vm.network "private_network", ip: "192.168.33.10" 5 | config.vm.provider "virtualbox" do |vb| 6 | vb.memory = "2048" 7 | vb.cpus = 2 8 | end 9 | config.vm.synced_folder "../../../", "/vagrant" 10 | end 11 | -------------------------------------------------------------------------------- /vagrant/debian/8_10/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "debian/jessie64" 3 | config.vm.provision :shell, path: "../../bootstrap.sh" 4 | config.vm.network "private_network", ip: "192.168.33.10" 5 | config.vm.provider "virtualbox" do |vb| 6 | vb.memory = "2048" 7 | vb.cpus = 2 8 | end 9 | config.vm.synced_folder "../../../", "/vagrant" 10 | end 11 | -------------------------------------------------------------------------------- /vagrant/debian/9_4/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "debian/stretch64" 3 | config.vm.provision :shell, path: "../../bootstrap.sh" 4 | config.vm.network "private_network", ip: "192.168.33.10" 5 | config.vm.provider "virtualbox" do |vb| 6 | vb.memory = "2048" 7 | vb.cpus = 2 8 | end 9 | config.vm.synced_folder "../../../", "/vagrant" 10 | end 11 | -------------------------------------------------------------------------------- /vagrant/ubuntu/16_04/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "ubuntu/xenial64" 3 | config.vm.provision :shell, path: "../../bootstrap.sh" 4 | config.vm.network "private_network", ip: "192.168.33.10" 5 | config.vm.provider "virtualbox" do |vb| 6 | vb.memory = "2048" 7 | vb.cpus = 2 8 | end 9 | config.vm.synced_folder "../../../", "/vagrant" 10 | end 11 | -------------------------------------------------------------------------------- /vagrant/ubuntu/18_04/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure("2") do |config| 2 | config.vm.box = "ubuntu/bionic64" 3 | config.vm.provision :shell, path: "../../bootstrap.sh" 4 | config.vm.network "private_network", ip: "192.168.33.10" 5 | config.vm.provider "virtualbox" do |vb| 6 | vb.memory = "2048" 7 | vb.cpus = 2 8 | end 9 | config.vm.synced_folder "../../../", "/vagrant" 10 | end 11 | -------------------------------------------------------------------------------- /wallaby.js: -------------------------------------------------------------------------------- 1 | /* eslint-env node */ 2 | 3 | module.exports = () => { 4 | return { 5 | autoDetect: true, 6 | tests: [ 7 | "__tests__/unit/core-kernel/utils/search.test.ts", 8 | "__tests__/unit/core-database/**/*.test.ts", 9 | "__tests__/unit/core-p2p/transaction-broadcaster.test.ts", 10 | "__tests__/unit/core-transaction-pool/**/*.test.ts", 11 | ], 12 | workers: { initial: 1, regular: 1 }, 13 | }; 14 | }; 15 | --------------------------------------------------------------------------------