├── .codacy.yml ├── .codecov.yml ├── .editorconfig ├── .github ├── stale.yml ├── sync-script │ └── sync-script.sh └── workflows │ ├── benchmark.yml │ ├── functional.yml │ └── test.yml ├── .gitignore ├── .lintstagedrc.json ├── .nvmrc ├── .prettierignore ├── .prettierrc.json ├── .snyk ├── .yarnrc ├── CHANGELOG.md ├── CODEOWNERS ├── LICENSE ├── README.md ├── __tests__ ├── e2e │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── bin │ │ └── e2e │ ├── img │ │ ├── core-e2e-banner.png │ │ └── docker-architecture.png │ ├── lib │ │ ├── config │ │ │ ├── docker-compose.yml │ │ │ ├── nginx │ │ │ │ └── nginx.conf │ │ │ ├── nodes │ │ │ │ ├── Dockerfile │ │ │ │ ├── core0 │ │ │ │ │ ├── .env │ │ │ │ │ ├── delegates.json │ │ │ │ │ ├── peers.json │ │ │ │ │ └── plugins.js │ │ │ │ ├── core1 │ │ │ │ │ ├── .env │ │ │ │ │ ├── delegates.json │ │ │ │ │ ├── peers.json │ │ │ │ │ └── plugins.js │ │ │ │ ├── core2 │ │ │ │ │ ├── .env │ │ │ │ │ ├── delegates.json │ │ │ │ │ ├── peers.json │ │ │ │ │ └── plugins.js │ │ │ │ ├── core3 │ │ │ │ │ ├── .env │ │ │ │ │ ├── delegates.json │ │ │ │ │ ├── peers.json │ │ │ │ │ └── plugins.js │ │ │ │ └── core4 │ │ │ │ │ ├── .env │ │ │ │ │ ├── delegates.json │ │ │ │ │ ├── peers.json │ │ │ │ │ └── plugins.js │ │ │ └── peer-discovery │ │ │ │ ├── Dockerfile │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ ├── run.js │ │ └── utils │ │ │ ├── sync.sh │ │ │ ├── test-utils.js │ │ │ └── testnet.js │ ├── package.json │ ├── tests │ │ └── scenarios │ │ │ └── scenario1 │ │ │ ├── business-bridgechain │ │ │ ├── 0.0.transfer-new-wallet.action.js │ │ │ ├── 1.0.business-registration.action.js │ │ │ ├── 1.1.check-business-registration.test.js │ │ │ ├── 2.0.business-update.action.js │ │ │ ├── 2.1.check-business-update.test.js │ │ │ ├── 3.0.bridgechain-registration.action.js │ │ │ ├── 3.1.check-bridgechain-registration.test.js │ │ │ ├── 4.0.bridgechain-update.action.js │ │ │ ├── 4.1.check-bridgechain-update.test.js │ │ │ ├── 5.0.bridgechain-resignation.action.js │ │ │ ├── 5.1.check-bridgechain-resignation.test.js │ │ │ ├── 6.0.business-resignation.action.js │ │ │ ├── 6.1.check-business-resignation.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ │ │ ├── chained-tx │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-transactions.action.js │ │ │ ├── 2.check-AtoB-forged.test.js │ │ │ ├── 3.resend-BtoC.action.js │ │ │ ├── 4.check-BtoC-forged.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ │ │ ├── config.js │ │ │ ├── doublespend-mix │ │ │ ├── 0.0.transfer-new-wallet.action.js │ │ │ ├── 0.1.init-2ndsig.action.js │ │ │ ├── 1.0.doublespend.action.js │ │ │ ├── 1.1.doublespend2ndsig.action.js │ │ │ ├── 2.check-tx.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ │ │ ├── doublespend │ │ │ ├── 0.0.transfer-new-wallet.action.js │ │ │ ├── 0.1.init-2ndsig.action.js │ │ │ ├── 1.0.doubletransfer.action.js │ │ │ ├── 1.1.doubletransfer2ndsig.action.js │ │ │ ├── 1.2.doublevote.action.js │ │ │ ├── 1.3.doubledelreg.action.js │ │ │ ├── 1.4.double2ndsigreg.action.js │ │ │ ├── 2.check-tx.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ │ │ ├── htlc-claim │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-lock-txs.action.js │ │ │ ├── 2.check-lock.test.js │ │ │ ├── 3.create-claim-txs.action.js │ │ │ ├── 4.check-claim.test.js │ │ │ ├── config.js │ │ │ ├── shared.js │ │ │ └── utils.js │ │ │ ├── htlc-refund │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-lock-txs.action.js │ │ │ ├── 2.check-lock.test.js │ │ │ ├── 3.create-refund-txs.action.js │ │ │ ├── 4.check-refund.test.js │ │ │ ├── config.js │ │ │ ├── shared.js │ │ │ └── utils.js │ │ │ ├── insufficient-balance │ │ │ ├── 0.0.transfer-new-wallet.action.js │ │ │ ├── 0.1.init-2ndsig.action.js │ │ │ ├── 1.0.transfer.action.js │ │ │ ├── 1.1.transfer2ndsig.action.js │ │ │ ├── 1.2.vote.action.js │ │ │ ├── 1.3.delreg.action.js │ │ │ ├── 1.4.2ndsigreg.action.js │ │ │ ├── 2.check-tx.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ │ │ ├── multisig-htlc-claim │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-multisig-registration.action.js │ │ │ ├── 2.check-registration.test.js │ │ │ ├── 3.transfer-multisig-wallet.action.js │ │ │ ├── 4.create-lock-multisig-txs.action.js │ │ │ ├── 5.create-claim-multisig-txs.action.js │ │ │ ├── 6.check-multisig.test.js │ │ │ ├── config.js │ │ │ ├── shared.js │ │ │ └── utils.js │ │ │ ├── multisig-htlc-refund │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-multisig-registration.action.js │ │ │ ├── 2.check-registration.test.js │ │ │ ├── 3.transfer-multisig-wallet.action.js │ │ │ ├── 4.create-lock-multisig-txs.action.js │ │ │ ├── 5.create-refund-multisig-txs.action.js │ │ │ ├── 6.check-multisig.test.js │ │ │ ├── config.js │ │ │ ├── shared.js │ │ │ └── utils.js │ │ │ ├── multisignature │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-multisig-registration.action.js │ │ │ ├── 2.check-registration.test.js │ │ │ ├── 3.transfer-multisig-wallet.action.js │ │ │ ├── 4.create-valid-multisig-txs.action.js │ │ │ ├── 5.create-invalid-multisig-txs.action.js │ │ │ ├── 6.check-multisig.test.js │ │ │ ├── config.js │ │ │ ├── shared.js │ │ │ └── utils.js │ │ │ ├── pool-restart │ │ │ ├── 0.transfer-new-wallet.action.js │ │ │ ├── 1.create-transactions.action.js │ │ │ ├── 2.check-unconfirmed.test.js │ │ │ ├── 3.stop-node.action.js │ │ │ ├── 4.0.restart-node.action.js │ │ │ ├── 4.1.check-tx-1.test.js │ │ │ ├── 5.check-node-pool.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ │ │ └── transactions-valid │ │ │ ├── 0.0.transfer-new-wallet.action.js │ │ │ ├── 0.1.init-2ndsig.action.js │ │ │ ├── 1.0.transaction.action.js │ │ │ ├── 1.1.transaction2ndsig.action.js │ │ │ ├── 2.check-tx.test.js │ │ │ ├── config.js │ │ │ └── utils.js │ └── tsconfig.json ├── functional │ ├── pool │ │ ├── __support__ │ │ │ └── index.ts │ │ └── pool.test.ts │ └── transaction-forging │ │ ├── __support__ │ │ ├── index.ts │ │ └── nospluginnet.ts │ │ ├── delegate-registration.test.ts │ │ ├── delegate-resignation.test.ts │ │ ├── entity-register.test.ts │ │ ├── entity-resign.test.ts │ │ ├── entity-update.test.ts │ │ ├── ipfs.test.ts │ │ ├── multi-payment.test.ts │ │ ├── multi-signature-registration.test.ts │ │ ├── second-signature-registration.test.ts │ │ ├── top-reward.test.ts │ │ ├── transfer.test.ts │ │ └── vote.test.ts ├── helpers │ ├── block-factory.ts │ ├── index.ts │ ├── peers.ts │ ├── rest-client.ts │ └── transaction-factory.ts ├── integration │ ├── core-api │ │ ├── __support__ │ │ │ ├── setup.ts │ │ │ └── utils │ │ │ │ └── generate-round.ts │ │ ├── handlers │ │ │ ├── blockchain.test.ts │ │ │ ├── blocks.test.ts │ │ │ ├── delegates.test.ts │ │ │ ├── entities.test.ts │ │ │ ├── locks.test.ts │ │ │ ├── node.test.ts │ │ │ ├── peers.test.ts │ │ │ ├── rounds.test.ts │ │ │ ├── transactions.test.ts │ │ │ ├── votes.test.ts │ │ │ └── wallets.test.ts │ │ ├── services │ │ │ ├── block-raw.json │ │ │ ├── block-transformed.json │ │ │ ├── transaction-raw.json │ │ │ ├── transaction-transformed.json │ │ │ └── transformer.test.ts │ │ └── utils.ts │ ├── core-blockchain │ │ ├── __support__ │ │ │ └── setup.ts │ │ └── blockchain.test.ts │ ├── core-database-postgres │ │ ├── __support__ │ │ │ └── setup.ts │ │ └── connection.test.ts │ ├── core-forger │ │ ├── __fixtures__ │ │ │ └── blocks.ts │ │ ├── client.test.ts │ │ └── mocks │ │ │ └── core-container.ts │ ├── core-http-utils │ │ └── src │ │ │ └── plugins │ │ │ └── trailing-slash.test.ts │ ├── core-magistrate │ │ ├── __support__ │ │ │ └── setup.ts │ │ ├── dynamic-fee.test.ts │ │ ├── fixtures │ │ │ ├── transaction-pool.ts │ │ │ └── transactions.ts │ │ ├── mocks │ │ │ ├── core-container.ts │ │ │ ├── database.ts │ │ │ └── state.ts │ │ └── processor.test.ts │ ├── core-p2p │ │ ├── __support__ │ │ │ ├── mock-socket-server │ │ │ │ ├── index.js │ │ │ │ ├── manager.ts │ │ │ │ └── worker.js │ │ │ ├── setup.ts │ │ │ └── utils.ts │ │ ├── fixtures │ │ │ ├── block-with-transactions.json │ │ │ └── block.json │ │ ├── mocks │ │ │ ├── core-container.ts │ │ │ └── p2p-options.ts │ │ ├── network-monitor.test.ts │ │ ├── peer-communicator.test.ts │ │ ├── peer-processor.test.ts │ │ ├── peer-verifier.test.ts │ │ └── socket-server │ │ │ ├── peer-with-remote-access.test.ts │ │ │ └── peer.test.ts │ ├── core-tester-cli │ │ ├── __fixtures__ │ │ │ ├── block.json │ │ │ ├── delegates-page-1.json │ │ │ ├── delegates-page-2.json │ │ │ ├── identities.json │ │ │ ├── transaction-1.json │ │ │ ├── transaction-response-1.json │ │ │ ├── transaction-second.json │ │ │ ├── transaction.json │ │ │ ├── voters-page-1.json │ │ │ ├── voters-page-2.json │ │ │ └── wallet-1.json │ │ ├── commands │ │ │ ├── debug │ │ │ │ ├── deserialize.test.ts │ │ │ │ ├── identity.test.ts │ │ │ │ ├── serialize.test.ts │ │ │ │ ├── verify-second.test.ts │ │ │ │ └── verify.test.ts │ │ │ ├── make │ │ │ │ └── block.test.ts │ │ │ └── send │ │ │ │ ├── delegate-registration.test.ts │ │ │ │ ├── fixtures.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.test.ts │ │ │ │ ├── transfer.test.ts │ │ │ │ └── vote.test.ts │ │ └── shared.ts │ ├── core-transaction-pool │ │ ├── __fixtures__ │ │ │ └── transactions.ts │ │ ├── __support__ │ │ │ └── setup.ts │ │ ├── processor.test.ts │ │ └── wallet-manager.test.ts │ ├── core-transactions │ │ ├── __support__ │ │ │ └── setup.ts │ │ └── handlers │ │ │ ├── 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.bak │ └── core-vote-report │ │ ├── __support__ │ │ └── setup.ts │ │ └── server.test.ts ├── unit │ ├── core-blockchain │ │ ├── blockchain.test.ts │ │ ├── machines │ │ │ ├── actions │ │ │ │ └── sync-with-network.test.ts │ │ │ └── blockchain.test.ts │ │ ├── mocks │ │ │ ├── blockchain.ts │ │ │ ├── config.ts │ │ │ ├── container.ts │ │ │ ├── database.ts │ │ │ ├── index.ts │ │ │ ├── logger.ts │ │ │ ├── p2p.ts │ │ │ ├── p2p │ │ │ │ ├── network-monitor.ts │ │ │ │ └── peer-storage.ts │ │ │ └── transactionPool.ts │ │ ├── processor │ │ │ ├── block-processor.test.ts │ │ │ ├── handlers │ │ │ │ ├── accept-handler.test.ts │ │ │ │ ├── exception-handler.test.ts │ │ │ │ └── unchained-handler.test.ts │ │ │ └── top-rewards.test.ts │ │ ├── state-machine.test.ts │ │ ├── stubs │ │ │ └── state-storage.ts │ │ └── utils │ │ │ └── tick-sync-tracker.test.ts │ ├── core-container │ │ ├── __stubs__ │ │ │ ├── config │ │ │ │ ├── app.js │ │ │ │ ├── delegates.json │ │ │ │ ├── exceptions.json │ │ │ │ ├── genesisBlock.json │ │ │ │ ├── milestones.json │ │ │ │ ├── network.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── plugin-a.js │ │ │ ├── plugin-b.js │ │ │ ├── plugin-c.js │ │ │ └── plugins.js │ │ ├── container.test.ts │ │ └── registrars │ │ │ └── plugin.test.ts │ ├── core-database │ │ ├── __fixtures__ │ │ │ ├── database-connection-stub.ts │ │ │ ├── mock-database-model.ts │ │ │ ├── state-storage-stub.ts │ │ │ └── wallets.json │ │ ├── database-service.test.ts │ │ ├── mocks │ │ │ ├── core-container.ts │ │ │ └── emitter.ts │ │ └── repositories │ │ │ ├── blocks-business-repository.test.ts │ │ │ ├── delegates-business-repository.test.ts │ │ │ ├── transactions-business-repository.test.ts │ │ │ ├── utils │ │ │ ├── filter-rows.test.ts │ │ │ └── search-parameter-converter.test.ts │ │ │ └── wallets-business-repository.test.ts │ ├── core-event-emitter │ │ └── emitter.test.ts │ ├── core-forger │ │ ├── __fixtures__ │ │ │ ├── block.ts │ │ │ └── delegate.ts │ │ ├── delegate.test.ts │ │ ├── manager.test.ts │ │ └── mocks │ │ │ └── core-container.ts │ ├── core-http-utils │ │ ├── mocks │ │ │ └── core-container.ts │ │ └── plugins │ │ │ └── content-type.test.ts │ ├── core-jest-matchers │ │ ├── api │ │ │ ├── block.test.ts │ │ │ ├── peer.test.ts │ │ │ ├── response.test.ts │ │ │ └── transaction.test.ts │ │ ├── blockchain │ │ │ ├── dispatch.test.ts │ │ │ ├── execute-on-entry.test.ts │ │ │ └── transition.test.ts │ │ ├── fields │ │ │ ├── address.test.ts │ │ │ └── public-key.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 │ ├── core-logger-pino │ │ └── logger.test.ts │ ├── core-logger-signale │ │ └── logger.test.ts │ ├── core-logger-winston │ │ └── logger.test.ts │ ├── core-logger │ │ ├── __stubs__ │ │ │ └── logger.ts │ │ ├── logger.test.ts │ │ └── manager.test.ts │ ├── core-p2p │ │ ├── mocks │ │ │ ├── blockchain.ts │ │ │ ├── core-container.ts │ │ │ ├── database.ts │ │ │ ├── logger.ts │ │ │ ├── p2p.ts │ │ │ ├── p2p │ │ │ │ ├── network-monitor.ts │ │ │ │ ├── peer-processor.ts │ │ │ │ └── peer-storage.ts │ │ │ ├── request.ts │ │ │ ├── scworker.ts │ │ │ ├── state.ts │ │ │ └── transaction-pool.ts │ │ ├── network-monitor.test.ts │ │ ├── peer-processor.test.ts │ │ ├── peer-repository.test.ts │ │ ├── peer-storage.test.ts │ │ ├── peer.test.ts │ │ ├── socket-server │ │ │ ├── utils │ │ │ │ └── validate.test.ts │ │ │ ├── versions │ │ │ │ ├── internal │ │ │ │ │ └── handlers │ │ │ │ │ │ ├── blockchain.test.ts │ │ │ │ │ │ ├── network.test.ts │ │ │ │ │ │ ├── rate-limiter.test.ts │ │ │ │ │ │ ├── rounds.test.ts │ │ │ │ │ │ ├── transactions.test.ts │ │ │ │ │ │ └── utils.test.ts │ │ │ │ └── peer │ │ │ │ │ └── index.test.ts │ │ │ └── worker.test.ts │ │ └── utils │ │ │ ├── check-dns.test.ts │ │ │ ├── check-ntp.test.ts │ │ │ ├── is-valid-version.test.ts │ │ │ └── is-whitelist.test.ts │ ├── core-snapshots │ │ ├── .gitkeep │ │ ├── fixtures │ │ │ ├── blocks.ts │ │ │ └── transactions.ts │ │ └── transport │ │ │ └── codec.test.ts │ ├── core-state │ │ ├── __fixtures__ │ │ │ ├── database-connection-stub.ts │ │ │ ├── mock-database-model.ts │ │ │ ├── state-storage-stub.ts │ │ │ └── wallets.json │ │ ├── mocks │ │ │ ├── blockchain.ts │ │ │ ├── config.ts │ │ │ ├── container.ts │ │ │ ├── database.ts │ │ │ ├── index.ts │ │ │ ├── logger.ts │ │ │ ├── p2p.ts │ │ │ ├── p2p │ │ │ │ ├── network-monitor.ts │ │ │ │ └── peer-storage.ts │ │ │ ├── state.ts │ │ │ └── transactionPool.ts │ │ ├── stores │ │ │ ├── blocks.test.ts │ │ │ ├── state.test.ts │ │ │ └── transactions.test.ts │ │ └── wallets │ │ │ ├── temp-wallet-manager.test.ts │ │ │ ├── wallet-index.test.ts │ │ │ ├── wallet-manager-htlc.test.ts │ │ │ ├── wallet-manager-multipayment.test.ts │ │ │ ├── wallet-manager.test.ts │ │ │ └── wallet.test.ts │ ├── core-transaction-pool │ │ ├── __fixtures__ │ │ │ └── transactions.ts │ │ ├── __stubs__ │ │ │ └── connection.ts │ │ ├── connection.forging.test.ts │ │ ├── connection.test.ts │ │ ├── dynamic-fee.test.ts │ │ ├── manager.test.ts │ │ ├── memory.test.ts │ │ ├── mocks │ │ │ ├── core-container.ts │ │ │ ├── database.ts │ │ │ └── state.ts │ │ ├── storage.test.ts │ │ ├── storage.with-mock.test.ts │ │ └── utils.test.ts │ ├── core-transactions │ │ ├── handler-registry.test.ts │ │ └── handler.test.ts │ ├── core-utils │ │ ├── capped-set.test.ts │ │ ├── delegate-calculator.test.ts │ │ ├── format-timestamp.test.ts │ │ ├── has-some-property.test.ts │ │ ├── is-blocked-chained.test.ts │ │ ├── is-whitelisted.test.ts │ │ ├── lock-expiration-calculator.test.ts │ │ ├── mocks │ │ │ ├── core-container-calculator.ts │ │ │ └── core-container.ts │ │ ├── nsect.test.ts │ │ ├── ordered-capped-map.test.ts │ │ ├── round-calculator.test.ts │ │ ├── sorted-array.test.ts │ │ ├── supply-calculator.test.ts │ │ ├── transform-plugins.test.ts │ │ └── tree.test.ts │ ├── core-webhooks │ │ ├── conditions.test.ts │ │ ├── database.test.ts │ │ └── server.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__ │ │ │ │ ├── transaction.ts │ │ │ │ └── wallet.ts │ │ │ ├── __support__ │ │ │ │ └── index.ts │ │ │ ├── builders │ │ │ │ ├── builder-factory.test.ts │ │ │ │ └── transactions │ │ │ │ │ ├── __shared__ │ │ │ │ │ └── transaction-builder.ts │ │ │ │ │ ├── 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 │ │ │ │ │ ├── transfer.test.ts │ │ │ │ │ └── vote.test.ts │ │ │ ├── deserializer.test.ts │ │ │ ├── factory.test.ts │ │ │ ├── schemas.test.ts │ │ │ ├── signer.test.ts │ │ │ ├── transaction.test.ts │ │ │ ├── utils.test.ts │ │ │ └── verifier.test.ts │ │ ├── utils │ │ │ ├── base58.test.ts │ │ │ ├── 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 │ ├── custom-fees │ │ └── fees.test.ts │ └── shared │ │ └── logger.ts └── utils │ ├── config │ ├── index.js │ ├── nospluginnet │ │ ├── .env │ │ ├── delegates.json │ │ ├── genesisBlock.json │ │ ├── genesisBlock.ts │ │ ├── peers.json │ │ └── plugins.js │ ├── testnet │ │ ├── .env │ │ ├── app.js │ │ ├── delegates.json │ │ ├── genesisBlock.json │ │ ├── genesisBlock.ts │ │ ├── peers.json │ │ └── plugins.js │ └── unitnet │ │ ├── app.js │ │ ├── delegates.json │ │ ├── genesisBlock.json │ │ ├── genesisBlock.ts │ │ ├── peers.json │ │ ├── plugins.js │ │ ├── wallets.json │ │ └── wallets2ndSig.json │ ├── fixtures │ ├── index.ts │ ├── nospluginnet │ │ └── blocks2to100.ts │ ├── testnet │ │ ├── block-model.ts │ │ ├── blocks101to155.ts │ │ ├── blocks2to100.ts │ │ ├── delegates.ts │ │ ├── index.ts │ │ └── passphrases.ts │ └── unitnet │ │ ├── block-model.ts │ │ ├── blocks.ts │ │ ├── delegates.ts │ │ ├── index.ts │ │ └── wallets.ts │ ├── generators │ ├── index.ts │ └── wallets.ts │ ├── helpers │ ├── api.ts │ ├── blockchain.ts │ ├── container.ts │ └── index.ts │ ├── identities.ts │ └── index.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 ├── 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.sh ├── lerna.json ├── package.json ├── packages ├── core-api │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── formats.ts │ │ ├── handlers │ │ │ ├── blockchain │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ └── routes.ts │ │ │ ├── blocks │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── delegates │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── entities │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── index.ts │ │ │ ├── locks │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── node │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── routes.ts │ │ │ │ └── schema.ts │ │ │ ├── peers │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── rounds │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── shared │ │ │ │ ├── controller.ts │ │ │ │ ├── iteratees.ts │ │ │ │ ├── schemas │ │ │ │ │ ├── address.ts │ │ │ │ │ ├── block-id.ts │ │ │ │ │ ├── generic-name.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── order-by.ts │ │ │ │ │ ├── pagination.ts │ │ │ │ │ ├── public-key.ts │ │ │ │ │ ├── username.ts │ │ │ │ │ └── wallet-id.ts │ │ │ │ └── transformers │ │ │ │ │ ├── fee-statistics.ts │ │ │ │ │ └── ports.ts │ │ │ ├── transactions │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ │ ├── utils.ts │ │ │ ├── votes │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ └── schema.ts │ │ │ └── wallets │ │ │ │ ├── controller.ts │ │ │ │ ├── index.ts │ │ │ │ ├── methods.ts │ │ │ │ ├── routes.ts │ │ │ │ ├── schema.ts │ │ │ │ └── transformer.ts │ │ ├── index.ts │ │ ├── interfaces │ │ │ ├── index.ts │ │ │ └── repository.ts │ │ ├── plugin.ts │ │ ├── plugins │ │ │ ├── pagination │ │ │ │ ├── config.ts │ │ │ │ ├── decorate.ts │ │ │ │ ├── ext.ts │ │ │ │ └── index.ts │ │ │ └── set-headers.ts │ │ ├── server.ts │ │ └── services │ │ │ ├── cache.ts │ │ │ ├── index.ts │ │ │ └── transformer.ts │ └── tsconfig.json ├── core-blockchain │ ├── package.json │ ├── src │ │ ├── blockchain.ts │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── machines │ │ │ ├── actions │ │ │ │ └── sync-with-network.ts │ │ │ └── blockchain.ts │ │ ├── plugin.ts │ │ ├── processor │ │ │ ├── block-processor.ts │ │ │ ├── handlers │ │ │ │ ├── accept-block-handler.ts │ │ │ │ ├── already-forged-handler.ts │ │ │ │ ├── block-handler.ts │ │ │ │ ├── exception-handler.ts │ │ │ │ ├── incompatible-transactions-handler.ts │ │ │ │ ├── index.ts │ │ │ │ ├── invalid-generator-handler.ts │ │ │ │ ├── invalid-reward-handler.ts │ │ │ │ ├── nonce-out-of-order-handler.ts │ │ │ │ ├── unchained-handler.ts │ │ │ │ └── verification-failed-handler.ts │ │ │ └── index.ts │ │ ├── replay │ │ │ ├── errors.ts │ │ │ ├── index.ts │ │ │ ├── memory-database-service.ts │ │ │ └── replay-blockchain.ts │ │ ├── state-machine.ts │ │ └── utils │ │ │ ├── index.ts │ │ │ ├── tick-sync-tracker.ts │ │ │ ├── validate-generator.ts │ │ │ └── validate-reward.ts │ └── tsconfig.json ├── core-container │ ├── package.json │ ├── src │ │ ├── config │ │ │ ├── file-loader.ts │ │ │ └── index.ts │ │ ├── container.ts │ │ ├── environment.ts │ │ ├── index.ts │ │ └── registrars │ │ │ └── plugin.ts │ └── tsconfig.json ├── core-database-postgres │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── migrations │ │ │ ├── 20180304100000-create-migrations-table.sql │ │ │ ├── 20180305100000-create-wallets-table.sql │ │ │ ├── 20180305200000-create-rounds-table.sql │ │ │ ├── 20180305300000-create-blocks-table.sql │ │ │ ├── 20180305400000-create-transactions-table.sql │ │ │ ├── 20181129400000-add-block_id-index-to-transactions-table.sql │ │ │ ├── 20181204100000-add-generator_public_key-index-to-blocks-table.sql │ │ │ ├── 20181204200000-add-timestamp-index-to-blocks-table.sql │ │ │ ├── 20181204300000-add-sender_public_key-index-to-transactions-table.sql │ │ │ ├── 20181204400000-add-recipient_id-index-to-transactions-table.sql │ │ │ ├── 20190307000000-drop-wallets-table.sql │ │ │ ├── 20190606000000-add-block-id-foreign-key-on-transactions.sql │ │ │ ├── 20190619000000-drop-id-column-from-rounds-table.sql │ │ │ ├── 20190626000000-enforce-chained-blocks.sql │ │ │ ├── 20190718000000-check_previous_block-add-schema.sql │ │ │ ├── 20190803000000-add-type_group-column-to-transactions-table.sql │ │ │ ├── 20190806000000-add-nonce-column-to-transactions-table.sql │ │ │ ├── 20190905000000-change-set_row_nonce-to-use-max-nonce.sql │ │ │ ├── 20190917000000-add-asset-column-to-transactions-table.sql │ │ │ ├── 20191003000000-migrate-vendor-field-hex.sql │ │ │ ├── 20191008000000-add-type-index-to-transactions-table.sql │ │ │ ├── 20200304000000-add-type_group-index-to-transactions-table.sql │ │ │ ├── 20200317000000-add-blocks-and-transactions-indexes.sql │ │ │ ├── 20201005000000-add-block-timestamp-index.sql │ │ │ ├── 20201117000000-add-generator_public_key_height-index-to-blocks-table.sql │ │ │ └── index.ts │ │ ├── models │ │ │ ├── block.ts │ │ │ ├── index.ts │ │ │ ├── migration.ts │ │ │ ├── model.ts │ │ │ ├── round.ts │ │ │ └── transaction.ts │ │ ├── plugin.ts │ │ ├── postgres-connection.ts │ │ ├── queries │ │ │ ├── blocks │ │ │ │ ├── common.sql │ │ │ │ ├── count.sql │ │ │ │ ├── delete.sql │ │ │ │ ├── find-by-height.sql │ │ │ │ ├── find-by-heights.sql │ │ │ │ ├── find-by-id.sql │ │ │ │ ├── headers.sql │ │ │ │ ├── height-range-with-transactions.sql │ │ │ │ ├── height-range.sql │ │ │ │ ├── latest.sql │ │ │ │ ├── recent.sql │ │ │ │ ├── statistics.sql │ │ │ │ └── top.sql │ │ │ ├── common │ │ │ │ └── truncate-all-tables.sql │ │ │ ├── index.ts │ │ │ ├── migrations │ │ │ │ ├── create.sql │ │ │ │ └── find.sql │ │ │ ├── rounds │ │ │ │ ├── delete.sql │ │ │ │ └── find.sql │ │ │ ├── state-builder │ │ │ │ ├── assets-by-type.sql │ │ │ │ ├── block-rewards.sql │ │ │ │ ├── claimed-locks.sql │ │ │ │ ├── count-type.sql │ │ │ │ ├── delegates-forged-blocks.sql │ │ │ │ ├── delegates.sql │ │ │ │ ├── ipfs.sql │ │ │ │ ├── last-forged-blocks.sql │ │ │ │ ├── multi-signatures.sql │ │ │ │ ├── open-locks.sql │ │ │ │ ├── received-transactions.sql │ │ │ │ ├── refunded-locks.sql │ │ │ │ ├── second-signatures.sql │ │ │ │ └── sent-transactions.sql │ │ │ └── transactions │ │ │ │ ├── delete-by-block.sql │ │ │ │ ├── fee-statistics.sql │ │ │ │ ├── find-by-block.sql │ │ │ │ ├── find-by-htlc-locks.sql │ │ │ │ ├── find-by-id.sql │ │ │ │ ├── forged.sql │ │ │ │ ├── latest-by-block.sql │ │ │ │ ├── latest-by-blocks.sql │ │ │ │ └── statistics.sql │ │ ├── repositories │ │ │ ├── blocks.ts │ │ │ ├── index.ts │ │ │ ├── migrations.ts │ │ │ ├── repository.ts │ │ │ ├── rounds.ts │ │ │ └── transactions.ts │ │ ├── sql │ │ │ └── query-executor.ts │ │ ├── state-builder.ts │ │ └── utils.ts │ └── tsconfig.json ├── core-database │ ├── package.json │ ├── src │ │ ├── database-service-factory.ts │ │ ├── database-service.ts │ │ ├── factory.ts │ │ ├── index.ts │ │ ├── manager.ts │ │ ├── plugin.ts │ │ └── repositories │ │ │ ├── blocks-business-repository.ts │ │ │ ├── transactions-business-repository.ts │ │ │ ├── utils │ │ │ ├── filter-rows.ts │ │ │ ├── get-property.ts │ │ │ ├── limit-rows.ts │ │ │ ├── search-entries.ts │ │ │ ├── search-parameter-converter.ts │ │ │ └── sort-entries.ts │ │ │ └── wallets-business-repository.ts │ └── tsconfig.json ├── core-elasticsearch │ ├── package.json │ ├── src │ │ ├── client.ts │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── indices │ │ │ ├── base.ts │ │ │ ├── blocks.ts │ │ │ ├── index.ts │ │ │ ├── rounds.ts │ │ │ ├── transactions.ts │ │ │ └── wallets.ts │ │ ├── server.ts │ │ ├── storage.ts │ │ └── utils.ts │ └── tsconfig.json ├── core-error-tracker-airbrake │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-error-tracker-bugsnag │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-error-tracker-raygun │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-error-tracker-rollbar │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-error-tracker-sentry │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-event-emitter │ ├── package.json │ ├── src │ │ ├── emitter.ts │ │ └── index.ts │ └── tsconfig.json ├── core-exchange-json-rpc │ ├── README.md │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-explorer │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json ├── core-forger │ ├── package.json │ ├── src │ │ ├── client.ts │ │ ├── defaults.ts │ │ ├── delegate.ts │ │ ├── errors.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── manager.ts │ │ └── plugin.ts │ └── tsconfig.json ├── core-http-utils │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── plugins │ │ │ ├── content-type.ts │ │ │ ├── cors-headers.ts │ │ │ ├── hapi-ajv.ts │ │ │ ├── index.ts │ │ │ ├── trailing-slash.ts │ │ │ ├── transaction-payload.ts │ │ │ └── whitelist.ts │ │ └── server │ │ │ ├── create.ts │ │ │ ├── monitor.ts │ │ │ └── mount.ts │ └── tsconfig.json ├── core-interfaces │ ├── package.json │ ├── src │ │ ├── core-blockchain │ │ │ ├── blockchain.ts │ │ │ └── index.ts │ │ ├── core-container │ │ │ ├── container.ts │ │ │ └── index.ts │ │ ├── core-database │ │ │ ├── business-repository │ │ │ │ ├── blocks-business-repository.ts │ │ │ │ ├── index.ts │ │ │ │ ├── parameters.ts │ │ │ │ ├── transactions-business-repository.ts │ │ │ │ └── wallets-business-repository.ts │ │ │ ├── database-connection.ts │ │ │ ├── database-model │ │ │ │ ├── database-model.ts │ │ │ │ └── index.ts │ │ │ ├── database-repository │ │ │ │ ├── blocks-repository.ts │ │ │ │ ├── index.ts │ │ │ │ ├── repository.ts │ │ │ │ ├── rounds-repository.ts │ │ │ │ ├── transactions-repository.ts │ │ │ │ └── wallets-repository.ts │ │ │ ├── database-service.ts │ │ │ ├── event-types.ts │ │ │ ├── index.ts │ │ │ └── search │ │ │ │ ├── index.ts │ │ │ │ ├── search-parameter-converter.ts │ │ │ │ └── search-parameters.ts │ │ ├── core-event-emitter │ │ │ └── index.ts │ │ ├── core-logger │ │ │ ├── index.ts │ │ │ └── logger.ts │ │ ├── core-p2p │ │ │ ├── index.ts │ │ │ ├── network-monitor.ts │ │ │ ├── network-state.ts │ │ │ ├── peer-communicator.ts │ │ │ ├── peer-connector.ts │ │ │ ├── peer-processor.ts │ │ │ ├── peer-service.ts │ │ │ ├── peer-storage.ts │ │ │ ├── peer-verifier.ts │ │ │ ├── peer.ts │ │ │ └── server.ts │ │ ├── core-state │ │ │ ├── index.ts │ │ │ ├── service.ts │ │ │ ├── state-store.ts │ │ │ └── wallets.ts │ │ ├── core-transaction-pool │ │ │ ├── connection.ts │ │ │ ├── index.ts │ │ │ └── processor.ts │ │ ├── index.ts │ │ └── shared │ │ │ ├── index.ts │ │ │ └── interfaces.ts │ └── tsconfig.json ├── core-jest-matchers │ ├── package.json │ ├── src │ │ ├── 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 │ └── tsconfig.json ├── core-logger-pino │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── driver.ts │ │ ├── index.ts │ │ └── plugin.ts │ └── tsconfig.json ├── core-logger-signale │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── driver.ts │ │ ├── index.ts │ │ └── plugin.ts │ └── tsconfig.json ├── core-logger-winston │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── driver.ts │ │ ├── formatter.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ └── plugin.ts │ └── tsconfig.json ├── core-logger │ ├── package.json │ ├── src │ │ ├── factory.ts │ │ ├── index.ts │ │ ├── logger.ts │ │ ├── manager.ts │ │ └── plugin.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 │ │ ├── defaults.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 │ │ ├── plugin.ts │ │ └── wallet-manager.ts │ └── tsconfig.json ├── core-new-relic │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── core-p2p │ ├── package.json │ ├── src │ │ ├── constants.ts │ │ ├── defaults.ts │ │ ├── enums.ts │ │ ├── errors.ts │ │ ├── event-listener.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── network-monitor.ts │ │ ├── network-state.ts │ │ ├── peer-communicator.ts │ │ ├── peer-connector.ts │ │ ├── peer-processor.ts │ │ ├── peer-repository.ts │ │ ├── peer-service.ts │ │ ├── peer-storage.ts │ │ ├── peer-verifier.ts │ │ ├── peer.ts │ │ ├── plugin.ts │ │ ├── rate-limiter.ts │ │ ├── schemas.ts │ │ ├── socket-server │ │ │ ├── errors.ts │ │ │ ├── index.ts │ │ │ ├── payload-processor.ts │ │ │ ├── utils │ │ │ │ ├── get-headers.ts │ │ │ │ ├── get-peer-config.ts │ │ │ │ ├── map-addr.ts │ │ │ │ └── validate.ts │ │ │ ├── versions │ │ │ │ ├── index.ts │ │ │ │ ├── internal.ts │ │ │ │ ├── peer.ts │ │ │ │ └── utils.ts │ │ │ └── worker.ts │ │ └── utils │ │ │ ├── build-rate-limiter.ts │ │ │ ├── check-dns.ts │ │ │ ├── check-ntp.ts │ │ │ ├── index.ts │ │ │ ├── is-valid-version.ts │ │ │ ├── is-whitelisted.ts │ │ │ ├── sc-codec.ts │ │ │ ├── socket.ts │ │ │ └── validate-json.ts │ └── tsconfig.json ├── core-snapshots │ ├── README.md │ ├── package.json │ ├── src │ │ ├── db │ │ │ ├── index.ts │ │ │ ├── queries │ │ │ │ ├── blocks │ │ │ │ │ ├── delete-from-height.sql │ │ │ │ │ ├── find-by-height.sql │ │ │ │ │ ├── height-range.sql │ │ │ │ │ └── latest.sql │ │ │ │ ├── index.ts │ │ │ │ ├── rounds │ │ │ │ │ ├── delete-from-round.sql │ │ │ │ │ ├── latest.sql │ │ │ │ │ └── round-range.sql │ │ │ │ └── transactions │ │ │ │ │ ├── delete-from-timestamp.sql │ │ │ │ │ ├── timestamp-higher.sql │ │ │ │ │ └── timestamp-range.sql │ │ │ └── utils │ │ │ │ └── index.ts │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── manager.ts │ │ ├── plugin.ts │ │ ├── transport │ │ │ ├── codec.ts │ │ │ ├── index.ts │ │ │ └── verification.ts │ │ └── utils.ts │ └── tsconfig.json ├── core-state │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── plugin.ts │ │ ├── service.ts │ │ ├── stores │ │ │ ├── blocks.ts │ │ │ ├── state.ts │ │ │ └── transactions.ts │ │ └── wallets │ │ │ ├── errors.ts │ │ │ ├── index.ts │ │ │ ├── temp-wallet-manager.ts │ │ │ ├── wallet-index.ts │ │ │ ├── wallet-manager.ts │ │ │ └── wallet.ts │ └── tsconfig.json ├── core-tester-cli │ ├── bin │ │ ├── run │ │ └── run.cmd │ ├── package.json │ ├── src │ │ ├── commands │ │ │ ├── command.ts │ │ │ ├── debug │ │ │ │ ├── deserialize.ts │ │ │ │ ├── identity.ts │ │ │ │ ├── serialize.ts │ │ │ │ ├── verify-second-signature.ts │ │ │ │ └── verify.ts │ │ │ ├── make │ │ │ │ ├── block.ts │ │ │ │ └── wallets.ts │ │ │ └── send │ │ │ │ ├── delegate-registration.ts │ │ │ │ ├── htlc-claim.ts │ │ │ │ ├── htlc-lock.ts │ │ │ │ ├── htlc-refund.ts │ │ │ │ ├── ipfs.ts │ │ │ │ ├── multi-payment.ts │ │ │ │ ├── multi-signature-registration.ts │ │ │ │ ├── second-signature-registration.ts │ │ │ │ ├── transfer.ts │ │ │ │ └── vote.ts │ │ ├── flags.ts │ │ ├── http-client.ts │ │ ├── index.ts │ │ ├── logger.ts │ │ ├── shared │ │ │ ├── htlc-secret.ts │ │ │ └── send.ts │ │ ├── signer.ts │ │ └── utils.ts │ └── tsconfig.json ├── core-transaction-pool │ ├── package.json │ ├── src │ │ ├── connection.ts │ │ ├── defaults.ts │ │ ├── dynamic-fee.ts │ │ ├── factory.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── manager.ts │ │ ├── memory.ts │ │ ├── plugin.ts │ │ ├── processor.ts │ │ ├── storage.ts │ │ ├── utils.ts │ │ └── wallet-manager.ts │ └── tsconfig.json ├── core-transactions │ ├── package.json │ ├── src │ │ ├── errors.ts │ │ ├── handlers │ │ │ ├── delegate-registration.ts │ │ │ ├── delegate-resignation.ts │ │ │ ├── handler-registry.ts │ │ │ ├── htlc-claim.ts │ │ │ ├── htlc-lock.ts │ │ │ ├── htlc-refund.ts │ │ │ ├── index.ts │ │ │ ├── ipfs.ts │ │ │ ├── multi-payment.ts │ │ │ ├── multi-signature.ts │ │ │ ├── second-signature.ts │ │ │ ├── transaction.ts │ │ │ ├── transfer.ts │ │ │ └── vote.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── transaction-reader.ts │ │ └── utils.ts │ └── tsconfig.json ├── core-utils │ ├── package.json │ ├── src │ │ ├── capped-set.ts │ │ ├── delegate-calculator.ts │ │ ├── expiration-calculator.ts │ │ ├── format-timestamp.ts │ │ ├── has-some-property.ts │ │ ├── httpie.ts │ │ ├── index.ts │ │ ├── is-block-chained.ts │ │ ├── is-whitelisted.ts │ │ ├── lock-expiration-calculator.ts │ │ ├── nsect.ts │ │ ├── ordered-capped-map.ts │ │ ├── round-calculator.ts │ │ ├── sorted-array.ts │ │ ├── supply-calculator.ts │ │ ├── transform-plugins.ts │ │ └── tree.ts │ └── tsconfig.json ├── core-vote-report │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── handler.ts │ │ ├── index.ts │ │ ├── server.ts │ │ └── templates │ │ │ └── index.html │ └── tsconfig.json ├── core-wallet-api │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── plugin.ts │ │ └── server │ │ │ ├── handlers.ts │ │ │ └── index.ts │ └── tsconfig.json ├── core-webhooks │ ├── package.json │ ├── src │ │ ├── conditions.ts │ │ ├── database.ts │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── listener.ts │ │ └── server │ │ │ ├── index.ts │ │ │ ├── schema.ts │ │ │ └── utils.ts │ └── tsconfig.json ├── core │ ├── bin │ │ ├── config │ │ │ ├── devnet │ │ │ │ ├── .env │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── mainnet │ │ │ │ ├── .env │ │ │ │ ├── app.js │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── nospluginnet │ │ │ │ ├── .env │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── realdevnet │ │ │ │ ├── .env │ │ │ │ ├── app.js │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── realmainnet │ │ │ │ ├── .env │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── realtestnet │ │ │ │ ├── .env │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ ├── staging │ │ │ │ ├── .env │ │ │ │ ├── app.js │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ │ └── testnet │ │ │ │ ├── .env │ │ │ │ ├── app.js │ │ │ │ ├── delegates.json │ │ │ │ ├── peers.json │ │ │ │ └── plugins.js │ │ ├── run │ │ └── run.cmd │ ├── package.json │ ├── src │ │ ├── commands │ │ │ ├── chain │ │ │ │ └── replay.ts │ │ │ ├── command.ts │ │ │ ├── config │ │ │ │ ├── cli.ts │ │ │ │ ├── database.ts │ │ │ │ ├── forger │ │ │ │ │ ├── bip38.ts │ │ │ │ │ ├── bip39.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── publish.ts │ │ │ │ └── reset.ts │ │ │ ├── core │ │ │ │ ├── log.ts │ │ │ │ ├── restart.ts │ │ │ │ ├── run.ts │ │ │ │ ├── start.ts │ │ │ │ ├── status.ts │ │ │ │ └── stop.ts │ │ │ ├── env │ │ │ │ ├── get.ts │ │ │ │ ├── list.ts │ │ │ │ ├── paths.ts │ │ │ │ └── set.ts │ │ │ ├── forger │ │ │ │ ├── log.ts │ │ │ │ ├── restart.ts │ │ │ │ ├── run.ts │ │ │ │ ├── start.ts │ │ │ │ ├── status.ts │ │ │ │ └── stop.ts │ │ │ ├── network │ │ │ │ └── generate.ts │ │ │ ├── pool │ │ │ │ └── clear.ts │ │ │ ├── reinstall.ts │ │ │ ├── relay │ │ │ │ ├── log.ts │ │ │ │ ├── restart.ts │ │ │ │ ├── run.ts │ │ │ │ ├── start.ts │ │ │ │ ├── status.ts │ │ │ │ └── stop.ts │ │ │ ├── snapshot │ │ │ │ ├── dump.ts │ │ │ │ ├── restore.ts │ │ │ │ ├── rollback.ts │ │ │ │ ├── truncate.ts │ │ │ │ └── verify.ts │ │ │ ├── top.ts │ │ │ └── update.ts │ │ ├── enums.ts │ │ ├── helpers │ │ │ ├── config.ts │ │ │ ├── prompts.ts │ │ │ ├── replay.ts │ │ │ ├── snapshot.ts │ │ │ └── update.ts │ │ ├── hooks │ │ │ ├── command_not_found │ │ │ │ └── suggest.ts │ │ │ └── init │ │ │ │ ├── config.ts │ │ │ │ └── update.ts │ │ ├── index.ts │ │ ├── process-manager.ts │ │ ├── shared │ │ │ ├── log.ts │ │ │ ├── restart.ts │ │ │ ├── start.ts │ │ │ ├── status.ts │ │ │ └── stop.ts │ │ ├── types.ts │ │ └── utils.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 │ │ ├── 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 │ │ ├── devnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── index.ts │ │ ├── mainnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── nospluginnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── realdevnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── realmainnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── realtestnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── staging │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ ├── testnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ │ └── unitnet │ │ │ ├── exceptions.json │ │ │ ├── genesisBlock.json │ │ │ ├── index.ts │ │ │ ├── milestones.json │ │ │ └── network.json │ ├── 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 │ │ │ ├── delegate-registration.ts │ │ │ ├── delegate-resignation.ts │ │ │ ├── factory.ts │ │ │ ├── htlc-claim.ts │ │ │ ├── htlc-lock.ts │ │ │ ├── htlc-refund.ts │ │ │ ├── index.ts │ │ │ ├── internal-transaction-type.ts │ │ │ ├── ipfs.ts │ │ │ ├── multi-payment.ts │ │ │ ├── multi-signature.ts │ │ │ ├── schemas.ts │ │ │ ├── second-signature.ts │ │ │ ├── transaction.ts │ │ │ ├── transfer.ts │ │ │ └── vote.ts │ │ ├── utils.ts │ │ └── verifier.ts │ ├── types.ts │ ├── utils │ │ ├── base58.ts │ │ ├── bignum.ts │ │ ├── fee.ts │ │ ├── index.ts │ │ └── is-valid-peer.ts │ └── validation │ │ ├── formats.ts │ │ ├── index.ts │ │ ├── keywords.ts │ │ └── schemas.ts │ └── tsconfig.json ├── plugins ├── .gitignore ├── chameleon │ ├── LICENSE │ ├── README.md │ ├── banner.png │ ├── chameleon.sh │ ├── package.json │ ├── src │ │ ├── agent.ts │ │ ├── chameleon.ts │ │ ├── defaults.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ ├── p2p.ts │ │ ├── plugin.ts │ │ ├── tor.ts │ │ └── worker.ts │ └── tsconfig.json ├── core-helpers │ ├── package.json │ ├── renovate.json │ ├── src │ │ ├── index.ts │ │ └── staking.ts │ ├── tsconfig.json │ └── tslint.json ├── file-transactions-crypto │ ├── package.json │ ├── src │ │ ├── builders │ │ │ ├── index.ts │ │ │ └── set-file.ts │ │ ├── enums.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ └── transactions │ │ │ ├── index.ts │ │ │ └── set-file.ts │ ├── tsconfig.json │ └── tslint.json ├── file-transactions │ ├── .gitignore │ ├── __tests__ │ │ ├── __fixtures__ │ │ │ ├── database-connection-stub.ts │ │ │ ├── mock-database-model.ts │ │ │ ├── state-storage-stub.ts │ │ │ └── wallets.json │ │ ├── file-transactions.unit.test.ts │ │ └── mocks │ │ │ ├── core-container.ts │ │ │ └── emitter.ts │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ ├── errors.ts │ │ ├── handlers │ │ │ ├── index.ts │ │ │ └── set-file.ts │ │ ├── index.ts │ │ └── plugin.ts │ ├── tsconfig.json │ └── tslint.json ├── stake-transactions-crypto │ ├── CHANGELOG.md │ ├── LICENSE │ ├── banner.png │ ├── package.json │ ├── renovate.json │ ├── src │ │ ├── builders │ │ │ ├── index.ts │ │ │ ├── stake-cancel.ts │ │ │ ├── stake-create.ts │ │ │ ├── stake-extend.ts │ │ │ └── stake-redeem.ts │ │ ├── defaults.ts │ │ ├── enums.ts │ │ ├── index.ts │ │ ├── interfaces.ts │ │ └── transactions │ │ │ ├── index.ts │ │ │ ├── stake-cancel.ts │ │ │ ├── stake-create.ts │ │ │ ├── stake-extend.ts │ │ │ └── stake-redeem.ts │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── stake-transactions │ ├── CHANGELOG.md │ ├── LICENSE │ ├── banner.png │ ├── package.json │ ├── renovate.json │ ├── src │ │ ├── defaults.ts │ │ ├── errors.ts │ │ ├── handlers │ │ │ ├── index.ts │ │ │ ├── stake-cancel.ts │ │ │ ├── stake-create.ts │ │ │ ├── stake-extend.ts │ │ │ └── stake-redeem.ts │ │ ├── helpers │ │ │ ├── block.ts │ │ │ ├── expire.ts │ │ │ ├── index.ts │ │ │ ├── power-up.ts │ │ │ ├── power.ts │ │ │ └── redeem.ts │ │ ├── index.ts │ │ └── plugin.ts │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── storage │ ├── CHANGELOG.md │ ├── LICENSE │ ├── banner.png │ ├── package.json │ ├── renovate.json │ ├── src │ │ ├── defaults.ts │ │ ├── entities │ │ │ ├── Delegate.ts │ │ │ ├── Round.ts │ │ │ ├── Statistic.ts │ │ │ ├── index.ts │ │ │ └── tsconfig.json │ │ ├── index.ts │ │ ├── server.ts │ │ └── storage.ts │ ├── tsconfig.json │ ├── tslint.json │ └── yarn.lock ├── supply-tracker │ ├── package.json │ ├── src │ │ ├── defaults.ts │ │ └── index.ts │ └── tsconfig.json └── verify-relay │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ ├── index.ts │ ├── plugin.ts │ └── server.ts │ └── tsconfig.json ├── renovate.json ├── scripts ├── 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 └── version.sh ├── tsconfig.json ├── tsconfig.tsbuildinfo ├── tslint-config.json ├── tslint.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 └── yarn.lock /.codacy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_paths: 3 | - 'benchmark/**/*' 4 | - 'deprecated/**/*' 5 | - 'docker/**/*' 6 | - 'scripts/**/*' 7 | - 'upgrade/**/*' 8 | - 'vagrant/**/*' 9 | - '**.sql' 10 | - '**.sh' 11 | - '**.md' 12 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "packages/**/src/defaults.ts" 3 | - "packages/**/src/index.ts" 4 | - "packages/**/src/plugin.ts" 5 | - "packages/core-interfaces" 6 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | _extends: .github 2 | -------------------------------------------------------------------------------- /.lintstagedrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "*.ts": ["yarn lint", "prettier --write", "git add"], 3 | "*.{json,md}": ["prettier --write", "git add"] 4 | } 5 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 12.16.0 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .coverage 2 | dist 3 | docs 4 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 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 | * @faustbrian @kristjank @supaiku0 @air1one 2 | -------------------------------------------------------------------------------- /__tests__/e2e/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | package-lock.json 4 | 5 | # Editor directories and files 6 | .idea 7 | .vscode 8 | *.suo 9 | *.ntvs* 10 | *.njsproj 11 | *.sln -------------------------------------------------------------------------------- /__tests__/e2e/img/core-e2e-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/__tests__/e2e/img/core-e2e-banner.png -------------------------------------------------------------------------------- /__tests__/e2e/img/docker-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/__tests__/e2e/img/docker-architecture.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 4 | 5 | WORKDIR /ark-core 6 | 7 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core0/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 3 | 4 | CORE_DB_PORT=5432 5 | 6 | CORE_P2P_HOST=0.0.0.0 7 | CORE_P2P_PORT=4000 8 | 9 | CORE_WEBHOOKS_HOST=0.0.0.0 10 | CORE_WEBHOOKS_PORT=4004 11 | 12 | CORE_EXCHANGE_JSON_RPC_HOST=0.0.0.0 13 | CORE_EXCHANGE_JSON_RPC_PORT=8080 14 | 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | 18 | CORE_WALLET_API_HOST=0.0.0.0 19 | CORE_WALLET_API_PORT=4040 20 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core0/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [], 3 | "sources": ["http://peerdiscovery:3000/"] 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/e2e/lib/config/nodes/core1/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 3 | 4 | CORE_DB_PORT=5432 5 | 6 | CORE_P2P_HOST=0.0.0.0 7 | CORE_P2P_PORT=4000 8 | 9 | CORE_WEBHOOKS_HOST=0.0.0.0 10 | CORE_WEBHOOKS_PORT=4004 11 | 12 | CORE_EXCHANGE_JSON_RPC_HOST=0.0.0.0 13 | CORE_EXCHANGE_JSON_RPC_PORT=8080 14 | 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | 18 | CORE_WALLET_API_HOST=0.0.0.0 19 | CORE_WALLET_API_PORT=4040 20 | -------------------------------------------------------------------------------- /__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_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 3 | 4 | CORE_DB_PORT=5432 5 | 6 | CORE_P2P_HOST=0.0.0.0 7 | CORE_P2P_PORT=4000 8 | 9 | CORE_WEBHOOKS_HOST=0.0.0.0 10 | CORE_WEBHOOKS_PORT=4004 11 | 12 | CORE_EXCHANGE_JSON_RPC_HOST=0.0.0.0 13 | CORE_EXCHANGE_JSON_RPC_PORT=8080 14 | 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | 18 | CORE_WALLET_API_HOST=0.0.0.0 19 | CORE_WALLET_API_PORT=4040 20 | -------------------------------------------------------------------------------- /__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_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 3 | 4 | CORE_DB_PORT=5432 5 | 6 | CORE_P2P_HOST=0.0.0.0 7 | CORE_P2P_PORT=4000 8 | 9 | CORE_WEBHOOKS_HOST=0.0.0.0 10 | CORE_WEBHOOKS_PORT=4004 11 | 12 | CORE_EXCHANGE_JSON_RPC_HOST=0.0.0.0 13 | CORE_EXCHANGE_JSON_RPC_PORT=8080 14 | 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | 18 | CORE_WALLET_API_HOST=0.0.0.0 19 | CORE_WALLET_API_PORT=4040 20 | -------------------------------------------------------------------------------- /__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_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 3 | 4 | CORE_DB_PORT=5432 5 | 6 | CORE_P2P_HOST=0.0.0.0 7 | CORE_P2P_PORT=4000 8 | 9 | CORE_WEBHOOKS_HOST=0.0.0.0 10 | CORE_WEBHOOKS_PORT=4004 11 | 12 | CORE_EXCHANGE_JSON_RPC_HOST=0.0.0.0 13 | CORE_EXCHANGE_JSON_RPC_PORT=8080 14 | 15 | CORE_API_HOST=0.0.0.0 16 | CORE_API_PORT=4003 17 | 18 | CORE_WALLET_API_HOST=0.0.0.0 19 | CORE_WALLET_API_PORT=4040 20 | -------------------------------------------------------------------------------- /__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 | }) -------------------------------------------------------------------------------- /__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__/e2e/tests/scenarios/scenario1/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | enabledTests: [ 5 | "chained-tx", 6 | "doublespend", 7 | "doublespend-mix", 8 | "insufficient-balance", 9 | //'pool-restart', 10 | "transactions-valid", 11 | "htlc-claim", 12 | "htlc-refund", 13 | "multisignature", 14 | "multisig-htlc-claim", 15 | "multisig-htlc-refund", 16 | "business-bridgechain" 17 | ], 18 | }; 19 | -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/doublespend-mix/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | events: { 5 | newBlock: { 6 | 5: ["0.0.transfer-new-wallet.action"], 7 | 9: ["0.1.init-2ndsig.action"], 8 | 15: ["1.0.doublespend.action", "1.1.doublespend2ndsig.action"], 9 | 20: ["2.check-tx.test"], 10 | }, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/doublespend/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | events: { 5 | newBlock: { 6 | 5: ["0.0.transfer-new-wallet.action"], 7 | 7: ["0.1.init-2ndsig.action"], 8 | 16: [ 9 | "1.0.doubletransfer.action", 10 | "1.1.doubletransfer2ndsig.action", 11 | "1.2.doublevote.action", 12 | "1.3.doubledelreg.action", 13 | "1.4.double2ndsigreg.action", 14 | ], 15 | 19: ["2.check-tx.test"], 16 | }, 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/htlc-claim/shared.js: -------------------------------------------------------------------------------- 1 | const transactions = { 2 | lockTransactions: { // this will be filled by 1.create-lock-txs 3 | normal: {}, 4 | wrongSecret: {}, 5 | notRecipient: {}, 6 | lockExpired: {} 7 | }, 8 | claimTransactions: { // this will be filled by 2.create-claim-txs 9 | normal: {}, 10 | wrongSecret: {}, 11 | notRecipient: {}, 12 | lockExpired: {} 13 | }, 14 | } 15 | 16 | module.exports = transactions; -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/htlc-refund/shared.js: -------------------------------------------------------------------------------- 1 | const transactions = { 2 | lockTransactions: { // this will be filled by 1.create-lock-txs 3 | normal: {}, 4 | notSender: {}, 5 | lockNotExpired: {} 6 | }, 7 | refundTransactions: { // this will be filled by 2.create-refund-txs 8 | normal: {}, 9 | notSender: {}, 10 | lockNotExpired: {} 11 | }, 12 | } 13 | 14 | module.exports = transactions; -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/insufficient-balance/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | events: { 5 | newBlock: { 6 | 5: ["0.0.transfer-new-wallet.action"], 7 | 7: ["0.1.init-2ndsig.action"], 8 | 17: [ 9 | "1.0.transfer.action", 10 | "1.1.transfer2ndsig.action", 11 | "1.2.vote.action", 12 | "1.3.delreg.action", 13 | "1.4.2ndsigreg.action", 14 | ], 15 | 19: ["2.check-tx.test"], 16 | }, 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/multisig-htlc-claim/shared.js: -------------------------------------------------------------------------------- 1 | const transactions = { 2 | multisigRegistration: {} // this will be filled by 1.create-multisig-registration 3 | }; 4 | const lockTransactions = { 5 | normal: {} 6 | }; 7 | const claimTransactions = { 8 | normal: {} 9 | } 10 | 11 | module.exports = { transactions, lockTransactions, claimTransactions }; -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/multisig-htlc-refund/shared.js: -------------------------------------------------------------------------------- 1 | const transactions = { 2 | multisigRegistration: {} // this will be filled by 1.create-multisig-registration 3 | }; 4 | const lockTransactions = { 5 | normal: {} 6 | }; 7 | const refundTransactions = { 8 | normal: {} 9 | } 10 | 11 | module.exports = { transactions, lockTransactions, refundTransactions }; -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/multisignature/shared.js: -------------------------------------------------------------------------------- 1 | const transactions = { 2 | multisigRegistration: {} // this will be filled by 1.create-multisig-registration 3 | } 4 | 5 | module.exports = transactions; -------------------------------------------------------------------------------- /__tests__/e2e/tests/scenarios/scenario1/transactions-valid/config.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = { 4 | events: { 5 | newBlock: { 6 | 13: ["0.0.transfer-new-wallet.action"], 7 | 15: ["0.1.init-2ndsig.action"], 8 | 19: ["1.0.transaction.action", "1.1.transaction2ndsig.action"], 9 | 22: ["2.check-tx.test"], 10 | }, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /__tests__/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["../helpers/transaction-factory.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /__tests__/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./rest-client"; 2 | export * from "./transaction-factory"; 3 | export * from "./block-factory"; -------------------------------------------------------------------------------- /__tests__/integration/core-blockchain/__support__/setup.ts: -------------------------------------------------------------------------------- 1 | import { app } from "@arkecosystem/core-container"; 2 | import { setUpContainer } from "../../../utils/helpers/container"; 3 | 4 | jest.setTimeout(60000); 5 | 6 | process.env.CORE_RESET_DATABASE = "1"; 7 | 8 | export const setUp = async (options = {}) => 9 | setUpContainer({ 10 | ...options, 11 | exit: "@arkecosystem/core-blockchain", 12 | }); 13 | 14 | export const tearDown = async (): Promise => app.tearDown(); 15 | -------------------------------------------------------------------------------- /__tests__/integration/core-magistrate/mocks/database.ts: -------------------------------------------------------------------------------- 1 | export const database = { 2 | getForgedTransactionsIds: () => [], 3 | }; 4 | -------------------------------------------------------------------------------- /__tests__/integration/core-magistrate/mocks/state.ts: -------------------------------------------------------------------------------- 1 | export const state = { 2 | getStore: () => ({ 3 | cacheTransactions: () => undefined, 4 | getLastBlock: () => ({ data: { height: 0 } }), 5 | getLastHeight: () => 1, 6 | clearCachedTransactionIds: () => undefined, 7 | }), 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/integration/core-p2p/mocks/p2p-options.ts: -------------------------------------------------------------------------------- 1 | export * from "../../../../packages/core-p2p/src/defaults"; 2 | -------------------------------------------------------------------------------- /__tests__/integration/core-tester-cli/__fixtures__/identities.json: -------------------------------------------------------------------------------- 1 | { 2 | "passphrase": "this is a top secret passphrase", 3 | "publicKey": "034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192", 4 | "privateKey": "d8839c2432bfd0a67ef10a804ba991eabba19f154a3d707917681d45822a5712", 5 | "address": "D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib" 6 | } 7 | -------------------------------------------------------------------------------- /__tests__/integration/core-tester-cli/__fixtures__/transaction-response-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "accept": ["4743f493f3f0e119b8330ea95de500e9823e51802ca3391ece96c326634e183a"], 3 | "excess": [], 4 | "invalid": [], 5 | "broadcast": ["4743f493f3f0e119b8330ea95de500e9823e51802ca3391ece96c326634e183a"] 6 | } 7 | -------------------------------------------------------------------------------- /__tests__/integration/core-tester-cli/__fixtures__/wallet-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "DNjuJEDQkhrJ7cA9FZ2iVXt5anYiM8Jtc9", 3 | "publicKey": "03bbfb43ecb5a54a1e227bb37b5812b5321213838d376e2b455b6af78442621dec", 4 | "username": "arkx", 5 | "secondPublicKey": null, 6 | "balance": 42159020792234, 7 | "isDelegate": true 8 | } 9 | -------------------------------------------------------------------------------- /__tests__/integration/core-tester-cli/commands/send/fixtures.ts: -------------------------------------------------------------------------------- 1 | export const nodeStatusResponse = { 2 | data: { 3 | synced: true, 4 | now: 2, 5 | blocksCount: 0, 6 | timestamp: 90273881, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/integration/core-vote-report/server.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import got from "got"; 4 | import { setUp, tearDown } from "./__support__/setup"; 5 | 6 | beforeAll(async () => await setUp()); 7 | afterAll(async () => await tearDown()); 8 | 9 | describe("Server", () => { 10 | it("should render the page", async () => { 11 | const { body, statusCode } = await got.get("http://localhost:4006/"); 12 | 13 | expect(statusCode).toBe(200); 14 | expect(body).toContain("Delegates Stats"); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/config.ts: -------------------------------------------------------------------------------- 1 | import genesisBlock from "../../../utils/config/testnet/genesisBlock.json"; 2 | 3 | export const config = { 4 | "network.nethash": genesisBlock.payloadHash, 5 | genesisBlock, 6 | "state.maxLastBlocks": 50, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/index.ts: -------------------------------------------------------------------------------- 1 | import { container } from "./container"; 2 | 3 | jest.mock("@arkecosystem/core-container", () => { 4 | return container; 5 | }); 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/logger.ts: -------------------------------------------------------------------------------- 1 | export const logger = { 2 | info: console.log, 3 | warn: console.log, 4 | error: console.error, 5 | debug: console.log, 6 | verbose: console.log, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/p2p.ts: -------------------------------------------------------------------------------- 1 | import { getMonitor } from "./p2p/network-monitor"; 2 | import { getStorage } from "./p2p/peer-storage"; 3 | 4 | export const p2p = { 5 | getStorage: () => getStorage, 6 | getMonitor: () => getMonitor, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/p2p/network-monitor.ts: -------------------------------------------------------------------------------- 1 | export const getMonitor = { 2 | getNetworkHeight: () => 1, 3 | updateNetworkStatus: () => undefined, 4 | checkNetworkHealth: () => undefined, 5 | downloadBlocksFromHeight: () => [], 6 | start: () => undefined, 7 | refreshPeersAfterFork: () => undefined, 8 | broadcastBlock: () => undefined, 9 | hasPeers: () => false, 10 | }; 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/p2p/peer-storage.ts: -------------------------------------------------------------------------------- 1 | export const getStorage = { 2 | getNetworkHeight: () => 1, 3 | updateNetworkStatus: () => undefined, 4 | // tslint:disable-next-line: no-empty 5 | checkNetworkHealth: () => {}, 6 | downloadBlocksFromHeight: () => [], 7 | refreshPeersAfterFork: () => undefined, 8 | broadcastBlock: () => undefined, 9 | hasPeers: () => false, 10 | }; 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-blockchain/mocks/transactionPool.ts: -------------------------------------------------------------------------------- 1 | export const transactionPool = { 2 | buildWallets: () => undefined, 3 | acceptChainedBlock: () => undefined, 4 | removeTransactionsById: () => undefined, 5 | flush: () => undefined, 6 | getAllTransactions: () => [], 7 | addTransactions: () => undefined, 8 | walletManager: { 9 | reset: () => undefined, 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/config/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": ["this is a test"] 3 | } 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/config/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/config/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testnet", 3 | "messagePrefix": "TEST message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 23, 9 | "nethash": "d9acd04bde4234a81addb8482333b4ac906bed7be5a9970ce8ada428bd083192", 10 | "wif": 186, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "TARK", 15 | "symbol": "TѦ", 16 | "explorer": "http://texplorer.ark.io" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/config/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "127.0.0.1", 5 | "port": 4102 6 | }, 7 | { 8 | "ip": "127.0.0.1", 9 | "port": 4202 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/config/plugins.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "./plugin-a": { 3 | enabled: true, 4 | }, 5 | "./plugin-b": { 6 | enabled: true, 7 | property: "value", 8 | }, 9 | "./plugin-c": { 10 | enabled: true, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/plugin-a.js: -------------------------------------------------------------------------------- 1 | exports.plugin = { 2 | pkg: { 3 | name: "stub/plugin-a", 4 | version: "1.0.0", 5 | }, 6 | alias: "stub-plugin-a", 7 | register(container, options) { 8 | return { 9 | container, 10 | options, 11 | }; 12 | }, 13 | deregister() {}, 14 | }; 15 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/plugin-b.js: -------------------------------------------------------------------------------- 1 | exports.plugin = { 2 | pkg: { 3 | name: "stub/plugin-b", 4 | version: "1.0.0", 5 | }, 6 | alias: "stub-plugin-b", 7 | register(container, options) { 8 | return { 9 | container, 10 | options, 11 | }; 12 | }, 13 | deregister() {}, 14 | }; 15 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/plugin-c.js: -------------------------------------------------------------------------------- 1 | exports.plugin = { 2 | pkg: { 3 | name: "stub/plugin-c", 4 | version: "1.0.0", 5 | }, 6 | alias: "stub-plugin-c", 7 | register(container, options) { 8 | return { 9 | container, 10 | options, 11 | }; 12 | }, 13 | }; 14 | -------------------------------------------------------------------------------- /__tests__/unit/core-container/__stubs__/plugins.js: -------------------------------------------------------------------------------- 1 | const { resolve } = require("path"); 2 | 3 | module.exports = { 4 | [resolve(__dirname, "./plugin-a")]: { 5 | enabled: true, 6 | }, 7 | [resolve(__dirname, "./plugin-b")]: { 8 | enabled: true, 9 | property: "value", 10 | }, 11 | [resolve(__dirname, "./plugin-c")]: { 12 | enabled: true, 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /__tests__/unit/core-database/__fixtures__/wallets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "APnhwwyTbMiykJwYbGhYjNgtHiVJDSEhSn", 4 | "publicKey": "035b63b4668ee261c16ca91443f3371e2fe349e131cb7bf5f8a3e93a3ddfdfc788" 5 | }, 6 | { 7 | "address": "Aa4M1zL3a74L51f1AvEsLmBTsKLKrkRScU", 8 | "publicKey": "0308c0d019cd9c0c59618e3b86afc584078b54a85a025c9f30a8bdc82cdc8e1252" 9 | }, 10 | { 11 | "address": "fake_address", 12 | "publicKey": "fake_publicKey" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /__tests__/unit/core-database/mocks/emitter.ts: -------------------------------------------------------------------------------- 1 | export const emitter = { 2 | on: jest.fn(), 3 | emit: jest.fn(), 4 | once: jest.fn(), 5 | }; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-forger/__fixtures__/delegate.ts: -------------------------------------------------------------------------------- 1 | export const delegate = { 2 | username: "arkxdev", 3 | publicKey: "0310ad026647eed112d1a46145eed58b8c19c67c505a67f1199361a511ce7860c0", 4 | }; 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-http-utils/mocks/core-container.ts: -------------------------------------------------------------------------------- 1 | jest.mock("@arkecosystem/core-container", () => { 2 | return { 3 | app: { 4 | resolvePlugin: name => { 5 | if (name === "logger") { 6 | return { 7 | info: jest.fn(), 8 | warn: jest.fn(), 9 | error: jest.fn(), 10 | debug: jest.fn(), 11 | }; 12 | } 13 | 14 | return {}; 15 | }, 16 | }, 17 | }; 18 | }); 19 | -------------------------------------------------------------------------------- /__tests__/unit/core-jest-matchers/fields/address.test.ts: -------------------------------------------------------------------------------- 1 | import "../../../../packages/core-jest-matchers/src/fields/address"; 2 | 3 | describe(".toBeAddress", () => { 4 | test("passes when given a valid address", () => { 5 | expect("DARiJqhogp2Lu6bxufUFQQMuMyZbxjCydN").toBeAddress(); 6 | }); 7 | 8 | test("fails when not given a valid address", () => { 9 | expect(expect("invalid-address").toBeAddress).toThrowError("Expected value to be a valid address"); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /__tests__/unit/core-jest-matchers/fields/public-key.test.ts: -------------------------------------------------------------------------------- 1 | import "../../../../packages/core-jest-matchers/src/fields/public-key"; 2 | 3 | describe(".toBePublicKey", () => { 4 | test("passes when given a valid public key", () => { 5 | expect("022cca9529ec97a772156c152a00aad155ee6708243e65c9d211a589cb5d43234d").toBePublicKey(); 6 | }); 7 | 8 | test("fails when not given a valid public key", () => { 9 | expect(expect("invalid-pubkey").toBePublicKey).toThrowError("Expected value to be a valid public key"); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /__tests__/unit/core-logger-signale/logger.test.ts: -------------------------------------------------------------------------------- 1 | import { SignaleLogger } from "../../../packages/core-logger-signale/src"; 2 | import { expectLogger } from "../shared/logger"; 3 | 4 | expectLogger(() => new SignaleLogger({ logLevel: "info" })); 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-logger-winston/logger.test.ts: -------------------------------------------------------------------------------- 1 | import { WinstonLogger } from "../../../packages/core-logger-winston/src"; 2 | import { expectLogger } from "../shared/logger"; 3 | 4 | expectLogger( 5 | () => 6 | new WinstonLogger({ 7 | transports: [ 8 | { 9 | constructor: "Console", 10 | options: { 11 | level: "debug", 12 | }, 13 | }, 14 | ], 15 | }), 16 | ); 17 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/blockchain.ts: -------------------------------------------------------------------------------- 1 | import { database } from "./database"; 2 | 3 | export const blockchain = { 4 | getLastBlock: jest.fn().mockReturnValue({ data: { height: 1, timestamp: 222 }, getHeader: () => ({}) }), 5 | getLastDownloadedBlock: jest.fn(), 6 | forceWakeup: jest.fn(), 7 | handleIncomingBlock: jest.fn(), 8 | pingBlock: jest.fn().mockReturnValue(false), 9 | pushPingBlock: jest.fn(), 10 | getBlockPing: jest.fn(), 11 | 12 | database, 13 | }; 14 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/logger.ts: -------------------------------------------------------------------------------- 1 | export const logger = { 2 | info: jest.fn().mockImplementation(console.log), 3 | warn: jest.fn().mockImplementation(console.log), 4 | error: jest.fn().mockImplementation(console.error), 5 | debug: jest.fn().mockImplementation(console.log), 6 | }; 7 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/p2p.ts: -------------------------------------------------------------------------------- 1 | import { getMonitor } from "./p2p/network-monitor"; 2 | import { getProcessor } from "./p2p/peer-processor"; 3 | import { getStorage } from "./p2p/peer-storage"; 4 | 5 | export const p2p = { 6 | getMonitor: () => getMonitor, 7 | getStorage: () => getStorage, 8 | getProcessor: () => getProcessor, 9 | }; 10 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/p2p/network-monitor.ts: -------------------------------------------------------------------------------- 1 | export const getMonitor = { 2 | getNetworkState: () => undefined, 3 | }; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/p2p/peer-processor.ts: -------------------------------------------------------------------------------- 1 | export const getProcessor = { 2 | validateAndAcceptPeer: () => undefined, 3 | }; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/p2p/peer-storage.ts: -------------------------------------------------------------------------------- 1 | export const getStorage = { 2 | getPeers: () => undefined, 3 | }; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/request.ts: -------------------------------------------------------------------------------- 1 | export const request = { 2 | event: undefined, 3 | socket: { 4 | terminate: jest.fn(), 5 | destroy: jest.fn(), 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/scworker.ts: -------------------------------------------------------------------------------- 1 | class SCWorker { 2 | public scServer = { 3 | addMiddleware: jest.fn(), 4 | on: jest.fn(), 5 | MIDDLEWARE_HANDSHAKE_WS: undefined, 6 | MIDDLEWARE_EMIT: undefined, 7 | }; 8 | 9 | public sendToMaster = jest.fn().mockImplementation((data, cb) => cb(undefined, {})); 10 | } 11 | 12 | jest.mock("socketcluster/scworker", () => SCWorker); 13 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/state.ts: -------------------------------------------------------------------------------- 1 | import { genesisBlock } from "../../../utils/fixtures/unitnet/block-model"; 2 | 3 | export const state = { 4 | getStore: () => ({ 5 | getLastBlock: () => genesisBlock, 6 | forkedBlock: undefined, 7 | }), 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/mocks/transaction-pool.ts: -------------------------------------------------------------------------------- 1 | export const transactionPool = { 2 | getTransactionsForForging: jest.fn(), 3 | getPoolSize: jest.fn(), 4 | }; 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-p2p/utils/check-dns.test.ts: -------------------------------------------------------------------------------- 1 | import { checkDNS } from "../../../../packages/core-p2p/src/utils"; 2 | 3 | describe("Check DNS", () => { 4 | it("should be ok", async () => { 5 | const response = await checkDNS(["1.1.1.1"]); 6 | expect(response).toBe("1.1.1.1"); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-snapshots/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/__tests__/unit/core-snapshots/.gitkeep -------------------------------------------------------------------------------- /__tests__/unit/core-state/__fixtures__/wallets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "APnhwwyTbMiykJwYbGhYjNgtHiVJDSEhSn", 4 | "publicKey": "035b63b4668ee261c16ca91443f3371e2fe349e131cb7bf5f8a3e93a3ddfdfc788" 5 | }, 6 | { 7 | "address": "Aa4M1zL3a74L51f1AvEsLmBTsKLKrkRScU", 8 | "publicKey": "0308c0d019cd9c0c59618e3b86afc584078b54a85a025c9f30a8bdc82cdc8e1252" 9 | }, 10 | { 11 | "address": "fake_address", 12 | "publicKey": "fake_publicKey" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/config.ts: -------------------------------------------------------------------------------- 1 | import genesisBlock from "../../../utils/config/testnet/genesisBlock.json"; 2 | 3 | export const config = { 4 | "network.nethash": genesisBlock.payloadHash, 5 | genesisBlock, 6 | "state.maxLastBlocks": 50, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/index.ts: -------------------------------------------------------------------------------- 1 | import { container } from "./container"; 2 | 3 | jest.mock("@arkecosystem/core-container", () => { 4 | return container; 5 | }); 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/logger.ts: -------------------------------------------------------------------------------- 1 | export const logger = { 2 | info: console.log, 3 | warn: console.log, 4 | error: console.error, 5 | debug: console.log, 6 | verbose: console.log, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/p2p.ts: -------------------------------------------------------------------------------- 1 | import { getMonitor } from "./p2p/network-monitor"; 2 | import { getStorage } from "./p2p/peer-storage"; 3 | 4 | export const p2p = { 5 | getStorage: () => getStorage, 6 | getMonitor: () => getMonitor, 7 | }; 8 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/p2p/network-monitor.ts: -------------------------------------------------------------------------------- 1 | export const getMonitor = { 2 | getNetworkHeight: () => 1, 3 | updateNetworkStatus: () => undefined, 4 | // tslint:disable-next-line: no-empty 5 | checkNetworkHealth: () => {}, 6 | downloadBlocksFromHeight: () => [], 7 | refreshPeersAfterFork: () => undefined, 8 | broadcastBlock: () => undefined, 9 | hasPeers: () => false, 10 | }; 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/p2p/peer-storage.ts: -------------------------------------------------------------------------------- 1 | export const getStorage = { 2 | getNetworkHeight: () => 1, 3 | updateNetworkStatus: () => undefined, 4 | // tslint:disable-next-line: no-empty 5 | checkNetworkHealth: () => {}, 6 | downloadBlocksFromHeight: () => [], 7 | refreshPeersAfterFork: () => undefined, 8 | broadcastBlock: () => undefined, 9 | hasPeers: () => false, 10 | }; 11 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/state.ts: -------------------------------------------------------------------------------- 1 | export const state = { 2 | getStore: () => ({ 3 | getLastBlock: () => undefined, 4 | }), 5 | }; 6 | -------------------------------------------------------------------------------- /__tests__/unit/core-state/mocks/transactionPool.ts: -------------------------------------------------------------------------------- 1 | export const transactionPool = { 2 | buildWallets: () => undefined, 3 | acceptChainedBlock: () => undefined, 4 | }; 5 | -------------------------------------------------------------------------------- /__tests__/unit/core-transaction-pool/mocks/database.ts: -------------------------------------------------------------------------------- 1 | export const database = { 2 | getForgedTransactionsIds: () => [], 3 | }; 4 | -------------------------------------------------------------------------------- /__tests__/unit/core-transaction-pool/mocks/state.ts: -------------------------------------------------------------------------------- 1 | export const state = { 2 | getStore: () => ({ 3 | cacheTransactions: () => undefined, 4 | getLastBlock: () => ({ data: { height: 0 } }), 5 | getLastHeight: () => 1, 6 | clearCachedTransactionIds: () => undefined, 7 | }), 8 | }; 9 | -------------------------------------------------------------------------------- /__tests__/unit/core-utils/mocks/core-container.ts: -------------------------------------------------------------------------------- 1 | jest.mock("@arkecosystem/core-container", () => { 2 | return { 3 | app: { 4 | getConfig: () => { 5 | return { 6 | config: { milestones: [{ activeDelegates: 51, height: 1 }] }, 7 | getMilestone: () => ({ 8 | epoch: "2017-03-21T13:00:00.000Z", 9 | activeDelegates: 51, 10 | height: 1, 11 | }), 12 | }; 13 | }, 14 | }, 15 | }; 16 | }); 17 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/blocks/__fixtures__/wallet.ts: -------------------------------------------------------------------------------- 1 | import { Wallets } from "@arkecosystem/core-state"; 2 | import { BigNumber } from "../../../../../packages/crypto/src/utils"; 3 | 4 | export const wallet = { 5 | address: "DTRdbaUW3RQQSL5By4G43JVaeHiqfVp9oh", 6 | balance: BigNumber.make(4527654310), 7 | publicKey: "034da006f958beba78ec54443df4a3f52237253f7ae8cbdb17dccf3feaa57f3126", 8 | } as Wallets.Wallet; 9 | -------------------------------------------------------------------------------- /__tests__/unit/crypto/constants.test.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | import * as constants from "../../../packages/crypto/src/constants"; 3 | 4 | describe("Constants", () => { 5 | it("satoshi is valid", () => { 6 | expect(constants.SATOSHI).toBeDefined(); 7 | expect(constants.SATOSHI).toBe(100000000); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /__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/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__/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/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 | -------------------------------------------------------------------------------- /__tests__/utils/config/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | passphrase: "clay harbor enemy utility margin pretty hub comic piece aerobic umbrella acquire", 3 | }; 4 | -------------------------------------------------------------------------------- /__tests__/utils/config/nospluginnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 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_EXCHANGE_JSON_RPC_HOST=0.0.0.0 14 | CORE_EXCHANGE_JSON_RPC_PORT=8080 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | 19 | CORE_WALLET_API_HOST=0.0.0.0 20 | CORE_WALLET_API_PORT=4040 21 | 22 | CORE_DB_USERNAME=ark 23 | CORE_DB_PASSWORD=password 24 | CORE_DB_DATABASE=nos_pluginnet 25 | -------------------------------------------------------------------------------- /__tests__/utils/config/nospluginnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "127.0.0.1", 5 | "port": 4000 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /__tests__/utils/config/testnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 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_EXCHANGE_JSON_RPC_HOST=0.0.0.0 14 | CORE_EXCHANGE_JSON_RPC_PORT=8080 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | 19 | CORE_WALLET_API_HOST=0.0.0.0 20 | CORE_WALLET_API_PORT=4040 21 | 22 | CORE_DB_USERNAME=ark 23 | CORE_DB_PASSWORD=password 24 | CORE_DB_DATABASE=nos_testnet 25 | -------------------------------------------------------------------------------- /__tests__/utils/config/testnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "127.0.0.1", 5 | "port": 4000 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /__tests__/utils/config/unitnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "0.0.0.99", 5 | "port": 4000 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./testnet"; // export testnet by default, if we want a different one we import from its path 2 | 3 | export const htlcSecretHex = "c27f1ce845d8c29eebc9006be932b604fd06755521b1a8b0be4204c65377151a"; 4 | // SHA256(c2 7f ...) = 9c 1a ... 5 | export const htlcSecretHashHex = "9c1a3815d49e0c9f78b872bfb017e825ea2db708158b70815526a830c85912b4"; 6 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/testnet/block-model.ts: -------------------------------------------------------------------------------- 1 | import { Blocks, Managers } from "@arkecosystem/crypto"; 2 | import { genesisBlock as GB } from "../../config/testnet/genesisBlock"; 3 | 4 | Managers.configManager.setFromPreset("testnet"); 5 | Managers.configManager.getMilestone().aip11 = false; 6 | 7 | export const genesisBlock = Blocks.BlockFactory.fromData(GB); 8 | 9 | Managers.configManager.getMilestone().aip11 = true; 10 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/testnet/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./delegates"; 2 | export * from "./blocks101to155"; 3 | export * from "./blocks2to100"; 4 | export * from "./passphrases"; 5 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/testnet/passphrases.ts: -------------------------------------------------------------------------------- 1 | import * as delegates from "../../config/testnet/delegates.json"; 2 | 3 | export const delegatesSecrets = delegates.secrets; 4 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/unitnet/block-model.ts: -------------------------------------------------------------------------------- 1 | import { Blocks, Managers } from "@arkecosystem/crypto"; 2 | import { genesisBlock as GB } from "../../config/unitnet/genesisBlock"; 3 | 4 | Managers.configManager.setFromPreset("unitnet"); 5 | Managers.configManager.getMilestone().aip11 = false; 6 | 7 | export const genesisBlock = Blocks.BlockFactory.fromData(GB); 8 | 9 | Managers.configManager.getMilestone().aip11 = true; 10 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/unitnet/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./delegates"; 2 | export * from "./wallets"; 3 | export * from "./blocks"; 4 | -------------------------------------------------------------------------------- /__tests__/utils/fixtures/unitnet/wallets.ts: -------------------------------------------------------------------------------- 1 | export { wallets } from "../../config/unitnet/wallets.json"; 2 | export { wallets2ndSig } from "../../config/unitnet/wallets2ndSig.json"; 3 | -------------------------------------------------------------------------------- /__tests__/utils/generators/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./wallets"; 2 | -------------------------------------------------------------------------------- /__tests__/utils/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./api"; 2 | export * from "./blockchain"; 3 | export * from "./container"; 4 | -------------------------------------------------------------------------------- /__tests__/utils/index.ts: -------------------------------------------------------------------------------- 1 | import "@arkecosystem/core-jest-matchers"; 2 | 3 | import * as fixtures from "./fixtures"; 4 | import * as generators from "./generators"; 5 | import * as helpers from "./helpers"; 6 | 7 | export { fixtures, generators, helpers }; 8 | -------------------------------------------------------------------------------- /banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/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.Block.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.Block.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.Block.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 | -------------------------------------------------------------------------------- /docker/production/ark-core-docker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/docker/production/ark-core-docker.png -------------------------------------------------------------------------------- /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/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 | "lerna": "3.5.0", 3 | "npmClient": "yarn", 4 | "packages": ["packages/*", "plugins/*"], 5 | "useWorkspaces": true, 6 | "version": "2.7.24" 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/blockchain/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerRoutes } from "./routes"; 3 | 4 | export const register = (server: Hapi.Server): void => { 5 | registerRoutes(server); 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/blockchain/routes.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { BlockchainController } from "./controller"; 3 | 4 | export const registerRoutes = (server: Hapi.Server): void => { 5 | const controller = new BlockchainController(); 6 | server.bind(controller); 7 | 8 | server.route({ 9 | method: "GET", 10 | path: "/blockchain", 11 | handler: controller.index, 12 | }); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/blocks/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/delegates/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/entities/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/entities/transformer.ts: -------------------------------------------------------------------------------- 1 | export const transformEntity = (entity: any) => { 2 | return entity; 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/locks/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/locks/transformer.ts: -------------------------------------------------------------------------------- 1 | import { formatTimestamp } from "@arkecosystem/core-utils"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | export const transformLock = (lock: Interfaces.IHtlcLock) => { 5 | return { 6 | ...lock, 7 | amount: lock.amount.toFixed(), 8 | timestamp: formatTimestamp(lock.timestamp), 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/node/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerRoutes } from "./routes"; 3 | 4 | export const register = (server: Hapi.Server): void => { 5 | registerRoutes(server); 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/node/schema.ts: -------------------------------------------------------------------------------- 1 | import joi from "@hapi/joi"; 2 | 3 | export const fees: object = { 4 | query: { 5 | days: joi 6 | .number() 7 | .integer() 8 | .min(1) 9 | .max(30) 10 | .default(7), 11 | }, 12 | }; 13 | 14 | export const debug: object = { 15 | query: { 16 | lines: joi 17 | .number() 18 | .integer() 19 | .min(1) 20 | .max(10000) 21 | .default(1000), 22 | }, 23 | }; 24 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/peers/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerRoutes } from "./routes"; 3 | 4 | export const register = (server: Hapi.Server): void => { 5 | registerRoutes(server); 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/peers/schema.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | import { peerIteratees } from "../shared/iteratees"; 3 | import { orderBy, pagination } from "../shared/schemas"; 4 | 5 | export const index: object = { 6 | query: { 7 | ...pagination, 8 | ...{ 9 | ip: Joi.string().ip(), 10 | version: Joi.string(), 11 | orderBy: orderBy(peerIteratees), 12 | }, 13 | }, 14 | }; 15 | 16 | export const show: object = { 17 | params: { 18 | ip: Joi.string().ip(), 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/peers/transformer.ts: -------------------------------------------------------------------------------- 1 | import { app } from "@arkecosystem/core-container"; 2 | 3 | export const transformPeer = model => { 4 | return { 5 | ip: model.ip, 6 | port: +app.resolveOptions("p2p").server.port, 7 | ports: model.ports, 8 | version: model.version, 9 | height: model.state ? model.state.height : model.height, 10 | latency: model.latency, 11 | }; 12 | }; 13 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/rounds/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/rounds/routes.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { RoundsController } from "./controller"; 3 | import * as Schema from "./schema"; 4 | 5 | export const registerRoutes = (server: Hapi.Server): void => { 6 | const controller = new RoundsController(); 7 | server.bind(controller); 8 | 9 | server.route({ 10 | method: "GET", 11 | path: "/rounds/{id}/delegates", 12 | handler: controller.delegates, 13 | options: { 14 | validate: Schema.delegates, 15 | }, 16 | }); 17 | }; 18 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/rounds/schema.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | export const delegates: object = { 4 | params: { 5 | id: Joi.number() 6 | .integer() 7 | .min(1), 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/rounds/transformer.ts: -------------------------------------------------------------------------------- 1 | import { Utils } from "@arkecosystem/crypto"; 2 | 3 | export const transformRoundDelegate = model => { 4 | return { 5 | publicKey: model.publicKey, 6 | votes: Utils.BigNumber.make(model.balance).toFixed(), 7 | }; 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/address.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | export const address = Joi.string() 4 | .alphanum() 5 | .length(34); 6 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/block-id.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | export const blockId = Joi.alternatives().try( 4 | Joi.string() 5 | .min(1) 6 | .max(20) 7 | .regex(/^[0-9]+$/, "decimal non-negative integer"), 8 | Joi.string() 9 | .length(64) 10 | .hex(), 11 | ); 12 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/generic-name.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | export const genericName = Joi.string() 4 | .regex(/^[a-zA-Z0-9]+(( - |[ ._-])[a-zA-Z0-9]+)*[.]?$/) 5 | .min(1) 6 | .max(40); 7 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/index.ts: -------------------------------------------------------------------------------- 1 | import { address } from "./address"; 2 | import { blockId } from "./block-id"; 3 | import { genericName } from "./generic-name"; 4 | import { orderBy } from "./order-by"; 5 | import { pagination } from "./pagination"; 6 | import { publicKey } from "./public-key"; 7 | import { username } from "./username"; 8 | import { walletId } from "./wallet-id"; 9 | 10 | export { address, blockId, genericName, orderBy, pagination, publicKey, username, walletId }; 11 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/pagination.ts: -------------------------------------------------------------------------------- 1 | import { app } from "@arkecosystem/core-container"; 2 | import Joi from "@hapi/joi"; 3 | 4 | export const pagination = { 5 | page: Joi.number() 6 | .integer() 7 | .positive(), 8 | offset: Joi.number() 9 | .integer() 10 | .min(0), 11 | limit: Joi.number() 12 | .integer() 13 | .min(1) 14 | .max(app.resolveOptions("api").pagination.limit), 15 | }; 16 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/public-key.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | export const publicKey = Joi.string() 4 | .hex() 5 | .length(66); 6 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/username.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | export const username = Joi.string() 4 | .regex(/^[a-z0-9!@$&_.]+$/) 5 | .min(1) 6 | .max(20); 7 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/schemas/wallet-id.ts: -------------------------------------------------------------------------------- 1 | import Joi from "@hapi/joi"; 2 | 3 | import { address } from "./address"; 4 | import { publicKey } from "./public-key"; 5 | import { username } from "./username"; 6 | 7 | export const walletId = Joi.alternatives().try(username, address, publicKey); 8 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/shared/transformers/fee-statistics.ts: -------------------------------------------------------------------------------- 1 | export const transformFeeStatistics = (model: any) => { 2 | return { 3 | type: model.type, 4 | fees: { 5 | minFee: parseInt(model.minFee, 10), 6 | maxFee: parseInt(model.maxFee, 10), 7 | avgFee: parseInt(model.avgFee, 10), 8 | }, 9 | }; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/transactions/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/votes/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/handlers/wallets/index.ts: -------------------------------------------------------------------------------- 1 | import Hapi from "@hapi/hapi"; 2 | import { registerMethods } from "./methods"; 3 | import { registerRoutes } from "./routes"; 4 | 5 | export const register = (server: Hapi.Server): void => { 6 | registerMethods(server); 7 | registerRoutes(server); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-api/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./defaults"; 2 | export * from "./server"; 3 | export * from "./interfaces"; 4 | export * from "./plugin"; 5 | -------------------------------------------------------------------------------- /packages/core-api/src/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./repository"; 2 | -------------------------------------------------------------------------------- /packages/core-api/src/interfaces/repository.ts: -------------------------------------------------------------------------------- 1 | export interface IRepository { 2 | databaseService: any; 3 | cache: any; 4 | model: any; 5 | query: any; 6 | columns: string[]; 7 | 8 | getModel(): object; 9 | } 10 | -------------------------------------------------------------------------------- /packages/core-api/src/plugins/pagination/config.ts: -------------------------------------------------------------------------------- 1 | // Based on https://github.com/fknop/hapi-pagination 2 | 3 | import Joi from "@hapi/joi"; 4 | 5 | export const getConfig = options => { 6 | const { error, value } = Joi.validate(options, { 7 | query: Joi.object({ 8 | limit: Joi.object({ 9 | default: Joi.number() 10 | .integer() 11 | .positive() 12 | .default(100), 13 | }), 14 | }), 15 | }); 16 | 17 | return { error: error || undefined, config: error ? undefined : value }; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/core-api/src/services/index.ts: -------------------------------------------------------------------------------- 1 | import { ServerCache } from "./cache"; 2 | import { transformerService } from "./transformer"; 3 | 4 | export { ServerCache, transformerService }; 5 | -------------------------------------------------------------------------------- /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/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | databaseRollback: { 3 | maxBlockRewind: 10000, 4 | steps: 1000, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./defaults"; 2 | export * from "./blockchain"; 3 | export * from "./plugin"; 4 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/already-forged-handler.ts: -------------------------------------------------------------------------------- 1 | import { BlockProcessorResult } from "../block-processor"; 2 | import { BlockHandler } from "./block-handler"; 3 | 4 | export class AlreadyForgedHandler extends BlockHandler { 5 | public async execute(): Promise { 6 | await super.execute(); 7 | 8 | return BlockProcessorResult.DiscardedButCanBeBroadcasted; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/incompatible-transactions-handler.ts: -------------------------------------------------------------------------------- 1 | import { BlockProcessorResult } from "../block-processor"; 2 | import { BlockHandler } from "./block-handler"; 3 | 4 | export class IncompatibleTransactionsHandler extends BlockHandler { 5 | public async execute(): Promise { 6 | await super.execute(); 7 | 8 | return BlockProcessorResult.Rejected; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./accept-block-handler"; 2 | export * from "./already-forged-handler"; 3 | export * from "./block-handler"; 4 | export * from "./exception-handler"; 5 | export * from "./incompatible-transactions-handler"; 6 | export * from "./invalid-generator-handler"; 7 | export * from "./nonce-out-of-order-handler"; 8 | export * from "./unchained-handler"; 9 | export * from "./verification-failed-handler"; 10 | export * from "./invalid-reward-handler"; 11 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/invalid-generator-handler.ts: -------------------------------------------------------------------------------- 1 | import { BlockHandler } from "./block-handler"; 2 | 3 | export class InvalidGeneratorHandler extends BlockHandler {} 4 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/invalid-reward-handler.ts: -------------------------------------------------------------------------------- 1 | import { BlockHandler } from "./block-handler"; 2 | 3 | export class InvalidRewardHandler extends BlockHandler {} 4 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/nonce-out-of-order-handler.ts: -------------------------------------------------------------------------------- 1 | import { BlockProcessorResult } from "../block-processor"; 2 | import { BlockHandler } from "./block-handler"; 3 | 4 | export class NonceOutOfOrderHandler extends BlockHandler { 5 | public async execute(): Promise { 6 | await super.execute(); 7 | 8 | return BlockProcessorResult.Rejected; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/handlers/verification-failed-handler.ts: -------------------------------------------------------------------------------- 1 | import { BlockProcessorResult } from "../block-processor"; 2 | import { BlockHandler } from "./block-handler"; 3 | 4 | export class VerificationFailedHandler extends BlockHandler { 5 | public async execute(): Promise { 6 | return super.execute(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/processor/index.ts: -------------------------------------------------------------------------------- 1 | export * from "../processor/block-processor"; 2 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/replay/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./replay-blockchain"; 2 | -------------------------------------------------------------------------------- /packages/core-blockchain/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./tick-sync-tracker"; 2 | export * from "./validate-generator"; 3 | -------------------------------------------------------------------------------- /packages/core-blockchain/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-container/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container as container } from "@arkecosystem/core-interfaces"; 2 | import { Container } from "./container"; 3 | 4 | export const app: container.IContainer = new Container(); 5 | -------------------------------------------------------------------------------- /packages/core-container/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./postgres-connection"; 2 | export * from "./migrations"; 3 | export * from "./state-builder"; 4 | export * from "./models"; 5 | export * from "./repositories"; 6 | export * from "./plugin"; 7 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | import { Database } from "@arkecosystem/core-interfaces"; 2 | 3 | export interface IMigration { 4 | id: number; 5 | name: string; 6 | } 7 | 8 | export interface IColumnDescriptor { 9 | name: string; 10 | supportedOperators?: Database.SearchOperator[]; 11 | prop?: string; 12 | init?: any; 13 | def?: any; 14 | } 15 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20180304100000-create-migrations-table.sql: -------------------------------------------------------------------------------- 1 | -- Table Definition 2 | CREATE TABLE IF NOT EXISTS ${schema~}.migrations ( 3 | "id" SERIAL PRIMARY KEY, 4 | "name" VARCHAR(255) UNIQUE NOT NULL 5 | ); 6 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20180305200000-create-rounds-table.sql: -------------------------------------------------------------------------------- 1 | -- Table Definition 2 | CREATE TABLE IF NOT EXISTS ${schema~}.rounds ( 3 | "id" SERIAL PRIMARY KEY, 4 | "public_key" VARCHAR(66) NOT NULL, 5 | "balance" BIGINT NOT NULL, 6 | "round" BIGINT NOT NULL 7 | ); 8 | 9 | -- Constraints 10 | CREATE UNIQUE INDEX IF NOT EXISTS "rounds_unique" ON rounds ("round", "public_key"); 11 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20181129400000-add-block_id-index-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | -- Constraints 2 | CREATE INDEX IF NOT EXISTS "transactions_block_id" ON ${schema~}.transactions ("block_id"); 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20181204100000-add-generator_public_key-index-to-blocks-table.sql: -------------------------------------------------------------------------------- 1 | DROP INDEX IF EXISTS "blocks_unique"; 2 | CREATE INDEX IF NOT EXISTS "blocks_generator_public_key" ON ${schema~}.blocks ("generator_public_key"); 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20181204200000-add-timestamp-index-to-blocks-table.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "transactions_timestamp" ON ${schema~}.transactions ("timestamp"); 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20181204300000-add-sender_public_key-index-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "transactions_sender_public_key" ON ${schema~}.transactions ("sender_public_key"); 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20181204400000-add-recipient_id-index-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "transactions_recipient_id" ON ${schema~}.transactions ("recipient_id"); 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20190307000000-drop-wallets-table.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS "wallets"; 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20190606000000-add-block-id-foreign-key-on-transactions.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE transactions DROP CONSTRAINT IF EXISTS "transactions_block_id_fkey"; 2 | ALTER TABLE transactions ADD CONSTRAINT "transactions_block_id_fkey" FOREIGN KEY (block_id) REFERENCES blocks (id); 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20190619000000-drop-id-column-from-rounds-table.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE rounds DROP COLUMN id, ADD PRIMARY KEY (round, public_key); 2 | DROP INDEX rounds_unique; 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20190803000000-add-type_group-column-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE transactions DROP COLUMN IF EXISTS type_group; 2 | ALTER TABLE transactions ADD COLUMN type_group INTEGER NOT NULL DEFAULT 1; 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20190917000000-add-asset-column-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE transactions DROP COLUMN IF EXISTS asset; 2 | ALTER TABLE transactions ADD COLUMN asset JSONB; 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20191003000000-migrate-vendor-field-hex.sql: -------------------------------------------------------------------------------- 1 | UPDATE transactions SET vendor_field_hex = ('\x' || ENCODE(vendor_field_hex, 'escape'))::BYTEA; 2 | 3 | ALTER TABLE transactions RENAME vendor_field_hex TO vendor_field; 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20191008000000-add-type-index-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "transactions_type" ON ${schema~}.transactions ("type"); 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20200304000000-add-type_group-index-to-transactions-table.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "transactions_type_group" ON ${schema~}.transactions ("type_group"); 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20201005000000-add-block-timestamp-index.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "blocks_timestamp_asc" ON ${schema~}.blocks ("timestamp" ASC); -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/20201117000000-add-generator_public_key_height-index-to-blocks-table.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS "blocks_generator_public_key_height" ON ${schema~}.blocks ("generator_public_key", "height"); 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/migrations/index.ts: -------------------------------------------------------------------------------- 1 | import { readdirSync } from "fs"; 2 | import { loadQueryFile } from "../utils"; 3 | 4 | export const migrations = readdirSync(__dirname) 5 | .filter(name => name.substr(-4).toLowerCase() === '.sql') 6 | .sort() 7 | .map(name => loadQueryFile(__dirname, name)); 8 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/models/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./model"; 2 | export * from "./block"; 3 | export * from "./migration"; 4 | export * from "./round"; 5 | export * from "./transaction"; 6 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/models/migration.ts: -------------------------------------------------------------------------------- 1 | import { IColumnDescriptor } from "../interfaces"; 2 | import { Model } from "./model"; 3 | 4 | export class Migration extends Model { 5 | protected columnsDescriptor: IColumnDescriptor[] = [ 6 | { 7 | name: "name", 8 | }, 9 | ]; 10 | 11 | public getTable(): string { 12 | return "migrations"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/common.sql: -------------------------------------------------------------------------------- 1 | SELECT MAX("height") AS "height", 2 | "id", 3 | "previous_block", 4 | "timestamp" 5 | FROM blocks 6 | WHERE "id" IN (${ids:list}) 7 | GROUP BY "id" 8 | ORDER BY "height" DESC 9 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/count.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT (DISTINCT "height") AS "count" 2 | FROM blocks 3 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/delete.sql: -------------------------------------------------------------------------------- 1 | DELETE 2 | FROM blocks 3 | WHERE id IN (${ids:list}) 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/find-by-height.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | WHERE height = ${height} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/find-by-heights.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | WHERE height IN (${heights:list}) 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/find-by-id.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | WHERE id = ${id} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/headers.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | WHERE height BETWEEN ${start} AND ${end} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/height-range-with-transactions.sql: -------------------------------------------------------------------------------- 1 | SELECT *, 2 | (SELECT NULLIF(ARRAY 3 | (SELECT encode(serialized, 'hex') 4 | FROM transactions 5 | WHERE transactions.block_id = blocks.id 6 | ORDER BY transactions.sequence ASC 7 | ), '{}') AS transactions) 8 | FROM blocks 9 | WHERE height 10 | BETWEEN ${start} AND ${end} 11 | ORDER BY height ASC -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/height-range.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | WHERE height BETWEEN ${start} AND ${end} 4 | ORDER BY height ASC 5 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/latest.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | ORDER BY height DESC LIMIT 1 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/recent.sql: -------------------------------------------------------------------------------- 1 | SELECT id 2 | FROM blocks 3 | ORDER BY TIMESTAMP DESC LIMIT 10 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/statistics.sql: -------------------------------------------------------------------------------- 1 | SELECT SUM ("number_of_transactions") AS "numberOfTransactions", 2 | SUM ("total_fee") AS "totalFee", 3 | SUM ("removed_fee") AS "removedFee", 4 | SUM ("total_amount") AS "totalAmount", 5 | COUNT (DISTINCT "height") AS "count" 6 | FROM blocks 7 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/blocks/top.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | ORDER BY height DESC LIMIT ${top} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/common/truncate-all-tables.sql: -------------------------------------------------------------------------------- 1 | TRUNCATE TABLE blocks, rounds, transactions RESTART IDENTITY; 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/migrations/create.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO migrations (name) VALUES (${name}) 2 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/migrations/find.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM migrations 3 | WHERE name = ${name} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/rounds/delete.sql: -------------------------------------------------------------------------------- 1 | DELETE 2 | FROM rounds 3 | WHERE round >= ${round} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/rounds/find.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM rounds 3 | WHERE round = ${round} 4 | ORDER BY balance DESC, 5 | public_key ASC 6 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/block-rewards.sql: -------------------------------------------------------------------------------- 1 | SELECT generator_public_key, 2 | SUM ("reward" + "total_fee") AS "reward" 3 | FROM blocks 4 | GROUP BY "generator_public_key" 5 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/claimed-locks.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | SUM(amount) as "amount", recipient_id 3 | FROM 4 | transactions 5 | WHERE 6 | id 7 | IN ( 8 | SELECT asset->'claim'->>'lockTransactionId' 9 | FROM 10 | transactions 11 | WHERE 12 | type IN (9) 13 | AND 14 | type_group = 1 15 | ) 16 | GROUP BY 17 | recipient_id; -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/count-type.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT(id) as "count" 2 | FROM transactions 3 | WHERE type = ${type} AND type_group = ${typeGroup} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/delegates-forged-blocks.sql: -------------------------------------------------------------------------------- 1 | SELECT generator_public_key, 2 | SUM ("total_fee") AS "total_fees", 3 | SUM ("removed_fee") AS "removed_fees", 4 | SUM ("reward") AS "total_rewards", 5 | COUNT ("total_amount") AS "total_produced" 6 | FROM blocks 7 | GROUP BY "generator_public_key" 8 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/delegates.sql: -------------------------------------------------------------------------------- 1 | SELECT sender_public_key, 2 | asset 3 | FROM transactions 4 | WHERE type = 2 AND type_group = 1 -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/ipfs.sql: -------------------------------------------------------------------------------- 1 | SELECT sender_public_key, 2 | asset 3 | FROM transactions 4 | WHERE type = 5 AND type_group = 1 5 | ORDER BY timestamp DESC, sequence ASC 6 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/last-forged-blocks.sql: -------------------------------------------------------------------------------- 1 | SELECT id, 2 | height, 3 | generator_public_key, 4 | TIMESTAMP 5 | FROM blocks 6 | WHERE height IN ( 7 | SELECT MAX(height) AS last_block_height 8 | FROM blocks 9 | GROUP BY generator_public_key 10 | ) 11 | ORDER BY TIMESTAMP DESC 12 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/multi-signatures.sql: -------------------------------------------------------------------------------- 1 | SELECT sender_public_key, 2 | asset, 3 | version 4 | FROM transactions 5 | WHERE type = 4 AND type_group = 1 6 | ORDER BY (timestamp + sequence) DESC 7 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/open-locks.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | id, amount, timestamp, vendor_field, 3 | sender_public_key, asset, recipient_id, 4 | NOT EXISTS (SELECT id WHERE id IN ( 5 | SELECT COALESCE( 6 | asset->'refund'->>'lockTransactionId', 7 | asset->'claim'->>'lockTransactionId' 8 | ) 9 | FROM transactions 10 | WHERE 11 | type IN (9, 10) 12 | AND 13 | type_group = 1) 14 | ) as "open" 15 | FROM transactions 16 | WHERE 17 | type = 8 18 | AND 19 | type_group = 1; -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/received-transactions.sql: -------------------------------------------------------------------------------- 1 | SELECT recipient_id, 2 | SUM ("amount") AS "amount" 3 | FROM transactions 4 | WHERE type = 0 AND type_group = 1 5 | GROUP BY "recipient_id" 6 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/refunded-locks.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | SUM(amount) as "amount", sender_public_key 3 | FROM 4 | transactions 5 | WHERE 6 | id 7 | IN ( 8 | SELECT asset->'refund'->>'lockTransactionId' 9 | FROM 10 | transactions 11 | WHERE 12 | type IN (10) 13 | AND 14 | type_group = 1 15 | ) 16 | GROUP BY 17 | sender_public_key; -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/second-signatures.sql: -------------------------------------------------------------------------------- 1 | SELECT sender_public_key, 2 | asset 3 | FROM transactions 4 | WHERE type = 1 AND type_group = 1 -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/state-builder/sent-transactions.sql: -------------------------------------------------------------------------------- 1 | SELECT sender_public_key, 2 | SUM ("amount") AS "amount", 3 | SUM ("fee") AS "fee", 4 | COUNT ("id") AS "nonce" 5 | FROM transactions 6 | GROUP BY "sender_public_key" 7 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/delete-by-block.sql: -------------------------------------------------------------------------------- 1 | DELETE 2 | FROM transactions 3 | WHERE block_id IN (${ids:list}) 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/fee-statistics.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | type_group, 3 | type, 4 | AVG(fee)::int8 as "avg", 5 | MIN(fee)::int8 as "min", 6 | MAX(fee)::int8 as "max", 7 | SUM(fee)::int8 as "sum" 8 | FROM 9 | transactions 10 | WHERE 11 | transactions.timestamp >= ${age} AND fee >= ${minFee} 12 | GROUP BY 13 | type_group, type 14 | ORDER BY 15 | type_group, type 16 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/find-by-block.sql: -------------------------------------------------------------------------------- 1 | SELECT id, serialized 2 | FROM transactions 3 | WHERE block_id = ${id} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/find-by-htlc-locks.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM transactions 3 | WHERE 4 | type IN (9, 10) 5 | AND 6 | type_group = 1 7 | AND 8 | ( 9 | asset->'refund'->'lockTransactionId' ?| array[${ids}] 10 | OR 11 | asset->'claim'->'lockTransactionId' ?| array[${ids}] 12 | ) 13 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/find-by-id.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM transactions 3 | WHERE id = ${id} 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/forged.sql: -------------------------------------------------------------------------------- 1 | SELECT id 2 | FROM transactions 3 | WHERE id IN (${ids:list}) 4 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/latest-by-block.sql: -------------------------------------------------------------------------------- 1 | SELECT id, serialized 2 | FROM transactions 3 | WHERE block_id = ${id} 4 | ORDER BY sequence ASC 5 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/latest-by-blocks.sql: -------------------------------------------------------------------------------- 1 | SELECT id, 2 | block_id, 3 | serialized 4 | FROM transactions 5 | WHERE block_id IN (${ids:list}) 6 | ORDER BY sequence ASC 7 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/queries/transactions/statistics.sql: -------------------------------------------------------------------------------- 1 | SELECT COUNT ("id") AS "count", 2 | SUM ("fee") AS "totalFee", 3 | SUM ("amount") AS "totalAmount" 4 | FROM transactions 5 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/repositories/index.ts: -------------------------------------------------------------------------------- 1 | import { BlocksRepository } from "./blocks"; 2 | import { MigrationsRepository } from "./migrations"; 3 | import { RoundsRepository } from "./rounds"; 4 | import { TransactionsRepository } from "./transactions"; 5 | 6 | export const repositories = { 7 | blocks: BlocksRepository, 8 | migrations: MigrationsRepository, 9 | rounds: RoundsRepository, 10 | transactions: TransactionsRepository, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-database-postgres/src/repositories/migrations.ts: -------------------------------------------------------------------------------- 1 | import { IMigration } from "../interfaces"; 2 | import { Migration } from "../models"; 3 | import { queries } from "../queries"; 4 | import { Repository } from "./repository"; 5 | 6 | export class MigrationsRepository extends Repository { 7 | public async findByName(name: string): Promise { 8 | return this.db.oneOrNone(queries.migrations.find, { name }); 9 | } 10 | 11 | public getModel(): Migration { 12 | return new Migration(this.pgp); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/core-database-postgres/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-database/src/factory.ts: -------------------------------------------------------------------------------- 1 | import { Database } from "@arkecosystem/core-interfaces"; 2 | 3 | export class ConnectionFactory { 4 | public async make(connection: Database.IConnection): Promise { 5 | return connection.make(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-database/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./manager"; 2 | export * from "./database-service-factory"; 3 | export * from "./database-service"; 4 | export * from "./repositories/wallets-business-repository"; 5 | export * from "./plugin"; 6 | -------------------------------------------------------------------------------- /packages/core-database/src/plugin.ts: -------------------------------------------------------------------------------- 1 | import { Container, Logger } from "@arkecosystem/core-interfaces"; 2 | import { ConnectionManager } from "./manager"; 3 | 4 | export const plugin: Container.IPluginDescriptor = { 5 | pkg: require("../package.json"), 6 | alias: "database-manager", 7 | async register(container: Container.IContainer, options) { 8 | container.resolvePlugin("logger").info("Starting Database Manager"); 9 | 10 | return new ConnectionManager(); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/core-database/src/repositories/utils/get-property.ts: -------------------------------------------------------------------------------- 1 | export const getProperty = (item: any, prop: string): any => { 2 | for (const [key, value] of Object.entries(item)) { 3 | if (key === prop) { 4 | return value; 5 | } 6 | 7 | if (value && value.constructor.name === "Object") { 8 | const result = getProperty(value, prop); 9 | if (result !== undefined) { 10 | return result; 11 | } 12 | } 13 | } 14 | 15 | return undefined; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/core-database/src/repositories/utils/limit-rows.ts: -------------------------------------------------------------------------------- 1 | import { Database } from "@arkecosystem/core-interfaces"; 2 | /** 3 | * Return some rows by an offset and a limit. 4 | */ 5 | export = (rows: ReadonlyArray, params: Database.IParameters) => { 6 | if (params.offset || params.limit) { 7 | const offset = params.offset || 0; 8 | const limit = params.limit ? offset + params.limit : rows.length; 9 | 10 | return rows.slice(offset, limit); 11 | } 12 | 13 | return rows; 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-database/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-elasticsearch/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | server: { 3 | host: "0.0.0.0", 4 | port: 4007, 5 | whitelist: ["*"], 6 | }, 7 | client: { 8 | nodes: ["http://localhost:9200"], 9 | }, 10 | chunkSize: 5000, 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-elasticsearch/src/utils.ts: -------------------------------------------------------------------------------- 1 | export const first = (values: T[]): T => { 2 | return values[0]; 3 | }; 4 | 5 | export const last = (values: T[]): T => { 6 | return values[values.length - 1]; 7 | }; 8 | -------------------------------------------------------------------------------- /packages/core-elasticsearch/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-error-tracker-airbrake/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | projectId: process.env.CORE_ERROR_TRACKER_AIRBRAKE_PROJECT_ID, 3 | projectKey: process.env.CORE_ERROR_TRACKER_AIRBRAKE_PROJECT_KEY, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/core-error-tracker-airbrake/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import AirBrake from "airbrake-js"; 3 | import { defaults } from "./defaults"; 4 | 5 | export const plugin: Container.IPluginDescriptor = { 6 | pkg: require("../package.json"), 7 | defaults, 8 | alias: "error-tracker", 9 | async register(container: Container.IContainer, options) { 10 | return new AirBrake(options); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/core-error-tracker-airbrake/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-error-tracker-bugsnag/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | apiKey: process.env.CORE_ERROR_TRACKER_BUGSNAG_API_KEY, 3 | metaData: { 4 | network: process.env.CORE_NETWORK_NAME, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-error-tracker-bugsnag/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-error-tracker-raygun/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | apiKey: process.env.CORE_ERROR_TRACKER_RAYGUN_API_KEY, 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-error-tracker-raygun/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import raygun from "raygun"; 3 | import { defaults } from "./defaults"; 4 | 5 | export const plugin: Container.IPluginDescriptor = { 6 | pkg: require("../package.json"), 7 | defaults, 8 | alias: "error-tracker", 9 | async register(container: Container.IContainer, options: Container.IPluginOptions) { 10 | return new raygun.Client().init((options as unknown) as raygun.raygun.RaygunOptions); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/core-error-tracker-raygun/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-error-tracker-rollbar/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | accessToken: process.env.CORE_ERROR_TRACKER_ROLLBAR_ACCESS_TOKEN, 3 | captureUncaught: true, 4 | captureUnhandledRejections: true, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/core-error-tracker-rollbar/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import Rollbar from "rollbar"; 3 | import { defaults } from "./defaults"; 4 | 5 | export const plugin: Container.IPluginDescriptor = { 6 | pkg: require("../package.json"), 7 | defaults, 8 | alias: "error-tracker", 9 | async register(container: Container.IContainer, options) { 10 | return new Rollbar(options); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /packages/core-error-tracker-rollbar/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-error-tracker-sentry/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | dsn: process.env.CORE_ERROR_TRACKER_SENTRY_DSN, 3 | debug: true, 4 | attachStacktrace: true, 5 | environment: process.env.CORE_NETWORK_NAME, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-error-tracker-sentry/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import Sentry from "@sentry/node"; 3 | import { defaults } from "./defaults"; 4 | 5 | export const plugin: Container.IPluginDescriptor = { 6 | pkg: require("../package.json"), 7 | defaults, 8 | alias: "error-tracker", 9 | async register(container: Container.IContainer, options) { 10 | Sentry.init(options); 11 | 12 | return Sentry; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-error-tracker-sentry/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-event-emitter/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-exchange-json-rpc/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | enabled: process.env.CORE_EXCHANGE_JSON_RPC_ENABLED, 3 | host: process.env.CORE_EXCHANGE_JSON_RPC_HOST || "0.0.0.0", 4 | port: process.env.CORE_EXCHANGE_JSON_RPC_PORT || 8080, 5 | allowRemote: false, 6 | whitelist: ["127.0.0.1", "::ffff:127.0.0.1"], 7 | database: process.env.CORE_EXCHANGE_JSON_RPC_DATABASE || `${process.env.CORE_PATH_DATA}/json-rpc.sqlite`, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-exchange-json-rpc/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-explorer/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | server: { 3 | host: process.env.CORE_EXPLORER_HOST || "0.0.0.0", 4 | port: process.env.CORE_EXPLORER_PORT || 4200, 5 | }, 6 | path: process.env.CORE_EXPLORER_PATH, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/core-explorer/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /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 | }; 9 | -------------------------------------------------------------------------------- /packages/core-forger/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin"; 2 | export * from "./delegate"; 3 | -------------------------------------------------------------------------------- /packages/core-forger/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | import { SCClientSocket } from "socketcluster-client"; 2 | 3 | export interface IRelayHost { 4 | hostname: string; 5 | port: number; 6 | socket?: SCClientSocket; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-forger/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-http-utils/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as plugins from "./plugins"; 2 | import { createServer } from "./server/create"; 3 | import { monitorServer } from "./server/monitor"; 4 | import { mountServer } from "./server/mount"; 5 | 6 | export { createServer, monitorServer, mountServer, plugins }; 7 | -------------------------------------------------------------------------------- /packages/core-http-utils/src/plugins/content-type.ts: -------------------------------------------------------------------------------- 1 | export const contentType = { 2 | name: "content-type", 3 | version: "0.1.0", 4 | register(server, options) { 5 | server.ext({ 6 | type: "onPreHandler", 7 | async method(request, h) { 8 | request.headers["content-type"] = "application/json"; 9 | 10 | return h.continue; 11 | }, 12 | }); 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-http-utils/src/plugins/index.ts: -------------------------------------------------------------------------------- 1 | export { hapiAjv } from "./hapi-ajv"; 2 | export { contentType } from "./content-type"; 3 | export { corsHeaders } from "./cors-headers"; 4 | export { transactionPayload } from "./transaction-payload"; 5 | export { whitelist } from "./whitelist"; 6 | -------------------------------------------------------------------------------- /packages/core-http-utils/src/server/mount.ts: -------------------------------------------------------------------------------- 1 | import { app } from "@arkecosystem/core-container"; 2 | 3 | export const mountServer = async (name, server) => { 4 | try { 5 | await server.start(); 6 | 7 | app.resolvePlugin("logger").info(`${name} Server running at: ${server.info.uri}`); 8 | 9 | return server; 10 | } catch (error) { 11 | console.log(error); 12 | app.forceExit(`Could not start ${name} Server!`, error); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /packages/core-http-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-blockchain/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./blockchain"; 2 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-container/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./container"; 2 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/business-repository/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./wallets-business-repository"; 2 | export * from "./parameters"; 3 | export * from "./blocks-business-repository"; 4 | export * from "./transactions-business-repository"; 5 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/business-repository/parameters.ts: -------------------------------------------------------------------------------- 1 | export interface IParameters { 2 | offset?: number; 3 | limit?: number; 4 | orderBy?: string; 5 | [key: string]: object | number | string | boolean; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/database-model/database-model.ts: -------------------------------------------------------------------------------- 1 | import { SearchOperator } from "../search"; 2 | 3 | export interface ISearchableField { 4 | fieldName: string; 5 | supportedOperators: SearchOperator[]; 6 | } 7 | 8 | export interface IModel { 9 | getName(): string; 10 | 11 | getTable(): string; 12 | 13 | query(): any; 14 | 15 | getColumnSet(): any; 16 | 17 | /* A list of fields on this model that can be queried, and each search-operator they support */ 18 | getSearchableFields(): ISearchableField[]; 19 | } 20 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/database-model/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./database-model"; 2 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/database-repository/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./transactions-repository"; 2 | export * from "./rounds-repository"; 3 | export * from "./wallets-repository"; 4 | export * from "./blocks-repository"; 5 | export * from "./repository"; 6 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/database-repository/repository.ts: -------------------------------------------------------------------------------- 1 | import { IModel } from "../database-model"; 2 | 3 | export interface IRepository { 4 | getModel(): IModel; 5 | 6 | truncate(): Promise; 7 | 8 | insert(item: object | object[], db?: any): Promise; 9 | 10 | update(item: object | object[]): Promise; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/database-repository/rounds-repository.ts: -------------------------------------------------------------------------------- 1 | import { IRepository } from "./repository"; 2 | 3 | export interface IRound { 4 | id: number; 5 | publicKey: string; 6 | balance: string; 7 | round: number; 8 | } 9 | 10 | export interface IRoundsRepository extends IRepository { 11 | findById(id: number): Promise; 12 | delete(id: number, db?: any): Promise; 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/database-repository/wallets-repository.ts: -------------------------------------------------------------------------------- 1 | import { IWallet } from "../../core-state/wallets"; 2 | import { IRepository } from "./repository"; 3 | 4 | export interface IWalletsRepository extends IRepository { 5 | all(): Promise; 6 | findByAddress(address: string): Promise; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/event-types.ts: -------------------------------------------------------------------------------- 1 | export enum DatabaseEvents { 2 | PRE_CONNECT = "database.preConnect", 3 | POST_CONNECT = "database.postConnect", 4 | PRE_DISCONNECT = "database.preDisconnect", 5 | POST_DISCONNECT = "database.postDisconnect", 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./database-repository"; 2 | export * from "./business-repository"; 3 | export * from "./database-connection"; 4 | export * from "./database-service"; 5 | export * from "./event-types"; 6 | export * from "./search"; 7 | export * from "./database-model"; 8 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/search/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./search-parameter-converter"; 2 | export * from "./search-parameters"; 3 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-database/search/search-parameter-converter.ts: -------------------------------------------------------------------------------- 1 | import { IParameters } from "../business-repository"; 2 | import { ISearchParameters } from "./search-parameters"; 3 | 4 | export interface IISearchParameterConverter { 5 | convert(params: IParameters, orderBy?: any, paginate?: any): ISearchParameters; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-event-emitter/index.ts: -------------------------------------------------------------------------------- 1 | export { EventEmitter } from "events"; 2 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-logger/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./logger"; 2 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-logger/logger.ts: -------------------------------------------------------------------------------- 1 | export interface ILogger { 2 | make(): ILogger; 3 | getLogger(): T; 4 | 5 | log(level: string, message: any): boolean; 6 | error(message: any): boolean; 7 | warn(message: any): boolean; 8 | info(message: any): boolean; 9 | debug(message: any): boolean; 10 | verbose(message: any): boolean; 11 | 12 | suppressConsoleOutput(suppress?: boolean): void; 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-p2p/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./index"; 2 | export * from "./network-monitor"; 3 | export * from "./network-state"; 4 | export * from "./peer-communicator"; 5 | export * from "./peer-connector"; 6 | export * from "./peer-processor"; 7 | export * from "./peer-service"; 8 | export * from "./peer-storage"; 9 | export * from "./peer-verifier"; 10 | export * from "./peer"; 11 | export * from "./server"; 12 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-p2p/peer-processor.ts: -------------------------------------------------------------------------------- 1 | export interface IAcceptNewPeerOptions { 2 | seed?: boolean; 3 | lessVerbose?: boolean; 4 | } 5 | 6 | export interface IPeerProcessor { 7 | validateAndAcceptPeer(peer, options?: IAcceptNewPeerOptions): Promise; 8 | validatePeerIp(peer, options?: IAcceptNewPeerOptions): boolean; 9 | } 10 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-p2p/peer-service.ts: -------------------------------------------------------------------------------- 1 | import { INetworkMonitor } from "./network-monitor"; 2 | import { IPeerCommunicator } from "./peer-communicator"; 3 | import { IPeerConnector } from "./peer-connector"; 4 | import { IPeerProcessor } from "./peer-processor"; 5 | import { IPeerStorage } from "./peer-storage"; 6 | 7 | export interface IPeerService { 8 | getStorage(): IPeerStorage; 9 | getProcessor(): IPeerProcessor; 10 | getConnector(): IPeerConnector; 11 | getCommunicator(): IPeerCommunicator; 12 | getMonitor(): INetworkMonitor; 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-p2p/peer-verifier.ts: -------------------------------------------------------------------------------- 1 | export interface IPeerVerificationResult { 2 | readonly myHeight: number; 3 | readonly hisHeight: number; 4 | readonly highestCommonHeight: number; 5 | readonly forked: boolean; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-state/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./service"; 2 | export * from "./state-store"; 3 | export * from "./wallets"; 4 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-state/service.ts: -------------------------------------------------------------------------------- 1 | import { IStateStore } from "./state-store"; 2 | 3 | export interface IStateService { 4 | getBlocks(): any; // @TODO: add type 5 | getTransactions(): any; // @TODO: add type 6 | getStore(): IStateStore; 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/core-transaction-pool/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./connection"; 2 | export * from "./processor"; 3 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as Blockchain from "./core-blockchain"; 2 | import * as Container from "./core-container"; 3 | import * as Database from "./core-database"; 4 | import * as EventEmitter from "./core-event-emitter"; 5 | import * as Logger from "./core-logger"; 6 | import * as P2P from "./core-p2p"; 7 | import * as State from "./core-state"; 8 | import * as TransactionPool from "./core-transaction-pool"; 9 | import * as Shared from "./shared"; 10 | 11 | export { Container, Logger, Blockchain, TransactionPool, EventEmitter, P2P, Database, Shared, State }; 12 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./interfaces"; 2 | -------------------------------------------------------------------------------- /packages/core-interfaces/src/shared/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface IRoundInfo { 2 | round: number; 3 | nextRound: number; 4 | maxDelegates: number; 5 | roundHeight: number; 6 | } 7 | -------------------------------------------------------------------------------- /packages/core-interfaces/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/api/index.ts: -------------------------------------------------------------------------------- 1 | import "./block"; 2 | import "./peer"; 3 | import "./response"; 4 | import "./transaction"; 5 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/blockchain/index.ts: -------------------------------------------------------------------------------- 1 | import "./dispatch"; 2 | import "./execute-on-entry"; 3 | import "./transition"; 4 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/fields/address.ts: -------------------------------------------------------------------------------- 1 | import { Identities } from "@arkecosystem/crypto"; 2 | 3 | export {}; 4 | 5 | declare global { 6 | namespace jest { 7 | // tslint:disable-next-line:interface-name 8 | interface Matchers { 9 | toBeAddress(): R; 10 | } 11 | } 12 | } 13 | 14 | expect.extend({ 15 | toBeAddress: (received, argument) => { 16 | return { 17 | message: () => "Expected value to be a valid address", 18 | pass: Identities.Address.validate(received, argument), 19 | }; 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/fields/index.ts: -------------------------------------------------------------------------------- 1 | import "./address"; 2 | import "./public-key"; 3 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/fields/public-key.ts: -------------------------------------------------------------------------------- 1 | import { Identities } from "@arkecosystem/crypto"; 2 | 3 | export {}; 4 | 5 | declare global { 6 | namespace jest { 7 | // tslint:disable-next-line:interface-name 8 | interface Matchers { 9 | toBePublicKey(): R; 10 | } 11 | } 12 | } 13 | 14 | expect.extend({ 15 | toBePublicKey: received => { 16 | return { 17 | message: () => "Expected value to be a valid public key", 18 | pass: Identities.PublicKey.validate(received), 19 | }; 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/functional/index.ts: -------------------------------------------------------------------------------- 1 | import "./accepted"; 2 | import "./entity"; 3 | import "./forged"; 4 | import "./rejected"; 5 | import "./unconfirmed"; 6 | import "./vote-balance"; 7 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/index.ts: -------------------------------------------------------------------------------- 1 | import "jest-extended"; 2 | 3 | import "./api"; 4 | import "./blockchain"; 5 | import "./fields"; 6 | import "./functional"; 7 | import "./models"; 8 | import "./transactions"; 9 | 10 | import "./fields"; 11 | import "./models"; 12 | import "./transactions"; 13 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import "./delegate"; 2 | import "./transaction"; 3 | import "./wallet"; 4 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/transactions/index.ts: -------------------------------------------------------------------------------- 1 | import "./types"; 2 | import "./valid"; 3 | import "./valid-second-signature"; 4 | -------------------------------------------------------------------------------- /packages/core-jest-matchers/src/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-jest-matchers/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 || "debug", 4 | file: process.env.CORE_LOG_LEVEL_FILE || "trace", 5 | }, 6 | fileRotator: { 7 | interval: "1d", 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-logger-pino/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./driver"; 2 | export * from "./plugin"; 3 | -------------------------------------------------------------------------------- /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-logger-signale/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | logLevel: process.env.CORE_LOG_LEVEL || "info", 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-logger-signale/src/driver.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from "@arkecosystem/core-interfaces"; 2 | import { AbstractLogger } from "@arkecosystem/core-logger"; 3 | import { Signale } from "signale"; 4 | 5 | export class SignaleLogger extends AbstractLogger { 6 | protected logger: Signale; 7 | 8 | public make(): Logger.ILogger { 9 | this.logger = new Signale(this.options); 10 | 11 | return this; 12 | } 13 | 14 | protected getLevels(): Record { 15 | return { 16 | verbose: "note", 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/core-logger-signale/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./driver"; 2 | export * from "./plugin"; 3 | -------------------------------------------------------------------------------- /packages/core-logger-signale/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-logger-winston/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./driver"; 2 | export * from "./formatter"; 3 | export * from "./plugin"; 4 | -------------------------------------------------------------------------------- /packages/core-logger-winston/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | import TransportStream from "winston-transport"; 2 | 3 | export interface ITransportStream extends TransportStream { 4 | name: string; 5 | } 6 | 7 | export interface ITransport { 8 | package?: string; 9 | constructor: string; 10 | options: Record; 11 | } 12 | -------------------------------------------------------------------------------- /packages/core-logger-winston/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-logger/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./manager"; 2 | export * from "./logger"; 3 | export * from "./plugin"; 4 | -------------------------------------------------------------------------------- /packages/core-logger/src/plugin.ts: -------------------------------------------------------------------------------- 1 | import { LoggerManager } from "./manager"; 2 | 3 | export const plugin = { 4 | pkg: require("../package.json"), 5 | alias: "log-manager", 6 | async register() { 7 | return new LoggerManager(); 8 | }, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-logger/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 | import * as Builders from "./builders"; 2 | import * as Enums from "./enums"; 3 | import * as Interfaces from "./interfaces"; 4 | import * as Transactions from "./transactions"; 5 | 6 | export { Builders, Enums, Interfaces, Transactions }; 7 | -------------------------------------------------------------------------------- /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/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = {}; 2 | -------------------------------------------------------------------------------- /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/magistrate-handler.ts: -------------------------------------------------------------------------------- 1 | import { Handlers } from "@arkecosystem/core-transactions"; 2 | import { Managers } from "@arkecosystem/crypto"; 3 | 4 | export abstract class MagistrateTransactionHandler extends Handlers.TransactionHandler { 5 | public async isActivated(): Promise { 6 | const milestone = Managers.configManager.getMilestone(); 7 | return milestone.aip11 === true && !milestone.aip36; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /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 | import * as Handlers from "./handlers"; 2 | export { Handlers }; 3 | export * from "./plugin"; 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-new-relic/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import newrelic from "newrelic"; 3 | 4 | export const plugin: Container.IPluginDescriptor = { 5 | pkg: require("../package.json"), 6 | alias: "error-tracker", 7 | async register(container: Container.IContainer, options) { 8 | return newrelic; 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/core-new-relic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /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/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./enums"; 2 | export * from "./network-state"; 3 | export * from "./peer"; 4 | export * from "./plugin"; 5 | export * from "./utils"; 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/versions/index.ts: -------------------------------------------------------------------------------- 1 | import * as internal from "./internal"; 2 | import * as peer from "./peer"; 3 | import * as utils from "./utils"; 4 | 5 | export { internal, peer, utils }; 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 { isWhitelisted } from "./is-whitelisted"; 5 | export { socketEmit } from "./socket"; 6 | export { validateJSON } from "./validate-json"; 7 | export { isValidVersion } from "./is-valid-version"; 8 | export { codec } from "./sc-codec"; 9 | -------------------------------------------------------------------------------- /packages/core-p2p/src/utils/is-whitelisted.ts: -------------------------------------------------------------------------------- 1 | import nm from "nanomatch"; 2 | 3 | export const isWhitelisted = (whitelist: string[], ip: string): boolean => { 4 | if (Array.isArray(whitelist)) { 5 | for (const item of whitelist) { 6 | if (nm.isMatch(ip, item)) { 7 | return true; 8 | } 9 | } 10 | } 11 | 12 | return false; 13 | }; 14 | -------------------------------------------------------------------------------- /packages/core-p2p/src/utils/validate-json.ts: -------------------------------------------------------------------------------- 1 | import { Validation } from "@arkecosystem/crypto"; 2 | import ip from "ip"; 3 | 4 | export const validateJSON = (data, schema) => { 5 | Validation.validator.addFormat("ip", { 6 | type: "string", 7 | validate: value => ip.isV4Format(value) || ip.isV6Format(value), 8 | }); 9 | 10 | return Validation.validator.validate(schema, data); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core-p2p/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/blocks/delete-from-height.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM blocks 2 | WHERE height > ${height} 3 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/blocks/find-by-height.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | WHERE height = ${height} 4 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/blocks/height-range.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | id, 3 | version, 4 | timestamp, 5 | previous_block, 6 | height, 7 | number_of_transactions, 8 | total_amount, 9 | total_fee, 10 | removed_fee, 11 | reward, 12 | payload_length, 13 | payload_hash, 14 | generator_public_key, 15 | block_signature 16 | FROM 17 | blocks 18 | WHERE 19 | height BETWEEN ${start} AND ${end} 20 | ORDER BY 21 | height 22 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/blocks/latest.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM blocks 3 | ORDER BY height DESC LIMIT 1 4 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/rounds/delete-from-round.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM rounds 2 | WHERE round > ${round} 3 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/rounds/latest.sql: -------------------------------------------------------------------------------- 1 | SELECT * 2 | FROM rounds 3 | ORDER BY round DESC, balance, public_key DESC 4 | LIMIT 1 5 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/rounds/round-range.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | round, 3 | balance, 4 | public_key 5 | FROM 6 | rounds 7 | WHERE 8 | round BETWEEN ${startRound} AND ${endRound} 9 | ORDER BY 10 | round, balance DESC, public_key 11 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/transactions/delete-from-timestamp.sql: -------------------------------------------------------------------------------- 1 | DELETE FROM transactions 2 | WHERE timestamp > ${timestamp} 3 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/transactions/timestamp-higher.sql: -------------------------------------------------------------------------------- 1 | SELECT id, sequence, serialized FROM transactions 2 | WHERE timestamp > ${start} 3 | ORDER BY timestamp, sequence 4 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/db/queries/transactions/timestamp-range.sql: -------------------------------------------------------------------------------- 1 | SELECT 2 | id, 3 | version, 4 | nonce, 5 | block_id, 6 | sequence, 7 | timestamp, 8 | sender_public_key, 9 | recipient_id, 10 | type, 11 | type_group, 12 | vendor_field, 13 | amount, 14 | fee, 15 | serialized, 16 | asset 17 | FROM 18 | transactions 19 | WHERE 20 | timestamp BETWEEN ${start} AND ${end} 21 | ORDER BY 22 | timestamp, 23 | sequence 24 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | chunkSize: 50000, 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-snapshots/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./defaults"; 2 | export * from "./manager"; 3 | export * from "./plugin"; 4 | -------------------------------------------------------------------------------- /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/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | storage: { 3 | maxLastBlocks: 100, 4 | maxLastTransactionIds: 10000, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-state/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin"; 2 | import * as Wallets from "./wallets"; 3 | 4 | export { Wallets }; 5 | -------------------------------------------------------------------------------- /packages/core-state/src/stores/transactions.ts: -------------------------------------------------------------------------------- 1 | import { OrderedCappedMap } from "@arkecosystem/core-utils"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | export class TransactionStore extends OrderedCappedMap { 5 | public push(value: Interfaces.ITransactionData): void { 6 | this.set(value.id, value); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/core-state/src/wallets/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./temp-wallet-manager"; 2 | export * from "./wallet-manager"; 3 | export * from "./wallet"; 4 | -------------------------------------------------------------------------------- /packages/core-state/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-tester-cli/bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('@oclif/command').run() 4 | .then(require('@oclif/command/flush')) 5 | .catch(require('@oclif/errors/handle')) 6 | -------------------------------------------------------------------------------- /packages/core-tester-cli/bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* 4 | -------------------------------------------------------------------------------- /packages/core-tester-cli/src/flags.ts: -------------------------------------------------------------------------------- 1 | import { flags } from "@oclif/command"; 2 | 3 | export const satoshiFlag = flags.build({ 4 | parse: input => { 5 | const value = Number(input); 6 | 7 | if (value < 1 / 1e8) { 8 | throw new Error(`Expected number greater than 1 satoshi.`); 9 | } 10 | 11 | return value; 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/core-tester-cli/src/index.ts: -------------------------------------------------------------------------------- 1 | export { run } from "@oclif/command"; 2 | -------------------------------------------------------------------------------- /packages/core-tester-cli/src/logger.ts: -------------------------------------------------------------------------------- 1 | import pino from "pino"; 2 | 3 | export const logger = pino({ 4 | name: "core-tester-cli", 5 | safe: true, 6 | prettyPrint: true, 7 | }); 8 | -------------------------------------------------------------------------------- /packages/core-tester-cli/src/shared/htlc-secret.ts: -------------------------------------------------------------------------------- 1 | export const htlcSecretHex = "c27f1ce845d8c29eebc9006be932b604fd06755521b1a8b0be4204c65377151a"; 2 | export const htlcSecretHashHex = "9c1a3815d49e0c9f78b872bfb017e825ea2db708158b70815526a830c85912b4"; 3 | -------------------------------------------------------------------------------- /packages/core-tester-cli/src/utils.ts: -------------------------------------------------------------------------------- 1 | import clipboardy from "clipboardy"; 2 | 3 | export const copyToClipboard = data => { 4 | clipboardy.writeSync(JSON.stringify(data)); 5 | }; 6 | 7 | export const handleOutput = (opts, data) => { 8 | if (opts.copy) { 9 | return copyToClipboard(data); 10 | } 11 | 12 | if (opts.log) { 13 | return console.log(data); 14 | } 15 | 16 | return data; 17 | }; 18 | -------------------------------------------------------------------------------- /packages/core-tester-cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/factory.ts: -------------------------------------------------------------------------------- 1 | import { TransactionPool } from "@arkecosystem/core-interfaces"; 2 | 3 | export class ConnectionFactory { 4 | public async make(connection: TransactionPool.IConnection): Promise { 5 | return connection.make(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./connection"; 2 | export * from "./manager"; 3 | export * from "./plugin"; 4 | -------------------------------------------------------------------------------- /packages/core-transaction-pool/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | import { TransactionPool } from "@arkecosystem/core-interfaces"; 2 | import { Interfaces } from "@arkecosystem/crypto"; 3 | 4 | export interface ITransactionsCached { 5 | added: Interfaces.ITransactionData[]; 6 | notAdded: Interfaces.ITransactionData[]; 7 | } 8 | 9 | export interface ITransactionsProcessed { 10 | added: Interfaces.ITransaction[]; 11 | notAdded: TransactionPool.IAddTransactionResponse[]; 12 | } 13 | 14 | export interface IDynamicFeeMatch { 15 | broadcast: boolean; 16 | enterPool: boolean; 17 | } 18 | -------------------------------------------------------------------------------- /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/handlers/index.ts: -------------------------------------------------------------------------------- 1 | import { transactionHandlerRegistry as Registry } from "./handler-registry"; 2 | import { TransactionHandler, TransactionHandlerConstructor } from "./transaction"; 3 | 4 | export { Registry, TransactionHandler, TransactionHandlerConstructor }; 5 | -------------------------------------------------------------------------------- /packages/core-transactions/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as Errors from "./errors"; 2 | import * as Handlers from "./handlers"; 3 | import * as Interfaces from "./interfaces"; 4 | 5 | export * from "./transaction-reader"; 6 | export { Errors, Handlers, Interfaces }; 7 | -------------------------------------------------------------------------------- /packages/core-transactions/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { Interfaces, Managers, Utils } from "@arkecosystem/crypto"; 2 | 3 | export const isRecipientOnActiveNetwork = (transaction: Interfaces.ITransactionData): boolean => { 4 | return ( 5 | Utils.Base58.decodeCheck(transaction.recipientId).readUInt8(0) === 6 | Managers.configManager.get("network.pubKeyHash") 7 | ); 8 | }; 9 | -------------------------------------------------------------------------------- /packages/core-transactions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-utils/src/has-some-property.ts: -------------------------------------------------------------------------------- 1 | export const hasSomeProperty = (object, props): boolean => { 2 | return props.some(prop => object.hasOwnProperty(prop)); 3 | }; 4 | -------------------------------------------------------------------------------- /packages/core-utils/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-vote-report/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | host: process.env.CORE_VOTE_REPORT_HOST || "0.0.0.0", 3 | port: process.env.CORE_VOTE_REPORT_PORT || 4006, 4 | delegateRows: process.env.CORE_VOTE_REPORT_DELEGATE_ROWS || 80, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/core-vote-report/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import { defaults } from "./defaults"; 3 | import { startServer } from "./server"; 4 | 5 | export const plugin: Container.IPluginDescriptor = { 6 | pkg: require("../package.json"), 7 | defaults, 8 | alias: "vote-report", 9 | async register(container: Container.IContainer, options) { 10 | return startServer(options); 11 | }, 12 | async deregister(container: Container.IContainer) { 13 | await container.resolvePlugin("vote-report").stop(); 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/core-vote-report/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /packages/core-wallet-api/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | server: { 3 | host: process.env.CORE_WALLET_API_HOST || "0.0.0.0", 4 | port: process.env.CORE_WALLET_API_PORT || 4040, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/core-wallet-api/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin"; 2 | -------------------------------------------------------------------------------- /packages/core-wallet-api/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 | host: process.env.CORE_WEBHOOKS_HOST || "0.0.0.0", 5 | port: process.env.CORE_WEBHOOKS_PORT || 4004, 6 | whitelist: ["127.0.0.1", "::ffff:127.0.0.1"], 7 | }, 8 | timeout: process.env.CORE_WEBHOOKS_TIMEOUT || 1500, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface IWebhook { 2 | id?: string; 3 | token?: string; 4 | 5 | event: string; 6 | target: string; 7 | enabled: boolean; 8 | conditions: Array<{ 9 | key: string; 10 | value: any; 11 | condition: string; 12 | }>; 13 | } 14 | -------------------------------------------------------------------------------- /packages/core-webhooks/src/server/utils.ts: -------------------------------------------------------------------------------- 1 | import Boom from "@hapi/boom"; 2 | import { IWebhook } from "../interfaces"; 3 | 4 | export const transformResource = (model): IWebhook => { 5 | return { 6 | id: model.id, 7 | event: model.event, 8 | target: model.target, 9 | token: model.token, 10 | enabled: model.enabled, 11 | conditions: model.conditions, 12 | }; 13 | }; 14 | 15 | export const respondWithResource = data => { 16 | return data ? { data: transformResource(data) } : Boom.notFound(); 17 | }; 18 | -------------------------------------------------------------------------------- /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=trace 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_EXCHANGE_JSON_RPC_HOST=0.0.0.0 14 | CORE_EXCHANGE_JSON_RPC_PORT=8080 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | 19 | CORE_WALLET_API_HOST=0.0.0.0 20 | CORE_WALLET_API_PORT=4040 21 | 22 | CORE_DB_USERNAME=ark 23 | CORE_DB_PASSWORD=password 24 | CORE_DB_DATABASE=ark_devnet 25 | 26 | CORE_API_NO_ESTIMATED_TOTAL_COUNT = true -------------------------------------------------------------------------------- /packages/core/bin/config/devnet/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/mainnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=info 2 | CORE_LOG_LEVEL_FILE=info 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_EXCHANGE_JSON_RPC_HOST=0.0.0.0 14 | CORE_EXCHANGE_JSON_RPC_PORT=8080 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | 19 | CORE_WALLET_API_HOST=0.0.0.0 20 | CORE_WALLET_API_PORT=4040 21 | -------------------------------------------------------------------------------- /packages/core/bin/config/mainnet/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/nospluginnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 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_EXCHANGE_JSON_RPC_HOST=0.0.0.0 14 | CORE_EXCHANGE_JSON_RPC_PORT=8080 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | 19 | CORE_WALLET_API_HOST=0.0.0.0 20 | CORE_WALLET_API_PORT=4040 21 | 22 | CORE_DB_USERNAME=ark 23 | CORE_DB_PASSWORD=password 24 | CORE_DB_DATABASE=nos_pluginnet 25 | -------------------------------------------------------------------------------- /packages/core/bin/config/nospluginnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "127.0.0.1", 5 | "port": 4000 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /packages/core/bin/config/realdevnet/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/realdevnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "104.248.56.157", 5 | "port": 4002 6 | }, 7 | { 8 | "ip": "134.209.93.212", 9 | "port": 4002 10 | }, 11 | { 12 | "ip": "209.97.143.149", 13 | "port": 4002 14 | }, 15 | { 16 | "ip": "167.71.36.13", 17 | "port": 4002 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /packages/core/bin/config/realmainnet/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/realtestnet/.env: -------------------------------------------------------------------------------- 1 | CORE_LOG_LEVEL=debug 2 | CORE_LOG_LEVEL_FILE=trace 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_EXCHANGE_JSON_RPC_HOST=0.0.0.0 14 | CORE_EXCHANGE_JSON_RPC_PORT=8080 15 | 16 | CORE_API_HOST=0.0.0.0 17 | CORE_API_PORT=4003 18 | 19 | CORE_WALLET_API_HOST=0.0.0.0 20 | CORE_WALLET_API_PORT=4040 21 | 22 | CORE_DB_USERNAME=ark 23 | CORE_DB_PASSWORD=password 24 | CORE_DB_DATABASE=nos_realtestnet 25 | -------------------------------------------------------------------------------- /packages/core/bin/config/realtestnet/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "127.0.0.1", 5 | "port": 4000 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /packages/core/bin/config/staging/delegates.json: -------------------------------------------------------------------------------- 1 | { 2 | "secrets": [] 3 | } 4 | -------------------------------------------------------------------------------- /packages/core/bin/config/staging/peers.json: -------------------------------------------------------------------------------- 1 | { 2 | "list": [ 3 | { 4 | "ip": "134.209.201.126", 5 | "port": 4002 6 | }, 7 | { 8 | "ip": "178.128.254.147", 9 | "port": 4002 10 | }, 11 | { 12 | "ip": "157.245.78.188", 13 | "port": 4002 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /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/bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* 4 | -------------------------------------------------------------------------------- /packages/core/src/enums.ts: -------------------------------------------------------------------------------- 1 | export enum ProcessState { 2 | Errored = "errored", 3 | Online = "online", 4 | Stopped = "stopped", 5 | } 6 | -------------------------------------------------------------------------------- /packages/core/src/helpers/prompts.ts: -------------------------------------------------------------------------------- 1 | import prompts from "prompts"; 2 | 3 | export const confirm = async (message: string, yesCallback: any, noCallback?: any): Promise => { 4 | const { confirm } = await prompts([ 5 | { 6 | type: "confirm", 7 | name: "confirm", 8 | message, 9 | }, 10 | ]); 11 | 12 | if (confirm) { 13 | await yesCallback(); 14 | } else if (noCallback) { 15 | await noCallback(); 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /packages/core/src/hooks/init/config.ts: -------------------------------------------------------------------------------- 1 | import { Hook } from "@oclif/config"; 2 | import { configManager } from "../../helpers/config"; 3 | 4 | // tslint:disable-next-line:only-arrow-functions 5 | export const init: Hook<"init"> = async function({ config }) { 6 | configManager.setup(config); 7 | 8 | if (config.version.includes("next") && configManager.get("channel") !== "next") { 9 | configManager.set("channel", "next"); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /packages/core/src/index.ts: -------------------------------------------------------------------------------- 1 | export { run } from "@oclif/command"; 2 | -------------------------------------------------------------------------------- /packages/core/src/process-manager.ts: -------------------------------------------------------------------------------- 1 | import { Foreman, ProcessIdentifier } from "@typeskrift/foreman"; 2 | import { ExecaSyncReturnValue } from "execa"; 3 | 4 | class ProcessManager extends Foreman { 5 | public restart(id: ProcessIdentifier): ExecaSyncReturnValue { 6 | return super.restart(id, { "update-env": true }); 7 | } 8 | 9 | public list(): Array> { 10 | return super.list() || []; 11 | } 12 | } 13 | 14 | export const processManager = new ProcessManager(); 15 | -------------------------------------------------------------------------------- /packages/core/src/types.ts: -------------------------------------------------------------------------------- 1 | export type CommandFlags = Record; 2 | 3 | export type EnvironmentVars = Record; 4 | 5 | export type Options = Record; 6 | 7 | export type ProcessOptions = Record<"name" | "script" | "args", string>; 8 | -------------------------------------------------------------------------------- /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/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/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: number = 1e8; 2 | export const ARKTOSHI: number = SATOSHI; 3 | -------------------------------------------------------------------------------- /packages/crypto/src/crypto/index.ts: -------------------------------------------------------------------------------- 1 | import * as bip38 from "./bip38"; 2 | 3 | export { bip38 }; 4 | export { Hash } from "./hash"; 5 | export { HashAlgorithms } from "./hash-algorithms"; 6 | export { HDWallet } from "./hdwallet"; 7 | export { Message } from "./message"; 8 | export { Slots } from "./slots"; 9 | -------------------------------------------------------------------------------- /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 { NetworkType } from "../types"; 2 | import { Keys } from "./keys"; 3 | 4 | export class PrivateKey { 5 | public static fromPassphrase(passphrase: string): string { 6 | return Keys.fromPassphrase(passphrase).privateKey; 7 | } 8 | 9 | public static fromWIF(wif: string, network?: NetworkType): string { 10 | return Keys.fromWIF(wif, network).privateKey; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /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 { INetworkConfig } 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 | return networks; 8 | } 9 | 10 | public static findByName(name: NetworkName): INetworkConfig { 11 | return networks[name.toLowerCase()]; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/devnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const devnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/devnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "devnet", 3 | "messagePrefix": "DARK message:\n", 4 | "bip32": { 5 | "public": 46090600, 6 | "private": 46089520 7 | }, 8 | "pubKeyHash": 30, 9 | "nethash": "2a44f340d76ffc3df204c5f38cd355b7496c9065a1ade2ef92071436bd72e867", 10 | "wif": 170, 11 | "slip44": 1, 12 | "aip20": 1, 13 | "client": { 14 | "token": "DARK", 15 | "symbol": "DѦ", 16 | "explorer": "https://dexplorer.ark.io" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/index.ts: -------------------------------------------------------------------------------- 1 | export { devnet } from "./devnet"; 2 | export { mainnet } from "./mainnet"; 3 | export { testnet } from "./testnet"; 4 | export { unitnet } from "./unitnet"; 5 | export { nospluginnet } from "./nospluginnet"; 6 | export { realdevnet } from "./realdevnet"; 7 | export { staging } from "./staging"; 8 | export { realtestnet } from "./realtestnet"; 9 | export { realmainnet } from "./realmainnet"; 10 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/mainnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const mainnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/mainnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mainnet", 3 | "messagePrefix": "ARK message:\n", 4 | "bip32": { 5 | "public": 46090600, 6 | "private": 46089520 7 | }, 8 | "pubKeyHash": 23, 9 | "nethash": "6e84d08bd299ed97c212c886c98a57e36545c8f5d645ca7eeae63a8bd62d8988", 10 | "wif": 170, 11 | "slip44": 111, 12 | "aip20": 0, 13 | "client": { 14 | "token": "ARK", 15 | "symbol": "Ѧ", 16 | "explorer": "https://explorer.ark.io" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/nospluginnet/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/nospluginnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const nospluginnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/nospluginnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nospluginnet", 3 | "messagePrefix": "TEST message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 23, 9 | "nethash": "d9acd04bde4234a81addb8482333b4ac906bed7be5a9970ce8ada428bd083192", 10 | "wif": 186, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "TARK", 15 | "symbol": "TѦ", 16 | "explorer": "http://localhost:8080" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realdevnet/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realdevnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const realdevnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realdevnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "realdevnet", 3 | "messagePrefix": "realdevnet message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 90, 9 | "nethash": "e8c5243c53bd6809a52f0c6fdcfd2c9ee3410e0650243e82df5074d9ea6405ae", 10 | "wif": 170, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "TBIND", 15 | "symbol": "Tß", 16 | "explorer": "https://testnet.bindscan.io" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realmainnet/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realmainnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const realmainnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realmainnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "realmainnet", 3 | "messagePrefix": "realmainnet message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 88, 9 | "nethash": "3fa86227bd6005262247f6288be55681f8a0bf751e91a9f81608d4c5926bf22f", 10 | "wif": 171, 11 | "slip44": 543, 12 | "aip20": 0, 13 | "client": { 14 | "token": "BIND", 15 | "symbol": "ß", 16 | "explorer": "https://bindscan.io" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realtestnet/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realtestnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const realtestnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/realtestnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "realtestnet", 3 | "messagePrefix": "TEST message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 23, 9 | "nethash": "d9acd04bde4234a81addb8482333b4ac906bed7be5a9970ce8ada428bd083192", 10 | "wif": 186, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "TARK", 15 | "symbol": "TѦ", 16 | "explorer": "http://localhost:8080" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/staging/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/staging/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const staging = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/staging/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "staging", 3 | "messagePrefix": "staging message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 125, 9 | "nethash": "b1afa0171f3f8bd4485df40deeef6e8cb2754992be9d6c1fada974bfeb28a4de", 10 | "wif": 170, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "NOS", 15 | "symbol": "NOS", 16 | "explorer": "https://explorer.nos.dev" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/testnet/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/testnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const testnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/testnet/network.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "testnet", 3 | "messagePrefix": "TEST message:\n", 4 | "bip32": { 5 | "public": 70617039, 6 | "private": 70615956 7 | }, 8 | "pubKeyHash": 23, 9 | "nethash": "d9acd04bde4234a81addb8482333b4ac906bed7be5a9970ce8ada428bd083192", 10 | "wif": 186, 11 | "slip44": 1, 12 | "aip20": 0, 13 | "client": { 14 | "token": "TARK", 15 | "symbol": "TѦ", 16 | "explorer": "http://localhost:8080" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/unitnet/exceptions.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/unitnet/index.ts: -------------------------------------------------------------------------------- 1 | import exceptions from "./exceptions.json"; 2 | import genesisBlock from "./genesisBlock.json"; 3 | import milestones from "./milestones.json"; 4 | import network from "./network.json"; 5 | 6 | export const unitnet = { exceptions, genesisBlock, milestones, network }; 7 | -------------------------------------------------------------------------------- /packages/crypto/src/networks/unitnet/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 | -------------------------------------------------------------------------------- /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/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 | | typeof networks.unitnet.network 8 | | typeof networks.realdevnet.network 9 | | typeof networks.staging.network 10 | | typeof networks.nospluginnet.network 11 | | typeof networks.realtestnet.network 12 | | typeof networks.realmainnet.network; 13 | 14 | export type NetworkName = keyof typeof networks; 15 | -------------------------------------------------------------------------------- /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 | !.gitignore 2 | -------------------------------------------------------------------------------- /plugins/chameleon/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/plugins/chameleon/banner.png -------------------------------------------------------------------------------- /plugins/chameleon/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = { 2 | apiSync: false, 3 | enabled: false, 4 | fetchTransactions: true, 5 | tor: { 6 | enabled: true, 7 | instances: { 8 | max: 10, 9 | min: 3 10 | }, 11 | path: undefined 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /plugins/chameleon/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin"; 2 | -------------------------------------------------------------------------------- /plugins/chameleon/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/core-helpers/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base", ":preserveSemverRanges"] 3 | } 4 | -------------------------------------------------------------------------------- /plugins/core-helpers/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./staking"; 2 | -------------------------------------------------------------------------------- /plugins/core-helpers/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/file-transactions-crypto/src/builders/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./set-file"; 2 | -------------------------------------------------------------------------------- /plugins/file-transactions-crypto/src/enums.ts: -------------------------------------------------------------------------------- 1 | export enum FileTransactionType { 2 | SetFile = 0, 3 | } 4 | 5 | export const FileKeys = ["description", "logo"]; 6 | 7 | export const FileTransactionGroup = 101; 8 | -------------------------------------------------------------------------------- /plugins/file-transactions-crypto/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as Builders from "./builders"; 2 | import * as Enums from "./enums"; 3 | import * as Interfaces from "./interfaces"; 4 | import * as Transactions from "./transactions"; 5 | 6 | export { Builders, Enums, Interfaces, Transactions }; 7 | -------------------------------------------------------------------------------- /plugins/file-transactions-crypto/src/interfaces.ts: -------------------------------------------------------------------------------- 1 | export interface IIpfsAsset { 2 | fileKey: string; 3 | ipfsHash: string; 4 | } 5 | -------------------------------------------------------------------------------- /plugins/file-transactions-crypto/src/transactions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./set-file"; 2 | -------------------------------------------------------------------------------- /plugins/file-transactions-crypto/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/file-transactions/.gitignore: -------------------------------------------------------------------------------- 1 | .ipfs -------------------------------------------------------------------------------- /plugins/file-transactions/__tests__/__fixtures__/wallets.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "APnhwwyTbMiykJwYbGhYjNgtHiVJDSEhSn", 4 | "publicKey": "035b63b4668ee261c16ca91443f3371e2fe349e131cb7bf5f8a3e93a3ddfdfc788" 5 | }, 6 | { 7 | "address": "Aa4M1zL3a74L51f1AvEsLmBTsKLKrkRScU", 8 | "publicKey": "0308c0d019cd9c0c59618e3b86afc584078b54a85a025c9f30a8bdc82cdc8e1252" 9 | }, 10 | { 11 | "address": "fake-address", 12 | "publicKey": "fake-publicKey" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /plugins/file-transactions/__tests__/mocks/emitter.ts: -------------------------------------------------------------------------------- 1 | export const emitter = { 2 | on: jest.fn(), 3 | emit: jest.fn(), 4 | once: jest.fn(), 5 | }; 6 | -------------------------------------------------------------------------------- /plugins/file-transactions/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = {}; 2 | -------------------------------------------------------------------------------- /plugins/file-transactions/src/handlers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./set-file"; 2 | -------------------------------------------------------------------------------- /plugins/file-transactions/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin"; 2 | -------------------------------------------------------------------------------- /plugins/file-transactions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | ## Unreleased 9 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/plugins/stake-transactions-crypto/banner.png -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base", ":preserveSemverRanges"] 3 | } 4 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/src/builders/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./stake-create"; 2 | export * from "./stake-redeem"; 3 | export * from "./stake-cancel"; 4 | export * from "./stake-extend"; 5 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = {}; 2 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/src/enums.ts: -------------------------------------------------------------------------------- 1 | export enum StakeTransactionType { 2 | StakeCreate = 0, 3 | StakeRedeem = 1, 4 | StakeCancel = 2, 5 | StakeExtend = 3, 6 | } 7 | 8 | export const StakeTransactionGroup = 100; 9 | 10 | export enum StakeTransactionStaticFees { 11 | StakeCreate = "0", 12 | StakeRedeem = "0", 13 | StakeCancel = "0", 14 | StakeExtend = "0", 15 | } 16 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/src/index.ts: -------------------------------------------------------------------------------- 1 | import * as Builders from "./builders"; 2 | import * as Enums from "./enums"; 3 | import * as Interfaces from "./interfaces"; 4 | import * as Transactions from "./transactions"; 5 | 6 | export { Builders, Enums, Interfaces, Transactions }; 7 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/src/transactions/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./stake-create"; 2 | export * from "./stake-redeem"; 3 | export * from "./stake-cancel"; 4 | export * from "./stake-extend"; 5 | -------------------------------------------------------------------------------- /plugins/stake-transactions-crypto/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/stake-transactions/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | ## Unreleased 9 | -------------------------------------------------------------------------------- /plugins/stake-transactions/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/plugins/stake-transactions/banner.png -------------------------------------------------------------------------------- /plugins/stake-transactions/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base", ":preserveSemverRanges"] 3 | } 4 | -------------------------------------------------------------------------------- /plugins/stake-transactions/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = {}; 2 | -------------------------------------------------------------------------------- /plugins/stake-transactions/src/handlers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./stake-create"; 2 | export * from "./stake-redeem"; 3 | export * from "./stake-cancel"; 4 | export * from "./stake-extend"; 5 | -------------------------------------------------------------------------------- /plugins/stake-transactions/src/helpers/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./power"; 2 | export * from "./expire"; 3 | export * from "./power-up"; 4 | export * from "./redeem"; 5 | -------------------------------------------------------------------------------- /plugins/stake-transactions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /plugins/storage/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) 6 | and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). 7 | 8 | ## Unreleased 9 | -------------------------------------------------------------------------------- /plugins/storage/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compendia/core/032a603ee8aa684062416f70a6facaae18b3f719/plugins/storage/banner.png -------------------------------------------------------------------------------- /plugins/storage/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["config:base", ":preserveSemverRanges"] 3 | } 4 | -------------------------------------------------------------------------------- /plugins/storage/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = {}; 2 | -------------------------------------------------------------------------------- /plugins/storage/src/entities/Delegate.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; 2 | 3 | @Entity() 4 | export class Delegate extends BaseEntity { 5 | @PrimaryGeneratedColumn() 6 | public id: number; 7 | 8 | @Column("varchar") 9 | public publicKey: string; 10 | 11 | @Column("varchar") 12 | public topRewards: string; 13 | } 14 | -------------------------------------------------------------------------------- /plugins/storage/src/entities/Round.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, Entity, PrimaryColumn } from "typeorm"; 2 | 3 | @Entity() 4 | export class Round extends BaseEntity { 5 | @PrimaryColumn("int") 6 | public id: number; 7 | 8 | @Column("varchar") 9 | public forged: string; 10 | 11 | @Column("varchar") 12 | public removed: string; 13 | 14 | @Column("varchar") 15 | public staked: string; 16 | 17 | @Column("varchar") 18 | public released: string; 19 | } 20 | -------------------------------------------------------------------------------- /plugins/storage/src/entities/Statistic.ts: -------------------------------------------------------------------------------- 1 | import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm"; 2 | 3 | @Entity() 4 | export class Statistic extends BaseEntity { 5 | @PrimaryGeneratedColumn() 6 | public id: number; 7 | 8 | @Column("varchar") 9 | public name: string; 10 | 11 | @Column("varchar") 12 | public value: string; 13 | } 14 | -------------------------------------------------------------------------------- /plugins/storage/src/entities/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./Statistic"; 2 | export * from "./Round"; 3 | export * from "./Delegate"; 4 | -------------------------------------------------------------------------------- /plugins/storage/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./storage"; 2 | export * from "./entities"; 3 | -------------------------------------------------------------------------------- /plugins/storage/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "experimentalDecorators": true 6 | }, 7 | "include": ["src/**/**.ts"] 8 | } 9 | -------------------------------------------------------------------------------- /plugins/supply-tracker/src/defaults.ts: -------------------------------------------------------------------------------- 1 | export const defaults = {}; 2 | -------------------------------------------------------------------------------- /plugins/verify-relay/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./plugin"; 2 | -------------------------------------------------------------------------------- /plugins/verify-relay/src/plugin.ts: -------------------------------------------------------------------------------- 1 | import { Container } from "@arkecosystem/core-interfaces"; 2 | import { Server } from "./server"; 3 | 4 | export const plugin: Container.IPluginDescriptor = { 5 | pkg: require("../package.json"), 6 | alias: "verify-relay", 7 | async register(container: Container.IContainer, options) { 8 | const server: Server = new Server(); 9 | server.start(); 10 | return server; 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /plugins/verify-relay/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist" 5 | }, 6 | "include": ["src/**/**.ts"] 7 | } 8 | -------------------------------------------------------------------------------- /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 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 17 | 18 | -------------------------------------------------------------------------------- /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 | ./node_modules/lerna/cli.js version $1 --no-git-tag-version --yes 4 | -------------------------------------------------------------------------------- /tslint-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "build", "dist"] 4 | } 5 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------