Compare commits

...

611 Commits

Author SHA1 Message Date
wiz
251a1af442 Bump version number for v2.2.2 release 2021-09-09 07:23:36 +09:00
wiz
9bdf42530a Merge pull request #769 from mempool/wiz/fix-api-docs-fees-path
Fix api-docs incorrect API path for fees related methods
2021-09-08 07:29:36 +09:00
wiz
8525fbb177 Fix api-docs incorrect API path for fees related methods 2021-09-08 07:13:23 +09:00
wiz
63a3568481 Merge pull request #768 from mempool/simon/liquid-fetch-unconfidential
Liquid: Display unconfidential address and fix tracking
2021-09-08 06:37:24 +09:00
wiz
e4941740de Merge pull request #765 from mempool/simon/address-regex-fix
Updated address regex to handle all types of addresses.
2021-09-08 06:36:42 +09:00
softsimon
25bd33f7da validate-address API should be there both in esplora and bitcoind mode. 2021-09-07 13:13:29 +04:00
softsimon
2d007b9100 Liquid: Display unconfidential address and fix tracking
fixes #761
2021-09-06 10:20:31 +04:00
softsimon
b71330c606 Lowercase Segwit uppercase addresses for tracking matching. 2021-09-05 00:30:24 +04:00
softsimon
844b640c8c Merge pull request #760 from mempool/wiz/rename-keybase-channels
Update syslog.conf and upgrade/restart scripts for new keybase channels
2021-09-04 23:31:28 +04:00
softsimon
1277e58e68 Updated address regex to handle all types of addresses.
fixes #301
fixes #750
2021-09-04 23:21:15 +04:00
wiz
fde6fe324a Merge pull request #764 from mempool/simon/electrum-error-msg-fix
Handle string error messages.
2021-09-04 09:17:46 +09:00
wiz
4ed114a4d5 Merge pull request #762 from mempool/simon/npm-audit-fix-2021-09-03
Npm audit fix.
2021-09-04 09:16:56 +09:00
wiz
8c2dfea6a6 Merge pull request #716 from MiguelMedeiros/documentation-api
Improvements to API documentation and examples
2021-09-04 09:10:59 +09:00
Miguel Medeiros
a0624df06b Change websocket examples. 2021-09-03 20:13:31 -03:00
Miguel Medeiros
1eedcf900b Fix transaction post curl example. 2021-09-03 19:43:28 -03:00
softsimon
0b077d6fda Handle string error messages.
fixes #763
2021-09-04 01:32:36 +04:00
Miguel Medeiros
80047313e7 Remove unused variables. 2021-09-03 16:50:45 -03:00
Miguel Medeiros
71229b94c8 Set default active tab to liquid network. 2021-09-03 16:48:37 -03:00
Miguel Medeiros
c256daf8c8 Fix document location protocol for curl url. 2021-09-03 16:22:39 -03:00
Miguel Medeiros
ba0fb996d2 Fix curl placeholder url depending on base_module.
Fix currencies wrapper url variable name.
2021-09-03 16:02:05 -03:00
Miguel Medeiros
5977e96034 Fix typo variable name. 2021-09-03 14:35:06 -03:00
Miguel Medeiros
a151c5cddd Add template to documentation.
Add support for BASE_MODULE=[mempool, bisq, liquid].
 Add print results do CommonJS examples.
 Add support for custom domains.
 Remove basecurrency from /volume endpoint.
2021-09-03 07:04:19 -03:00
softsimon
0323fd966d Npm audit fix. 2021-09-03 00:44:23 +04:00
wiz
beb834bc30 Update syslog.conf and upgrade/restart scripts for new keybase channels 2021-09-02 19:30:54 +09:00
wiz
ad6503c7b3 Merge pull request #755 from knorrium/fix_dashboard_memory_leak
Add a potential fix for the memory leak on the Dashboard
2021-09-02 19:12:42 +09:00
softsimon
f8c11c8b6b Merge pull request #759 from knorrium/cypress_831
Update Cypress to v8.3.1
2021-09-02 13:45:12 +04:00
Felipe Knorr Kuhn
ba5421e77b Add some search tests (#758) 2021-09-02 13:42:18 +04:00
Felipe Knorr Kuhn
20fa803cee Add a potential fix for the memory leak on the Dashboard
Fix the broken experience after unsubscribing for network changes

Fix the broken experience after unsubscribing for network changes
2021-09-02 00:47:00 -07:00
Felipe Knorr Kuhn
393fa78a43 Increase waitForSkeletonGone timeout to 15s 2021-09-01 21:09:14 -07:00
Felipe Knorr Kuhn
3f290dae06 Upgrade Cypress to v8.3.1 2021-09-01 21:08:10 -07:00
wiz
24d18b9f2f Merge pull request #757 from mempool/wiz/revert-search-input-lowercase-conversion
Revert "Support uppercase addresses when searching."
2021-09-02 01:37:56 +09:00
wiz
79ef8ca371 Revert "Support uppercase addresses when searching."
This reverts commit fc28b06a0f.
2021-09-02 00:57:43 +09:00
softsimon
ec12f21113 Backend: Bumping Typescript version to 4.4.2 (#748)
* Backend: Bumping Typescript version to 4.4.2

* Replacing any types with instanceOf checks.
2021-08-31 15:09:33 +03:00
Priyansh
2e8ecc7277 Made Price feed update configurable (#751) 2021-08-29 22:30:11 +03:00
softsimon
fc28b06a0f Support uppercase addresses when searching.
fixes #301
2021-08-29 15:58:39 +03:00
softsimon
8fdbfdc04c Use block cache when searching or opening a recent block. (#749)
* Use block cache when searching or opening a recent block.

fixes #715

* Fixed linting errors.
2021-08-29 04:55:46 +03:00
Felipe Knorr Kuhn
bdfcfc96a8 Add script to pull digests from docker images (#705) 2021-08-27 19:04:51 +09:00
wiz
bb8649bc81 Merge pull request #747 from knorrium/be_dockerfile_fixes
Fix non-deterministic TypeScript version on Dockerfile
2021-08-27 17:08:04 +09:00
Felipe Knorr Kuhn
777e3d58b7 Fix non-deterministic TypeScript version on Dockerfile 2021-08-27 00:28:05 -07:00
wiz
c552f1aab6 Pull from transifex 2021-08-27 14:28:51 +09:00
softsimon
c0f2fa3042 Merge pull request #746 from MiguelMedeiros/bugfix-difficulty-adjustment-calc
Bugfix: difficulty adjustment calculation.
2021-08-26 03:27:59 +03:00
Miguel Medeiros
05936f82bd Refactor getDifficultyChange endpoint. 2021-08-25 21:14:01 -03:00
Miguel Medeiros
c7db81c97c Refactor difficulty adjustment calculation. 2021-08-25 17:18:30 -03:00
softsimon
bd1a37b8ef Correcting keypress arrow left test. 2021-08-25 18:41:35 +03:00
softsimon
efc4e6a8ed Fix for multiple arrow navigation bugs. (#741)
* Fix for multiple arrow navigation bugs.

fixes #731

* Updating test to handle left arrow navigation.

* Updating test to handle left arrow navigation.

* Arrow right click fix.

* Update frontend/cypress/integration/mainnet/mainnet.spec.ts

Co-authored-by: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com>

Co-authored-by: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com>
2021-08-25 15:44:55 +03:00
Felipe Knorr Kuhn
dd5d87e91e Add a test for not showing unblinding errors on regular TXs (#737) 2021-08-22 00:34:40 +03:00
wiz
ca6df488c5 Fix missing fetch command in upgrade script 2021-08-21 21:56:42 +09:00
wiz
1e018a6aa5 Fix typo/bug in mempool-logger script 2021-08-21 15:39:15 +09:00
wiz
0a627f96be Tweak production syslog configuration 2021-08-21 15:19:29 +09:00
wiz
17a8e67d8a Modify restart script to log restart events, don't restart services 2021-08-21 15:06:50 +09:00
wiz
815c2c5ad5 Modify upgrade script for PR branch deployment, tweak logging 2021-08-21 14:51:19 +09:00
softsimon
4376de85ff Liquid unblinding: Don't throw error as default for regular liquid transactions. 2021-08-21 03:13:39 +03:00
wiz
7e89de4612 Send deployment notifications to mempool.dev keybase group 2021-08-20 21:52:54 +09:00
wiz
4b72a14706 Merge pull request #735 from mempool/simon/bisq-tx-redirect-fix
Redirect unconfirmed bisq transactions to main website for tracking.
2021-08-20 21:25:13 +09:00
softsimon
b34f6fedb6 Redirect unconfirmed bisq transactions to main website for tracking. 2021-08-20 14:56:12 +03:00
Miguel Medeiros
58af0d78af Bugfix: Fix bisq dashboard tables overflow. (#733)
* Fix bisq dashboard tables overflow.

* Fix nav-item mobile margin.
2021-08-19 17:51:08 +03:00
Priyansh
ca13d9109c Updated mobile view for dropdown (#717)
Dropdown menu with dynamic positioning
2021-08-18 19:18:12 +03:00
Priyansh
e103fb5876 Updated significant digits of transaction fee (#722) 2021-08-18 16:27:35 +03:00
softsimon
58178f4563 Arrow bugfix: Unsubscribe all the observables when leaving view. 2021-08-18 15:59:18 +03:00
wiz
04f1879fd1 Add Unchained Capital as Enterprise Sponsor (#711) 2021-08-18 15:15:31 +03:00
softsimon
f5bc9ced0a Liquid unblinding: Replacing async/await with observable. 2021-08-18 14:05:40 +03:00
softsimon
7fe9993f91 Optimize performance of next/previous block. (#729) 2021-08-18 12:49:42 +03:00
softsimon
7c95339324 Merge pull request #728 from mempool/simon/unblinding-refactor-fix
Unblinding refactor fix
2021-08-18 04:09:53 +03:00
softsimon
006442f9de Merge pull request #727 from knorrium/improve_multisite_testing
Improve multisite testing
2021-08-18 03:35:43 +03:00
softsimon
e20100e437 Unblinding refactor fix 2021-08-18 03:34:17 +03:00
Felipe Knorr Kuhn
d7cf2b37d5 Update Liquid test data 2021-08-17 16:49:34 -07:00
Felipe Knorr Kuhn
278c2b9aae Fix typo on liquid setup 2021-08-17 16:38:51 -07:00
Felipe Knorr Kuhn
944246fcf5 Allow test jobs to run regardless of previous failures 2021-08-17 16:26:19 -07:00
Felipe Knorr Kuhn
03d87f4993 Add the Cypress env vars to the new test configs 2021-08-17 16:14:19 -07:00
Felipe Knorr Kuhn
cf8cab5f77 Temporarily enable cypress debug logs on GHA 2021-08-17 16:08:47 -07:00
Felipe Knorr Kuhn
49d1376647 Update cypress test config 2021-08-17 15:55:00 -07:00
Felipe Knorr Kuhn
de5518d262 update test specs to handle the new multisite setup on CI 2021-08-17 15:53:57 -07:00
Felipe Knorr Kuhn
7e4c51f47f Add new config targets for the multisite setup 2021-08-17 15:49:58 -07:00
softsimon
fe1d153632 Merge pull request #710 from MiguelMedeiros/feature-next-previous-block-arrows
UI/UX: `Next` and `Previous` button arrows for block navigation.
2021-08-18 00:57:39 +03:00
softsimon
a98f9ab80e Updating from transifex. 2021-08-18 00:54:34 +03:00
softsimon
867afaf265 Updating package lock file. 2021-08-18 00:50:18 +03:00
Rishabh
3d2ec64b14 Only display "Load all" if there are at least 3 more items to load (#724)
* Only display Load more if there are at least 3 more items to load

* Load more only if at least 3 more inputs
2021-08-18 00:49:08 +03:00
softsimon
bb407c0b42 Merge pull request #725 from mempool/simon/liquid-unblinding-refactor
Refactored liquid unblinding code into a new file.
2021-08-17 23:52:33 +03:00
softsimon
83c3d901c7 Merge pull request #726 from knorrium/update_devproxy
Update test infra to add initial support for the new multi-site setup.
2021-08-17 23:52:21 +03:00
Felipe Knorr Kuhn
901cee903c Update bisq tests to use the menu navigation 2021-08-17 13:02:24 -07:00
Felipe Knorr Kuhn
250ea09c7e Run generate config before running e2e tests locally 2021-08-17 13:01:36 -07:00
Felipe Knorr Kuhn
648d59631b Update local-prod target to use the new JS dev proxy 2021-08-17 13:01:04 -07:00
Felipe Knorr Kuhn
ed06e3c491 Add a new JS-based dev proxy for the new split up sites 2021-08-17 13:00:46 -07:00
Felipe Knorr Kuhn
3e8d646edd Fix update-config script to parse string values 2021-08-17 12:03:03 -07:00
softsimon
9c2c698575 Refactored liquid unblinding code into a new file. 2021-08-17 20:20:25 +03:00
softsimon
e2b0a286a4 Adding v2.2.1 dashboard screen shot. 2021-08-16 00:31:14 +03:00
softsimon
154809f0f9 Fix navigate to sponsor when base module is not mempool 2021-08-15 20:05:49 +03:00
softsimon
8d9a51a7c4 Readding search field, and fixing search for non-mempool base module sites. 2021-08-14 14:58:58 +03:00
softsimon
b3294369d4 Restoring Bisq Dao nav bar on Bisq module. 2021-08-14 13:25:54 +03:00
softsimon
53730920e3 Bugfix: Mempool block sizes were mixing up vsize and weight. 2021-08-14 03:24:31 +03:00
softsimon
d73b814277 Merge pull request #703 from priyanshiiit/median_fee
Get Median Fee on page reload
2021-08-14 02:25:35 +03:00
softsimon
dd0050c066 Merge pull request #669 from mempool/simon/configurable-main-module
Make base module and index.html file configurable with BASE_MODULE. A…
2021-08-14 02:25:07 +03:00
softsimon
ae51ee3e26 Removing issuance id test and fixing asset id test. 2021-08-14 02:21:38 +03:00
wiz
4b16e5d65f Add some basic title/descriptions for bisq.markets and liquid.network 2021-08-14 07:44:22 +09:00
softsimon
4f73bba132 Hide Mempool project description from non-mempool base module sites. 2021-08-14 01:37:28 +03:00
softsimon
3c229602e4 Use local about page component instead of external link. 2021-08-14 00:42:52 +03:00
softsimon
c74c902ebc Adding new preview images for Liquid and Bisq 2021-08-14 00:36:46 +03:00
wiz
8bfd315ba3 Rewrite production upgrade script to handle all 3 sites 2021-08-14 06:03:30 +09:00
softsimon
9d75c47792 Merge branch 'master' into simon/configurable-main-module
# Conflicts:
#	frontend/src/app/components/api-docs/api-docs.component.ts
#	frontend/src/app/components/blockchain-blocks/blockchain-blocks.component.ts
#	frontend/src/app/components/master-page/master-page.component.html
#	frontend/src/app/components/mempool-blocks/mempool-blocks.component.html
#	frontend/src/app/components/mempool-blocks/mempool-blocks.component.ts
#	frontend/src/app/dashboard/dashboard.component.html
2021-08-13 17:16:14 +03:00
wiz
e183be1a5c Update GitHub sponsor link to mempool.space/sponsor 2021-08-13 08:41:35 +09:00
wiz
7e273ce63d Bump version tags to v2.2.2-dev 2021-08-13 07:56:14 +09:00
Miguel Medeiros
6d070e75b0 Add next and previous arrows to blocks. 2021-08-12 19:49:39 -03:00
wiz
af5e0d7cd6 Bump version to v2.2.1 2021-08-13 07:45:47 +09:00
wiz
a2f1003916 Pull from transifex 2021-08-13 06:22:11 +09:00
wiz
f4f96fd18e Fix typos in site.webmanifest for liquid.network 2021-08-12 20:57:33 +09:00
Miguel Medeiros
f3b470b63e Fix API docs example for POST /tx endpoint (#707)
* Fix post transactions example.
* Fix post tx endpoint.
2021-08-12 20:41:23 +09:00
wiz
398a72c1a6 Pull from transifex 2021-08-12 19:33:22 +09:00
softsimon
ddd6420d9b Updating Bisq markets logo and favicons. 2021-08-11 20:31:05 +03:00
Miguel Medeiros
d76f42296a Add new documentation for Liquid and Bisq. 2021-08-12 01:19:40 +09:00
wiz
45af88774f Pull from transifex 2021-08-12 00:49:33 +09:00
wiz
71c6b0e11d Remove typo'd extra line in nginx-mempool.conf - fixes #706 2021-08-12 00:47:42 +09:00
github2k20
47a6118ffb Get Median Fee on page reload 2021-08-11 00:17:25 +05:30
wiz
994eb378af Update production nginx-mempool.conf for donations API endpoint 2021-08-11 01:00:17 +09:00
wiz
34d46e8ca5 Pull from transifex 2021-08-11 00:29:46 +09:00
wiz
a940f7e3b4 Pull from transifex 2021-08-09 23:48:20 +09:00
softsimon
8c29395533 Resume tx tracking when network goes offline. (#702)
fixes #609
2021-08-09 13:01:29 +03:00
Miguel Medeiros
8208bbf0b7 UI/UX: Fix blockchain-blocks skeleton. (#697)
* Fix blockchain-blocks skeleton.

* Fix blockchain skeleton background.

* Fix mempool blockchain skeleton.

* Add e2e testing.
Add tsconfig.
Fix mempool fit to screen.

* Fix wrong return.
Fix e2e testing.

* Fix blockchainblocks connectionstate.
Add init action to websocket mock.
Add e2e testing for droping websock connection.

* Ref e2e code for websocket connection.
Fix blockchain blocks skeleton.

* Fix state connections.
Remove .only e2e tests.

* Fix mempool blocks skeleton.

* Add fit screen to empty blocks.
2021-08-09 03:43:03 +03:00
softsimon
dbd205b73f Fix: Block fee data wasn't visible unless at least 2 transactions. 2021-08-08 14:17:18 +03:00
softsimon
7ef4be26ed Use BLOCK_WEIGHT_UNITS instead of hard coded block size limit in all occations. 2021-08-08 04:19:54 +03:00
wiz
1223c58a98 Add missing --db-dir option in electrs-start-liquid script 2021-08-08 05:18:11 +09:00
wiz
7d3757676f Enable 'ca' locale for Catalan 2021-08-08 01:05:42 +09:00
wiz
073bd60ed8 Pull from transifex 2021-08-08 01:05:26 +09:00
wiz
18c38fc1c1 Pull strings from transifex 2021-08-08 00:58:58 +09:00
wiz
0eb95447bb Pull strings from transifex 2021-08-07 21:12:26 +09:00
softsimon
c6b1979391 Support Liquid 0.1 sat/vB fees on blocks. 2021-08-07 04:24:46 +03:00
softsimon
0f390e65a4 Assets page design improvements. 2021-08-07 03:25:35 +03:00
softsimon
5dc0f4e270 Use actual MEMPOOL_BLOCKS_AMOUNT value for amount of mempool blocks. 2021-08-07 03:07:32 +03:00
softsimon
223288cc52 Removing extra character. 2021-08-07 03:05:54 +03:00
softsimon
72a35200b3 Pulled from transifex. 2021-08-07 02:27:59 +03:00
softsimon
11817c04f7 Transaction and block header hex external URL should be relative to the network. 2021-08-06 23:45:54 +03:00
Miguel Medeiros
7a8b2db3fb UI/UX: Fix Blockchain skeleton preloader. (#696)
* Fix Blockchain skeleton preloader.

* Fix Mempool Blocks skeleton preloader.

* Add e2e test.

* Add shared command to cyrpress e2e test.
2021-08-06 14:09:47 +03:00
Priyansh
6d910a5e24 changed the order of columns in collapsed view (#695) 2021-08-06 14:08:44 +03:00
softsimon
e1f07884b9 Correcting favicon paths and color. 2021-08-05 19:25:13 +03:00
softsimon
e00e61edfa Updating liquid favicons. 2021-08-05 19:14:48 +03:00
softsimon
4f988e186a Updating liquid network logo. 2021-08-05 18:58:39 +03:00
wiz
1aa54faa35 Fix liquid.network and bisq.markets page titles in SEO services 2021-08-05 22:45:03 +09:00
softsimon
99adccf43c Pulled from transifex. 2021-08-05 14:15:37 +03:00
softsimon
0bb9247609 Handle 0.1 sat/vB base fee on the dashboard and backend. 2021-08-05 02:03:52 +03:00
softsimon
d841933b21 Sync blockstream asset registry when in liquid base module mode. 2021-08-05 01:31:22 +03:00
wiz
bc8b78a01b Update page titles in index.*.html and SEO service 2021-08-05 02:41:52 +09:00
softsimon
b0c708659b Merge pull request #690 from MiguelMedeiros/bugfix-titles-styles
UI: Fix Transaction h1 font-size.
2021-08-04 15:48:39 +03:00
Miguel Medeiros
e31b906084 Import scss from transaction component. 2021-08-04 09:09:28 -03:00
Miguel Medeiros
7249620471 Fix Bisq css page.
Refactor Bisq html page title classes.
2021-08-04 09:08:11 -03:00
Miguel Medeiros
dc9d5d0be3 Fix h1 fontsize. 2021-08-04 09:08:11 -03:00
softsimon
a9009d4de2 npm audit fix. 2021-08-04 14:34:28 +03:00
softsimon
a265787cd4 Bumping mempool.js. 2021-08-04 14:34:05 +03:00
softsimon
c6e72be483 Liquid proxy fix to work locally. 2021-08-04 14:21:15 +03:00
softsimon
4680519d2e Merge pull request #689 from knorrium/e2e_tweaks
e2e tweaks
2021-08-04 13:24:05 +03:00
Felipe Knorr Kuhn
5b17f88de2 disable video recording 2021-08-03 21:26:40 -07:00
Felipe Knorr Kuhn
a6d34ba4f1 remove firefox from test matrix 2021-08-03 21:20:05 -07:00
Felipe Knorr Kuhn
508c8b0be3 make serve:local-prod target not verbose 2021-08-03 21:19:25 -07:00
softsimon
ef7dd6c8fb Merge branch 'master' into simon/configurable-main-module 2021-08-03 18:41:43 +03:00
softsimon
f03249761b Updating i18n from transifex. 2021-08-03 18:38:34 +03:00
softsimon
cb5877ba0a Update i18n. 2021-08-03 18:37:31 +03:00
softsimon
96f14d2781 Flipping Merkle root and Bits location for more table alignment. 2021-08-03 18:35:49 +03:00
softsimon
8eb70416da Removing "raw block". 2021-08-03 18:15:33 +03:00
wiz
b9246a72f2 Add Foundry as Enterprise Sponsor (#685) 2021-08-03 18:00:18 +03:00
Priyansh
43e222b9df Raw Hex of Objects in Details Tab #616 (#682)
* Added Block Hex in Details

* Added Raw Tx in Transaction Details

* Backend Updates
2021-08-03 14:27:02 +03:00
wiz
5548d08a9e Remove debug env var for cypress testsuite runs 2021-08-03 12:20:55 +09:00
wiz
10fa39634e Update our Terms of Service, split Privacy Policy into its own page 2021-08-03 12:20:51 +09:00
wiz
e6b90385b2 Further tweak index.liquid.html metadata text 2021-08-02 21:42:02 +09:00
wiz
61181c6791 Set index.html metadata and SEO service title for liquid.network 2021-08-02 21:30:29 +09:00
wiz
d2cccd2422 Fix liquid favicons 2021-08-02 21:07:48 +09:00
wiz
b05ebe1598 Add missing route for /privacy-policy to liquid explorer routing 2021-08-02 20:59:31 +09:00
softsimon
d92827a411 Upgrade deprecated xi18n command to extract-i18n. 2021-08-02 14:49:02 +03:00
wiz
d061f7589c Update our Terms of Service, split Privacy Policy into its own page 2021-08-02 20:48:10 +09:00
softsimon
1c01094e07 Removing duplicate i18n string. 2021-08-02 14:48:08 +03:00
wiz
f28a85f91b Hush a noisy bisq error message down to info 2021-08-02 16:57:49 +09:00
softsimon
15903faf49 Merge branch 'master' into simon/configurable-main-module
# Conflicts:
#	frontend/src/app/components/blockchain/blockchain.component.ts
2021-08-02 00:24:09 +03:00
softsimon
4895343d4e Perform a blockchain sync check before updating initial difficulty ad… (#677)
* Perform a blockchain sync check before updating initial difficulty adjustment.

fixes #603

* Updating logger messages.
2021-08-01 15:49:26 +03:00
Miguel Medeiros
a0559cbb24 Fix time until component round for week interval. (#679)
* Fix time until component round for week interval.

* Add forceFloorOnTimeIntervals parameter.
2021-08-01 01:25:24 +03:00
Miguel Medeiros
0293ba4a52 Remove feeRange check. (#678) 2021-07-31 20:11:50 +03:00
Miguel Medeiros
8b0d1db776 Fix concurrent asynchronous calls. (#675)
* Fix concurrent asynchronous calls.

* Remove test without mempool info websocket.

* Remove isloading$ variable.
2021-07-31 19:40:15 +03:00
softsimon
1908b1a5a6 Adding configuration for blocks and mempool blocks amount. 2021-07-31 17:56:10 +03:00
softsimon
037f472f8c Make Block Weight Unit configurable in frontend+backend. 2021-07-31 17:30:35 +03:00
softsimon
a32c1f40b1 Restoring About page. Fix for KEEP_BLOCKS_AMOUNT setting. Show up to 2 mempool blocks. 2021-07-30 23:14:45 +03:00
Miguel Medeiros
837e714b1f Fix show blocks on small screen. (#674) 2021-07-30 02:28:43 +03:00
wiz
91a37d8fe8 Add [push, pull_request] to cypress GHA workflow 2021-07-29 23:58:25 +09:00
softsimon
a00aa27ae4 Fix API doc page for Bisq. 2021-07-29 16:14:36 +03:00
Miguel Medeiros
226e72451c Fix colorized unblinded transaction. (#671) 2021-07-29 13:37:17 +03:00
softsimon
544be77bdc Liquid asset search bug fix. 2021-07-29 13:10:06 +03:00
softsimon
b8a110a772 Liquid fixes for latest transactions and API Doc. 2021-07-29 13:06:08 +03:00
wiz
7788a2d6bd Add other domain names to Terms of Service header 2021-07-29 18:38:49 +09:00
softsimon
da17fd16fa Liquid blockchain container position. 2021-07-29 12:36:00 +03:00
softsimon
e670f80fed Liquid dashboard updates. About page link. 2021-07-29 12:32:54 +03:00
wiz
857a5ff6fc Add missing asset_registry_db repo path for liquid electrs backend
Fixes #649
2021-07-29 17:49:42 +09:00
softsimon
2de28b9926 Dynamic dropdown. 2021-07-28 22:32:13 +03:00
softsimon
e6f8cf6cc8 Updating from transifex. 2021-07-27 19:51:38 +03:00
softsimon
d7586af392 Make base module and index.html file configurable with BASE_MODULE. Adding bare Liquid module. 2021-07-27 17:10:38 +03:00
wiz
35881b2457 Add customized index.html for bisq.markets entrypoint 2021-07-27 21:38:13 +09:00
Felipe Knorr Kuhn
59cd80b6d1 remove windows from test matrix (#666) 2021-07-27 02:47:32 +03:00
Miguel Medeiros
735c2ba587 Bugfix: Dashboard preloading skeleton. (#668)
* Change green color.

* Fix dashboard preloading components.
2021-07-27 02:47:08 +03:00
softsimon
be1ef43cd1 Updating i18n messages. 2021-07-26 22:02:24 +03:00
Felipe Knorr Kuhn
34ad88d3d0 update indentation (#664) 2021-07-26 22:00:53 +03:00
Miguel Medeiros
751c7d6e69 Bugfix: Dashboard - Difficulty adjustment component. (#663)
* Add color to previous retarget.
Add absolute number pipe.
Change plus and minus signs to fa icons.
Change Fee Estimate title to Transactions Fees.
Set min and max difficulty adjustments.

* Add projectID to cypress conf.

* Change icon to fa-caret.

* Remove unecessary icons.
2021-07-26 22:00:40 +03:00
Felipe Knorr Kuhn
60d8697b09 Cypress browser matrix (#665)
* use cypress matrix

* fix workflow indentation

* fix workflow job name

* add dummy containers for parallelization
2021-07-27 03:23:35 +09:00
wiz
41aa1248be Pass GITHUB_TOKEN to Cypress workflows, revert back to on "push" 2021-07-27 01:48:53 +09:00
wiz
cedd94c654 Set GitHub Action for Cypress to pull_request instead of push 2021-07-26 15:47:13 +09:00
wiz
bf13994d28 Remove duplicate trademark notice in LICENSE 2021-07-26 15:24:12 +09:00
Felipe Knorr Kuhn
8a44ccc55d small formatting fix to trigger more tests (#660) 2021-07-26 01:49:40 +03:00
softsimon
81df40681f Updating translations. 2021-07-25 21:18:35 +03:00
Felipe Knorr Kuhn
9e46cde9b7 Updates to the e2e suite (#659)
* initial version of the update config script

* fix duplicated content

* update cypress ci settings

* add workflow to run e2e tests when pushing

* record cypress results to the dashboard

* pull the cypress record key and project id from the secrets

* add start-server-and-test to replace concurrently

* replace concurrently with start-server-and-test

* remove concurrently

* add new cypress target to record

* update cypress to 7.7.0

* add tests for signet

* add tests for testnet

* run tests on chrome and firefox

* update test matrix: add edge and run firefox on container

* fix copypasta

* update docker image for firefox

* fix task name again

* fix edge tests task name

* improve bisq tests

* update workflow config

* enable cypress debug logs

* add a manual trigger for the e2e tests

* add config:defaults target

* use more of the GHA options

* fix config command

* add cypress-fail-on-console-error

* upgrade cypress to v8.0.0

* add helper to wait for the loader skeleton to be gone

* use skeleton waiter on the tests

* remove manual test trigger

* fix tv test when only one mempool block is available

* add waiter for pagination

* add extra steps to debug firefox launch issue

* remove whoami step

* Revert "upgrade cypress to v8.0.0"

This reverts commit cb3ff7d906.

* remove userinfo debug step

* enable test retries in run mode

* update proxy config to reduce ECONNRESET errors

* add mock-socket dev dependency

* add helpers to mock websockets and detect page idleness

* stabilize mainnet tests

* fix tv mode test on Liquid

* add basic tests for the mainnet status page

* cleanup mainnet tests

* update bisq tests

* update signet tests

* update testnet tests

* add initial support for parameterized websocket mocks

* move testing dependencies to optionalDependencies

* comment out mempool size check until the live updates are fixed

* comment out tx regex test

* update fixture for the new difficulty adjustment component

* fix the assertions on the status page
2021-07-25 21:03:47 +03:00
softsimon
723034b3d3 Status page wasn't updated due to multiple want events.
fixes #658
2021-07-25 19:43:06 +03:00
wiz
59898f1269 Patch sysconf dep for blockstream/electrs build in start scripts 2021-07-25 15:20:35 +09:00
softsimon
195b9bf542 Bumping the mempool-js lib. 2021-07-25 02:32:31 +03:00
softsimon
0333d91b15 Updating from transfex. 2021-07-25 01:49:35 +03:00
softsimon
f0bd487ea9 Update i18n messages. 2021-07-25 01:35:12 +03:00
Miguel Medeiros
cd8e308870 Add previous adjustment retarget. (#655)
* Add previous adjustment retarget.

* Fix green color.
Add + symbol to difficulty change.

* Add previousRetarget to websocket.

* Add previous retarget.
2021-07-25 01:26:48 +03:00
Miguel Medeiros
f6a889298c Bugfix: Change mempool block time precision. (#650)
* Fix time precision.

* Fix rounding numbers only for minutes range.
Fix reflected avg time to ETA transactions.

* Fix now variable update.
2021-07-25 01:26:29 +03:00
Miguel Medeiros
11f5e99187 Doc: Add new endpoints to api documentation. (#654)
* Add difficulty adjustment api doc.
Change fee tab to general tab.

* Add block header examples.

* Change tab orders.
Add fees tabs.
Change CPFP instructions to Transactions tab.

* Reorder alphabetically.
Fix typo.
2021-07-24 23:00:11 +03:00
wiz
334f9358b0 Add new page for Trademark Policy and Guidelines (#647)
* Add new page for Trademark Policy and Guidelines

* Fix attribution footer at bottom of Trademark Policy

* Add our Trademark Notice and Trademark Policy URL to LICENSE

* Last minute fixes to Trademark Policy and Guidelines page
2021-07-24 22:40:11 +03:00
wiz
820561610a Merge pull request #642 from unruhschuh/patch-2
fixed rsync command for frontent
2021-07-25 04:08:25 +09:00
wiz
2c895e7b03 Merge pull request #643 from mempool/wiz/nginx-cache-lang-updates
Update nginx configuration for cache settings and new locales
2021-07-24 03:21:21 +09:00
wiz
f36f48b11c Add Marina Wallet as Community Integration on About page (#651)
* Add Marina Wallet as Community Integration on About page

* Shift logo for Marina wallet by a few pixels on About page
2021-07-23 21:12:48 +03:00
wiz
f12f1b4a4e Merge pull request #641 from unruhschuh/patch-1 2021-07-23 20:56:19 +09:00
softsimon
037d6a75ea Adding previous difficulty retarget to the difficulty adjustment api. (#652)
refs #640
2021-07-23 14:35:04 +03:00
softsimon
775323de3e Removing angular CLI analytics. 2021-07-22 15:37:40 +03:00
Miguel Medeiros
d91dfa2f41 Check if feeRange is undefined. (#636) 2021-07-21 18:35:27 +03:00
softsimon
3ac06bb983 Updating i18n from transifex. Moving hindi location. 2021-07-20 15:43:01 +03:00
Miguel Medeiros
1ba0075829 Feature: Reflect difficulty estimation into mempool blocks. (#637)
* Add time until to mempool blocks.
Reflect difficulty estimate time.

* Fix estimate calculation.
Turn off the auto refresh.

* Change Math.floor to Math.round.
2021-07-20 15:04:53 +03:00
Miguel Medeiros
95436d398d Fix undefined asset and colored coinbase tx. (#645) 2021-07-19 23:13:34 +03:00
wiz
f2f5749769 Update nginx configuration for cache settings and new locales
* Consolidates add_header statements into single top-level section
* Updates locales to match frontend/src/app/app.constants.ts
* Re-orders locales to match locale selector for easier checking
2021-07-19 18:36:13 +09:00
softsimon
cb90b09a0e Changing block header link to icon. Setting api response header to match electrs. 2021-07-19 02:34:01 +03:00
Rishabh
2e54f4ca94 Added missing block header API (#630)
* header API frontend

* Block Header API endpoint added to Node.js backend

* updated package-lock.json

Co-authored-by: Rishabh <rishabh@Rajeshs-MacBook-Pro.local>
2021-07-19 02:26:16 +03:00
softsimon
853e2fcb8f Minor fixes to difficulty adjustment api. 2021-07-19 00:50:09 +03:00
Priyansh
9e0a5300b0 Expose the difficulty adjustment information in an API #622 (#628)
* Added difficulty adjustment information API

* Added Difficulty API in API docs frontend

* Added link to API

* Updated the API implementation of difficulty-adjustment

* Updated API End Point in frontend

* Updated sample API response in frontend
2021-07-19 00:45:45 +03:00
Thomas Leitz
1b5930887c fixed rsync command for frontent
nginx-mempool.conf has "root /var/www/mempool/browser;"
2021-07-18 23:20:28 +02:00
Thomas Leitz
5b39c018db Fixed 'cp' command for nginx.conf and nginx-mempool.conf
The destination path was a file, should be a directory.
2021-07-18 22:54:47 +02:00
Miguel Medeiros
ad08c3a907 Add min-height to mempool-info-data. (#639) 2021-07-18 16:42:02 +03:00
Miguel Medeiros
08328cbf0f Bugfix: Overflow in difficulty adjustment component. (#638)
* Remove green progress bar.

* Fix itens overflow.
2021-07-18 15:47:47 +03:00
Miguel Medeiros
03ce592ab0 Fix time-span calculation. (#635) 2021-07-18 15:42:59 +03:00
softsimon
21db5a4102 Removing shortened date i18n strings. 2021-07-18 01:02:02 +03:00
softsimon
7234734056 Updated "mins per block" i18n string. 2021-07-17 18:23:50 +03:00
softsimon
7bf9d604b9 Reusing hard coded In~1 min with base date minute i18n string. 2021-07-17 16:36:21 +03:00
softsimon
08fd4a4835 Updating from transifex. 2021-07-17 15:37:34 +03:00
softsimon
9a715871c5 Updating i18n strings. 2021-07-17 14:59:10 +03:00
Miguel Medeiros
d405334109 UI/UX - New component for difficult adjustment. (#602)
* Add next difficulty blocks.
Add next difficulty target date.
Add next difficulty total progress.
Add ajustment difficulty avg min per block.

* Fix typo.

* Trigger difficulty calculation every 5 seconds.

* Add rxjs timer to difficultyEpoch.

* Fix pipe.

* Fix small bar position.

* Change i18n strings.

* Fix typo.

* Add time-until component.

* Speed up difficultyEpoch timer to 1000 ms.

* Fix values to 2 decimal places.

* Add title to fee and difficulty adjustment cards.

* Add title outside the card.

* Fix title to center position.

* Add other titles.

* Add new transalations strings.
Refactor time span component.

* Fix difficulty adjustment i18n string.
Fix duplicated i18n strings.
2021-07-17 14:58:16 +03:00
Miguel Medeiros
38aee1a897 UI/UX - Scroll by clicking on the pagination button. (#613)
* Add scrollIntoView when click on pagination.

* Add padding top.

* Fix access DOM from ViewChild.

* Fix scrolling position.

* Fix chrome and firefox compatibility.
2021-07-16 15:33:22 +03:00
Miguel Medeiros
52aea12f22 UI/UX - Fix arrow position. (#627)
* Fix arrow position.

* Add arrows from font-awesome.

* Add icons to bisq transfers.

* Fix icon size in mobile view.
2021-07-15 23:23:37 +03:00
softsimon
ecbd18087b Effective fee could go below 0 due to rounding error. (#623)
fixes #606
2021-07-14 22:42:48 +03:00
softsimon
d13e18a72a Fix for liquid network redirect in staging proxy. 2021-07-14 14:40:31 +03:00
softsimon
8749b8b0fa Updating @mempool/node-bitcoin to support new methods 2021-07-13 18:43:10 +03:00
softsimon
f2e0a71b01 Only display Trade Mark sign on english language. (#608) 2021-07-13 12:00:05 +03:00
softsimon
b4eea3dc72 Updating from transifex. 2021-07-13 11:49:46 +03:00
softsimon
cdfc03f352 Adding Hindi 2021-07-13 11:49:04 +03:00
Miguel Medeiros
2c5ccab77c UI/UX - Blocks not visible on the TV page. (#626)
* Fix blocks not visible on the TV page.

* Add e2e testing for tv screen.
2021-07-12 17:19:58 +03:00
softsimon
80d76ad1f4 Updating from transifex. 2021-07-11 22:06:14 +03:00
softsimon
9a2428ad79 Update i18n. 2021-07-10 18:20:15 +03:00
Miguel Medeiros
71cf41362f UI/UX - Add skeleton for blocks preload. (#615)
* Add skeleton for blocks preload.

* Add e2e testing for skeleton blocks preloader.

* Fix reduce mempool blocks to fit the screen.

* Fix variable naming.
2021-07-10 16:04:15 +03:00
Miguel Medeiros
652f88770e Fix mouse over tooltip width. (#614) 2021-07-07 22:20:17 +03:00
Miguel Medeiros
7de2cf89f4 Fix table overflow. (#612)
fixes #303
2021-07-07 15:22:25 +03:00
softsimon
d7a827ba7f Update from transifex. 2021-07-06 20:05:59 +03:00
Miguel Medeiros
9dae7020c8 Liquid support for unblinding transactions. (#588)
* Add docker file to generate wallycore wasm js lib.

* Add unblinded liquid transactions.

* Add background to unblided transactions.

* Check liquid network to try to unblind tx.

Ww don't want to try to unblind transactions in other networks.

Co-authored-by: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com>

* Delete libwally-core dockerfile.

* Delete wallycore.html.

* Fix validation unblind tx.
Fix lint.
Add errorUnblinded.
Add vin.prevout unblinded tx.

* Add e2e testing to liquids unblinded tx.

* Load libwally.js dynamically.

* Fix table size.

* Add Blockstream License to libwally and wallycore.

Co-authored-by: Felipe Knorr Kuhn <100320+knorrium@users.noreply.github.com>
2021-07-06 19:56:32 +03:00
softsimon
3ae3df6722 Revert "Parse TXID, hash or address strings from search bar and allow searching for TXID:OUTPUT. (#578)" (#610)
This reverts commit 2e2e6aa01f.
2021-07-06 19:55:01 +03:00
softsimon
2e2e6aa01f Parse TXID, hash or address strings from search bar and allow searching for TXID:OUTPUT. (#578)
fixes #450
fixes #415
2021-07-06 19:43:18 +03:00
Miguel Medeiros
1e9f131a2a Fix pagination responsive layout. (#590)
* Fix pagination responsive css.

* Fix css title block transaction alignment.

* Add pagination responsive layout to bisq tx page.

* Add pagination responsive  to bisq blocks page.

* Fix pagination css - bisq txs page.

* Add e2e tests for bisq and mainnet pagination.
2021-07-05 22:28:56 +03:00
wiz
5197a15e31 Merge pull request #596 from knorrium/skip_cypress_on_docker
skip downloading the Cypress binary on Docker
2021-07-04 07:02:05 +09:00
wiz
1d29fad986 Bump version to v2.2.1-dev 2021-07-03 14:49:59 -07:00
wiz
eb6db6caf3 Bump version for v2.2.0 release 2021-07-03 14:36:10 -07:00
wiz
78c44eedbc Update from transifex 2021-07-03 14:34:47 -07:00
softsimon
b48a48a6be Updating from transifex. 2021-06-29 13:12:47 -04:00
softsimon
8e1aae1bbf Updating i18n messages. 2021-06-29 13:11:39 -04:00
Miguel Medeiros
807d4b0327 Fix tv only (#598)
* Remove TV Only container.
2021-06-29 13:10:15 -04:00
Miguel Medeiros
df588695ec Fix iinverse mempool graph also affect the TV view (#580) 2021-06-29 13:08:11 -04:00
softsimon
da13349b14 Reduce titles in Russian language to prevent overflows. 2021-06-27 12:16:59 -04:00
Felipe Knorr Kuhn
f6e4907128 skip downloading the Cypress binary on Docker 2021-06-26 16:48:57 -07:00
softsimon
6be733490f npm audit fix 2021-06-26 15:28:45 -04:00
wiz
fdf15c39a6 Merge pull request #595 from knorrium/fix_docker_builds
Improvements to local and Docker builds
2021-06-27 04:20:09 +09:00
softsimon
3b020046b7 Update i18n from transifex. 2021-06-26 14:45:05 -04:00
Felipe Knorr Kuhn
8574ee6edd push both tag and latest images at the same time 2021-06-26 10:29:08 -07:00
Felipe Knorr Kuhn
f937ea5745 fix missing backslash 2021-06-26 00:38:18 -07:00
Felipe Knorr Kuhn
741a020579 add missing semicolon 2021-06-26 00:29:45 -07:00
Felipe Knorr Kuhn
33d37a9b5b update generate-config to read the short sha from docker 2021-06-25 23:47:40 -07:00
Felipe Knorr Kuhn
446bdfebea update FE Dockerfile to read short sha 2021-06-25 23:47:19 -07:00
Felipe Knorr Kuhn
ca91afe45b update GHA workflow to expose the short sha to docker 2021-06-25 23:46:56 -07:00
softsimon
33a5be5a7d Lower scroll threshold to fix load more not triggering. (#576)
* Lower scroll threshold to fix load more not triggering.

fixes #575
2021-06-24 18:20:20 -04:00
softsimon
6a4eee3711 Updated from transifex. 2021-06-22 13:56:46 -04:00
softsimon
13931ceec6 Updated from transifex. 2021-06-22 10:57:44 -04:00
softsimon
0c418a9e33 Updated from transifex. 2021-06-22 10:57:26 -04:00
softsimon
6f8b95a17f Updating i18n. 2021-06-17 11:59:11 -05:00
softsimon
389c1d794c Updated from transifex. 2021-06-17 11:09:52 -05:00
softsimon
fca66f1b9f Updating i18n. 2021-06-17 11:09:07 -05:00
Felipe Knorr Kuhn
4c7d0cd2e5 Generate config on serve and updated git revision method (#587)
* run generate-config on serve

* write the config file only if settings have changed

* read the git commit hash from the current branch, not master

* git sha is now short by default, no need to trim on the about component
2021-06-16 13:47:05 -05:00
Felipe Knorr Kuhn
1016586992 fix the block viewer for liquid (#584) 2021-06-16 11:48:46 -05:00
wiz
38c8f3acb4 More tweaking of project description on About page 2021-06-16 00:19:56 -05:00
wiz
962023fbc4 Update project description on About page 2021-06-15 23:56:49 -05:00
wiz
b4f8bb2f48 Add trademark symbols and trademark notice to About page 2021-06-15 23:23:26 -05:00
Felipe Knorr Kuhn
c26461fada Route json assets to prod (#585)
* update proxy settings to route json assets to prod
2021-06-15 17:32:36 -05:00
softsimon
1a996e1640 Adding missing space. 2021-06-13 17:56:24 -05:00
softsimon
c80532b420 Bumping mempool.js lib. 2021-06-13 15:39:40 -05:00
wiz
74c49b9ae7 Enable i18n locale for Russian (ru) 2021-06-13 15:05:21 -05:00
softsimon
3f03c9c2b6 Swap location of API doc tabs. 2021-06-12 17:18:59 -05:00
softsimon
f00e727e68 Updating i18n from transifex. 2021-06-11 23:27:29 -05:00
Miguel Medeiros
4338dd6c3f Fix transaction title breaks row on some languages (#570) 2021-06-11 23:16:45 -05:00
Felipe Knorr Kuhn
8385c50605 Update test dependencies (#572)
* move Cypress to the optionalDependencies section

* remove protractor

* remove dead protractor test files
2021-06-11 23:06:55 -05:00
softsimon
93c4b1caf1 Fix for missing overpaid fees tag on confirmed txs
fixes #483
2021-06-11 19:30:33 -05:00
softsimon
49810b6a47 Added new i18n strings 2021-06-11 14:54:57 -05:00
softsimon
28d685a661 Updated i18n from transifex 2021-06-11 10:58:54 -05:00
softsimon
95d3d0feaf Bisq transactions was listed in the wrong order.
fixes #566
2021-06-11 10:55:13 -05:00
softsimon
cbc5d67f62 Update README.md 2021-06-10 16:18:26 -05:00
softsimon
87575bc0a2 Add v2.2.0 screen shot 2021-06-10 16:18:09 -05:00
softsimon
8f74ef58f8 i18n fixes. 2021-06-10 15:38:15 -05:00
softsimon
2475c67d5b Use default proxy config for local proxy conf. 2021-06-10 09:55:19 -05:00
softsimon
bf45bf7b39 Update i18n from transifex 2021-06-10 09:52:13 -05:00
Miguel Medeiros
a1f0417997 Sponsor page (#560)
* Refactor sponsors page layout.
Remove add to t-shirts.

* Remove tshirt promo.

* Refactor sponsors page layout.
Remove add to t-shirts.

* Remove bootstrap classes and inline styles.
Add new classes to thanks page.

Co-authored-by: softsimon <softsimon@protonmail.com>
2021-06-09 18:36:34 -05:00
Miguel Medeiros
237f265aab Refactor about page layout. (#559)
* Refactor about page layout.

* Fix loading sponsors layout.
Fix container margins.
Fix sponsor image src.
2021-06-09 18:35:54 -05:00
softsimon
0087700aa5 Adding missing i18n strings on Bisq. 2021-06-09 14:09:25 -05:00
softsimon
861344ed6d Update i18n from transifex. 2021-06-09 13:35:07 -05:00
softsimon
9e343b346a Update i18n. 2021-06-08 22:44:52 -05:00
softsimon
e857dbc874 I18n space fix. 2021-06-08 22:38:48 -05:00
softsimon
a10cd09ba8 I18n space fix. 2021-06-08 22:37:23 -05:00
softsimon
f30777934f Remove tshirt promo. 2021-06-08 21:42:48 -05:00
Miguel Medeiros
4f6bf297bf Fix loading icon position at graph page. (#558) 2021-06-08 00:29:25 -04:00
Miguel Medeiros
0121052f0b Fix lint errors. (#556) 2021-06-07 15:48:27 -04:00
Felipe Knorr Kuhn
1bd0c40c15 New e2e test suite (#555)
* add @cypress/schematic as a dev dependency

* replace protractor with cypress

* remove the boilerplate test

* add the cypress-wait-until helper library

* add cypress-wait-until to all tests

* add signet to stg proxy config

* add proxy config for production

* add environment configs to angular.json

* update e2e target to use the production proxy

* update serve and start scripts to use the new environment config

* add the concurrently lib to the dev dependencies

* fix missing import

* ignore videos and screenshots saved by the e2e suite

* add fixtures for the tests

* update cypress npm scripts to use concurrently

* add some e2e tests
2021-06-07 10:36:41 -04:00
softsimon
2ee96cae44 Remove duplicate i18n string sponsor 2021-06-06 17:16:39 -04:00
softsimon
28c8d7dba0 Updated i18n 2021-06-06 16:56:08 -04:00
softsimon
9b05ecedc6 Address page: Display load more button on load error. (#542)
fixes #440
2021-06-06 16:07:45 -04:00
softsimon
8fbd273733 Empty Bisq blocks was missing. (#541)
fixes #539
2021-06-06 16:07:26 -04:00
Miguel Medeiros
dec8ae2930 Dashboard layout reviewed. (#550)
* Fix mempool-info-data item margin-bottom.

* Remove unecessary bootstrap classes.

* Fix lint errors.

* Fix and remove css classes.

* Add css class to Terms of Service.
2021-06-06 16:07:04 -04:00
Miguel Medeiros
353b0e8729 New API docummentation. (#544)
* Install hljs package.

* Add highlight.js stylesheet and js to index.html.

* Add new instructions for API documentation.

* Add network value to code-template component.

* Add curl examples.

* Fix tab order of bisq api page.

* Add esmodules instalation instructions.
Add external links to repositories.

* Add self-hosted hljs styles.

* Add response code examples.
Add dynamic networks to curl examples.
Remove reponse code box if not needed.

* Self hosted highlight.min.js.

* Bumping "ws" dependency to fix vulnerability.

* npm audit fix

* npm audit fix

* Remove Hightlight.js dependency.
Add new style to code-template-component.

* Remove hljs css.

* Change NgbModule and NgbAccordionModule  to shared

* Fix NgbAccordionModule import.
2021-06-06 16:06:56 -04:00
softsimon
71bfcea8a6 npm audit fix 2021-05-31 19:03:10 -04:00
softsimon
c54c30209e npm audit fix 2021-05-31 19:02:39 -04:00
softsimon
abc6b1519e Bumping "ws" dependency to fix vulnerability. 2021-05-31 18:49:19 -04:00
Miguel Medeiros
4dcda2cf47 Invert graph legends order. (#532)
* Invert graph legends order.

* Reorder graph legends if inverted-graph is true.
2021-05-23 13:51:29 +04:00
Miguel Medeiros
d055fabfeb Fix innerHTML element of status view component. (#537) 2021-05-23 02:16:23 +04:00
Miguel Medeiros
dbb365f5e3 Align loading component in the center. (#535)
* Align loading component in the center.

* Change height of loading component.
2021-05-22 18:57:15 +04:00
Miguel Medeiros
efb5deda43 Fix missing whitespace linting. (#534) 2021-05-21 19:03:18 +04:00
softsimon
a4cd6450e3 Fix for race condition causing cpfp fetching not working. (#533)
fixes #505
2021-05-21 17:06:53 +04:00
softsimon
edad15da0d Upgrading mempool.js 2021-05-21 03:30:39 +04:00
Miguel Medeiros
e70fd0045d Fix tx-list load is being constantly triggered. (#531) 2021-05-20 02:03:59 +04:00
Miguel Medeiros
794bc99cb6 Change chart-holder width. (#530) 2021-05-20 00:44:21 +04:00
Miguel Medeiros
cd1ec53af0 Align scriptmessage text to the left. (#529)
* Align scriptmessage text to the left.
* Script message box only fills the text width.
2021-05-19 01:16:47 +04:00
Miguel Medeiros
3e435d1394 Fix vertical align Graph. (#528)
* Fix graph component vertical css query.

* Fix chart-holder padding-top.
2021-05-19 01:06:51 +04:00
Miguel Medeiros
50b94f8b72 Fix TV View graph height. (#527)
* Fix graph alignment.
Only show the graph on desktop resolutions.

* Fix mempool-info-chart chart alignment.
2021-05-18 23:59:48 +04:00
softsimon
f6f5b69487 Sponsor t-shirts. 2021-05-18 23:00:07 +04:00
wiz
66b27b9dd0 Merge pull request #524 from mempool/simon/sponsor-page
New separate sponsorship page
2021-05-19 00:50:14 +09:00
Miguel Medeiros
71fa2d67cb Fix rbf alert css. (#525) 2021-05-18 18:56:42 +04:00
Miguel Medeiros
5cd2cfa097 FIX unify the units css. (#499)
* FIX unify the units css.
* Fix units css font-size.
2021-05-18 18:20:17 +04:00
softsimon
cfd13b3655 New separate sponsorship page. 2021-05-18 13:23:39 +04:00
wiz
3ffa60db1f Merge pull request #517 from mempool/simon/bisq-address-prefix-search
Handle the 'B' prefix in the search bar autocomplete on /bisq
2021-05-14 03:42:15 +09:00
softsimon
4442964124 Updated regex to accept bisq-addresses. 2021-05-13 21:56:57 +04:00
wiz
cb034020ef Merge pull request #521 from mempool/simon/bisq-price-coloring
Bisq dashboard: Change color between red/green when price changes
2021-05-14 00:53:15 +09:00
softsimon
5aa57d6df9 Bisq dashboard: Change color between red/green when price changes 2021-05-13 19:23:43 +04:00
softsimon
c1a79e3a33 Handle the 'B' prefix in the search bar autocomplete on /bisq
refs #510
2021-05-13 03:01:47 +04:00
wiz
bbd21c9401 Merge pull request #511 from knorrium/improve_scrolling_between_routes
Improve scrolling between routes
2021-05-13 02:03:14 +09:00
wiz
ad22f9cb46 Merge pull request #515 from mempool/simon/round-up-fee-estimates
Round up fee estimations
2021-05-13 01:42:37 +09:00
softsimon
939955fb84 Round up fee estimations 2021-05-12 20:13:55 +04:00
softsimon
63e67dba38 Bisq markets: Add terms of service 2021-05-12 16:07:25 +04:00
softsimon
8a1230623e Adding missing icon import. 2021-05-12 15:57:46 +04:00
softsimon
f20c73af7b Update fiat price every minute instead of every hour. 2021-05-12 15:09:48 +04:00
softsimon
12c99b86b7 Bisq markets: Display terms of service and language selector (except on official markets).
refs #510
2021-05-12 14:51:55 +04:00
softsimon
934dd67384 Updated i18n from transifex. 2021-05-11 15:31:42 +04:00
softsimon
870bd54b38 Updated i18n. 2021-05-11 15:29:03 +04:00
softsimon
89300dae98 Bisq markets: Fix for graph not updating when changing window
refs #510
2021-05-11 14:55:45 +04:00
softsimon
482a891cec Bisq markets: Swapping price locations 2021-05-11 14:37:25 +04:00
softsimon
098ab7d3a7 Bisq market symlinks fix. 2021-05-11 13:25:16 +04:00
softsimon
147d44d14b npm audit fix 2021-05-11 12:43:19 +04:00
Felipe Knorr Kuhn
8ccdf3973c set toggleShowDetails() to scroll into the viewport using anchors 2021-05-10 22:18:30 -07:00
wiz
c09eb651ef Add production/nginx-bisq.conf for bisq.markets usage 2021-05-11 14:18:25 +09:00
Felipe Knorr Kuhn
ac91d814d6 add anchors to the block component 2021-05-10 22:16:42 -07:00
Felipe Knorr Kuhn
be2f024da1 enable scroll position restoration and anchor scrolling 2021-05-10 22:15:54 -07:00
wiz
f137f45cef Merge pull request #508 from mempool/simon/bisq-new-dashboard
New Bisq Markets Dashboard Design
2021-05-11 13:40:32 +09:00
softsimon
90784deacc New Bisq Markets Dashboard Design
fixes #476
2021-05-11 04:15:11 +04:00
softsimon
8ed664e3a9 Update translations from transifex. 2021-05-08 01:12:57 +04:00
softsimon
17b6916f31 Update i18n messages. 2021-05-08 01:11:05 +04:00
Miguel Medeiros
b778d96910 Fix OP_RETURN truncated text. (#502)
* Fix OP_RETURN truncated text.

* Fix scriptmessage width on desktop media queries
2021-05-08 00:36:35 +04:00
wiz
5b2eb16d1c Merge pull request #498 from MiguelMedeiros/op_return
Fix Coinbase and OP_RETURN truncated text.
2021-05-07 00:00:12 +09:00
wiz
af61357ced Merge pull request #478 from mempool/simon/address-page-error-localization
Localize electrum limit error.
2021-05-06 23:04:01 +09:00
wiz
f281e84396 Disable caching of electrs endpoints in production/nginx.conf 2021-05-06 21:20:13 +09:00
Miguel Medeiros
0dc255edf9 Fix OP_RETURN css width. 2021-05-06 09:00:33 -03:00
Miguel Medeiros
2f8f3ca2e9 New concept for dashboard layout components. (#469)
* New concept for dashboard layout components.

* Align dashboard componentes.

* Add divider to fee box component.

* Remove TV icon from mobile and tablet queries.

* Fix form input overflow.

* Add responsive css to statistic component.

* Add responsive css to about page.

* Add global padding bottom.

* Fix graph page styles.

* Add responsive chart and scrollable table.

* Fix mobile css query for navbar menus.

* Fix pagination responsive css.

* Add CSS animated logo.

* Revert "Add CSS animated logo."

This reverts commit 92af38294c0d4fe815a801b37635cde7f8ee1ced.

* Add extra skeleton to fee-box-component.

* Fix latest-blocks and latest-transactions table css.

* Adapt Bisq pages to responsive layout.

* Remove parenthesis from fiat amout.
Fiat prive break not break on desktop.
Transaction ID align left.
Fee box skeleton width resize.

* Fix mobile table text-size.

* Fix dashboard mempool info mobile alignment.
2021-05-03 17:11:30 +04:00
softsimon
39bb93970b Lower height where taproot signaling cal be visible. 2021-05-01 21:46:49 +04:00
softsimon
72d01a0b67 Improve taproot detection. Only display when detected. 2021-05-01 21:03:01 +04:00
softsimon
0b4da88802 Hide taproot signalling until signalling starts. 2021-05-01 04:06:45 +04:00
softsimon
d2fe000ad0 Display block details and taproot signaling. 2021-05-01 03:55:02 +04:00
softsimon
dcedc8a5ff Localize electrum limit error.
fixes #442
2021-04-27 14:21:33 +04:00
wiz
0d03a9e6cc Send HTTP header Vary: Cookie to prevent localization cache bug
Fixes #477
2021-04-27 19:00:33 +09:00
wiz
24b7acdc60 Merge pull request #475 from mempool/simon/difficulty-adjustment-calc-fix
Fixing incorrect difficulty adjustment call
2021-04-27 17:50:43 +09:00
wiz
1000f4dd4d Merge pull request #474 from mempool/simon/bitcoind-tx-push-break-fix
Fix crash issues related to new unconfirmed transactions in bitcoind …
2021-04-27 17:44:19 +09:00
softsimon
d5dba9128e Fixing incorrect difficulty adjustment call
fixes #471
2021-04-27 12:20:11 +04:00
softsimon
84b0375c0c Fix crash issues related to new unconfirmed transactions in bitcoind mode.
fixes #391
2021-04-27 02:13:48 +04:00
softsimon
bf23a6649c Updating from transifex. 2021-04-26 04:05:55 +04:00
softsimon
aea35d4c86 i18n update 2021-04-26 04:03:33 +04:00
softsimon
52b7efdd53 Updated transifex. 2021-04-26 03:45:14 +04:00
wiz
492abad7a6 Fix a few Bisq strings, update transifex source strings 2021-04-26 07:59:15 +09:00
softsimon
f566eae471 Fixed api docs typo. 2021-04-26 02:40:30 +04:00
wiz
2f2be5c64b Capitalize some strings in Bisq components, update i18n 2021-04-26 07:30:34 +09:00
wiz
5d1af0a86e Merge pull request #381 from mempool/simon/bisq-dashboard
Bisq dashboard
2021-04-26 07:17:03 +09:00
softsimon
5cd5280b21 Updated i18n 2021-04-26 01:49:58 +04:00
softsimon
3a957ece05 Merge branch 'master' into simon/bisq-dashboard
# Conflicts:
#	frontend/src/locale/messages.xlf
2021-04-26 01:41:07 +04:00
wiz
3ead05fa51 Add missing i18n tags for various strings, fixes #473 2021-04-26 06:35:56 +09:00
wiz
8a838cd4dc Credit @maciejsoltysiak as translator for Polish 2021-04-26 06:27:51 +09:00
wiz
b05f731332 Update translated strings from Transifex 2021-04-26 06:17:59 +09:00
wiz
06fd821bf8 Update translated strings from Transifex 2021-04-26 05:44:00 +09:00
wiz
6dbfcc9d1a Enable i18n for Polish language 2021-04-26 05:43:47 +09:00
softsimon
001bddd529 Bisq Markets i18n 2021-04-25 22:52:11 +04:00
softsimon
56518b9655 Updated titles 2021-04-25 19:40:43 +04:00
softsimon
da050ee3dc Swap BTC/Fiat columns. 2021-04-25 19:02:26 +04:00
softsimon
5878a2e631 Unified Bisq config 2021-04-25 02:38:46 +04:00
softsimon
c1fc08196b Add whitespaces to missing data points. 2021-04-25 02:07:29 +04:00
softsimon
95a80157a7 Hide latest altcoin trades when not using official bisq markets. 2021-04-24 20:33:56 +04:00
softsimon
165aa6eee2 Don't hide API docs on mobile. 2021-04-23 15:44:01 +04:00
softsimon
b8fe7b621c Merge branch 'master' into simon/bisq-dashboard
# Conflicts:
#	frontend/package-lock.json
#	frontend/src/app/components/master-page/master-page.component.html
2021-04-23 15:35:35 +04:00
softsimon
04ec5e9564 Sort table by number of trades as default sort option, make other columns sortable 2021-04-23 15:09:51 +04:00
softsimon
2d4dff6de8 Display 100 latest trades. 2021-04-23 03:49:55 +04:00
softsimon
5cb98b9813 Make unique URLs for graph timespans 2021-04-21 22:12:35 +04:00
softsimon
d4508bd876 Add loading spinners. 2021-04-21 20:22:34 +04:00
wiz
6ccac1df79 Merge pull request #467 from knorrium/fix_infinite_scrolling
fix infinite scrolling by not using body as the container
2021-04-20 16:47:50 +09:00
Felipe Knorr Kuhn
b38fc824e6 fix infinite scrolling by not using body as the container 2021-04-19 23:48:33 -07:00
softsimon
cdbe90c182 Only enable statistics service from node master process.
fixes #460
2021-04-19 21:39:30 +04:00
softsimon
6b5b80f866 Update chart colors. 2021-04-19 17:39:47 +04:00
Miguel Medeiros
d74677628b New UI for responsive navbar. (#458)
New UI for responsive navbar.
fixes #458
2021-04-19 17:01:04 +04:00
softsimon
f0d46d6ed8 Don't reload after setting graph preference setting.
refs #365
2021-04-19 10:50:24 +04:00
Felipe Knorr Kuhn
220d9afd97 persist graph window preference between reloads (#456)
Persist graph window preference between reloads
fixes #365
2021-04-19 10:17:16 +04:00
wiz
dfd88a7ff9 Merge pull request #454 from knorrium/fix_ios_native_scrolling
fix native scrolling on iOS devices
2021-04-18 19:26:27 +09:00
wiz
eec36ae4e6 Merge pull request #453 from knorrium/bind_server_address 2021-04-18 08:16:56 +09:00
Felipe Knorr Kuhn
0a07a16650 fix native scrolling on iOS devices 2021-04-17 16:11:34 -07:00
Felipe Knorr Kuhn
e62ee72149 bind the server to 0.0.0.0 to allow it to be reachable by other devices 2021-04-17 15:53:22 -07:00
softsimon
117f5410d7 Merge pull request #452 from knorrium/stg_frontend_config
add new configuration and targets to point the frontend to staging
2021-04-18 02:10:09 +04:00
Felipe Knorr Kuhn
f6ea45b61f add new configuration and targets to point the frontend to staging 2021-04-17 14:52:16 -07:00
wiz
90b06833ba Rename frontend npm dep @mempool/mempool-js to @mempool/mempool.js 2021-04-17 12:58:27 +09:00
wiz
221fccf3bc Merge pull request #449 from mempool/simon/syslog-config
Syslog is now configurable with minimum priority and facility option.
2021-04-16 02:54:22 +09:00
wiz
3740980007 Update Exodus logo with new SVG 2021-04-16 02:29:06 +09:00
softsimon
d1b53f4c3a Syslog priority comparison fix. 2021-04-15 21:16:56 +04:00
wiz
d51ea54ab9 Add production FreeBSD tuning parameters to increase network buffers 2021-04-16 00:12:29 +09:00
wiz
3300f0e8d3 Set production backend config "CLEAR_PROTECTION_MINUTES": 5 2021-04-15 21:44:38 +09:00
softsimon
cd1273981d Syslog is now configurable with minimum priority and facility option.
fixes #135
2021-04-15 16:04:09 +04:00
softsimon
fd0ffd2a39 Upgrading mempool-js to v2.3. 2021-04-15 00:57:10 +04:00
wiz
d60bc10941 Update Square Crypto logo with SVG image 2021-04-14 05:04:02 +09:00
wiz
5085e0c420 Add Exodus as Enterprise Sponsor on About page 2021-04-14 04:55:58 +09:00
softsimon
3dbddedf91 Remove 'v' from version. 2021-04-13 18:12:32 +04:00
softsimon
e255bec7ad Updating versions to v2.2.0-dev 2021-04-13 16:53:42 +04:00
softsimon
cbe79d7051 Show backend info at the bottom. Removing frontend hostname. Re-adding frontend version and commit on top. JS error fix. 2021-04-13 11:51:55 +04:00
softsimon
344d1247bd Updated package.json. 2021-04-13 11:30:53 +04:00
wiz
089bb38e6a Change log priority for 'The mempool is now in sync!' message to NOTICE 2021-04-13 14:03:36 +09:00
wiz
2077126064 Merge pull request #447 from mempool/simon/frontend-commit-hash-hostname
Backend and frontend commit, version and hostname displayed on the about page
2021-04-13 13:58:59 +09:00
softsimon
fcf7955d63 Merge branch 'master' into simon/bisq-dashboard
# Conflicts:
#	frontend/package-lock.json
#	frontend/package.json
2021-04-12 22:22:50 +04:00
softsimon
7a4ad0ee2f Including gitCommit and version in frontend build. Backend now sending a backendInfo object containing commit, version and hostname. All printed on About page. 2021-04-12 22:17:13 +04:00
wiz
4bb68d0163 Update mempool.space og/twitter preview image with 5 block style logo 2021-04-13 00:13:58 +09:00
wiz
f80a11d1f4 Increase section spacing on About page 2021-04-13 00:10:15 +09:00
wiz
f61e3d8cec Merge pull request #445 from mempool/simon/disk-cache-save-error
Only allow one disk cache saving simultaneously, and allow for partia…
2021-04-12 18:40:32 +09:00
softsimon
7fab42baa5 Only allow one disk cache saving simultaneously, and allow for partially written cache files.
fixes #444
2021-04-12 13:21:49 +04:00
softsimon
4ab4581393 Fix for effective fee rate calculation bug. 2021-04-12 13:02:31 +04:00
wiz
4c8d261da0 Merge pull request #441 from knorrium/fix_address_explorer_typo 2021-04-11 13:34:28 +09:00
Felipe Knorr Kuhn
88c9fd0c7b fix typo on 413/405 error message on the address explorer 2021-04-10 21:04:30 -07:00
softsimon
f1c5f83412 Don't round variables in code, only in templates. 2021-04-10 23:23:05 +04:00
softsimon
2d9b9b5c5d When filtering out lower fee parents, compare with effective fee instead of base fee to include a CPFP chain of transactions. 2021-04-10 21:26:05 +04:00
softsimon
c7c4895eab fixes #438 2021-04-10 20:59:27 +04:00
softsimon
979b870c9c Bump mempool-js version to 2.2.1 2021-04-10 18:58:20 +04:00
softsimon
041aa2a163 Build mempool-js as standalone. 2021-04-10 18:51:13 +04:00
wiz
1bb990b796 Merge pull request #436 from MiguelMedeiros/bugfix/project-contributor-alignment
FIX: align project contributor handle text.
2021-04-10 19:44:26 +09:00
wiz
a6e7e1966e Merge pull request #437 from mempool/simon/contributors-proxy
Proxy contributor requests.
2021-04-10 19:39:26 +09:00
softsimon
db263b8db4 Proxy contributor requests. 2021-04-10 11:33:01 +04:00
Miguel Medeiros
0289620262 FIX: align project contributor handle text. 2021-04-09 17:07:11 -03:00
wiz
d8ef0cd3ac Add BlueWallet as Community Integration on About page
Also try to fix sort order of integrations:
* P2P Exchange Networks
* Raspberry Pi distros
* Onchain wallets
* Lightning wallets
* Watch-only wallets
2021-04-10 02:32:27 +09:00
wiz
68be897379 Fix typo in API documentation for /api/block/:hash/raw method 2021-04-09 21:59:21 +09:00
wiz
2016d4bca6 Merge pull request #433 from mempool/simon/build-mempool-js
Build mempool-js to root www folder.
2021-04-09 12:01:30 +09:00
wiz
0c2d88960c Publish mempool-js output as mempool.js instead of .min.js 2021-04-09 12:01:21 +09:00
softsimon
e3e1cddd2f Build mempool-js to root www folder. 2021-04-09 01:22:24 +04:00
wiz
00b564149d Add Square as Enterprise Sponsor on About page 2021-04-08 00:05:11 +09:00
wiz
dee614f6ac Merge pull request #432 from mempool/simon/angular-11-upgrade
Upgrading all front and backend dependencies, including Angular 11.
2021-04-07 23:31:30 +09:00
wiz
896a4cbcfc Set frontend tsconfig to target es2020 2021-04-07 22:40:13 +09:00
softsimon
e731077077 extractCss is deprecated and always defaults to true. 2021-04-07 17:36:20 +04:00
softsimon
4a907f9dc6 Upgrading all front and backend dependencies, including Angular 11.
fixes #429
2021-04-07 16:18:55 +04:00
wiz
b0baf6aa0d Merge pull request #422 from mempool/simon/corerpcminfee-catcher
Catch getMempoolInfo errors gracefully to not break general main loop
2021-04-06 16:08:20 +09:00
softsimon
8dddfe38a9 Updating getMempoolInfo defaults. 2021-04-06 11:07:38 +04:00
wiz
0f9f905fd1 Merge pull request #419 from mempool/simon/cpfp-duplicate-fix
Fix for duplicate cpfp ancestors.
2021-04-06 15:58:58 +09:00
wiz
bc8e3109fa Merge pull request #427 from mempool/simon/cpfp-ancestors-fee-bug
Bugfix: Ancestors are not able to increase fee of descendants
2021-04-06 15:52:46 +09:00
softsimon
56b0eab9b4 Bugfix: Ancestors are not able to increase fee of descendants
fixes #426
2021-04-06 10:41:13 +04:00
softsimon
5914d99283 Bugfix: Ancestors are not able to increase fee of descendants
fixes #426
2021-04-05 23:45:47 +04:00
softsimon
d942cb48a5 Catch getMempoolInfo errors gracefully to not break general main loop
fixes #411
2021-04-02 11:47:13 +04:00
softsimon
4d0429b786 Fix for duplicate cpfp ancestors.
fixes #414
2021-04-02 00:30:51 +04:00
wiz
2b1c511611 Merge pull request #410 from mempool/wiz/dual-license-under-agplv3-and-gplv3
Dual-license mempool under both the GNU AGPLv3 and GPLv3 licenses
2021-04-02 00:15:59 +09:00
wiz
8a86b63693 Tweak margins and layout spacing on About page 2021-04-01 16:42:37 +09:00
softsimon
2a2c1a6291 Increase space between logos and titles. 2021-03-31 22:49:55 +09:00
wiz
ce1860b7d1 Add Gemini as an Enterprise Sponsor on About page 2021-03-31 22:49:51 +09:00
softsimon
37e01c5e91 Always display one decimal on fee rate for consistency. 2021-03-31 15:43:23 +04:00
wiz
0ff05d5551 Update legal notices for dual-licensed AGPLv3 and GPLv3 on About page 2021-03-28 00:07:03 +09:00
wiz
9b428821f6 Dual-license mempool under both the GNU AGPLv3 and GNU GPLv3 licenses
A few weeks ago in #388, we changed the license for the mempool project
from MIT+CC to AGPLv3. This was generally met with very positive
feedback from the Bitcoin community. However, a few very large
enterprise organizations that love the mempool project are now no longer
able to use our code, since apparently some enterprise organizations
have an internal policy of not using AGPL licensed software.

Since the AGPLv3 license is compatible with the GPLv3 license in various
ways, adding the GPLv3 as an alternative second license for the project
seems like a reasonable way to retain most of the copyleft properties of
our current AGPLv3 license, while also keeping the community happy and
allowing them GPLv3 as another choice if they are prohibited from using
the AGPL internally.

Therefore, I propose to add GPLv3 as an alternative license for the
mempool open source project in this PR. If you are okay with this,
please ACK with "I hereby re-license my contributions to the mempool
open source project under both the GNU AGPLv3 and GPLv3 licenses"

- [ ] @softsimon
- [ ] @wiz
- [ ] @bguillaumat
- [ ] @TechMiX
- [ ] @rbrooklyn
- [ ] @junderw
- [ ] @andrerfneves
- [ ] @andrewtoth
- [ ] @6102bitcoin
- [ ] @Czino
- [ ] @devinbileck
- [ ] @knorrium
- [ ] @jambolo
- [ ] @lucasmoten
- [ ] @fiatjaf
- [ ] @pox
- [ ] @RandyMcMillan
- [ ] @timlucmiptev
2021-03-27 20:02:53 +09:00
wiz
21bb879fc1 Add link to Muun Wallet on About page 2021-03-27 13:12:47 +09:00
wiz
8a97880cdb Merge pull request #408 from knorrium/fix_electrum_dockerfile
fixes to the electrum Dockerfile
2021-03-25 12:45:56 +09:00
Felipe Knorr Kuhn
ca267744a6 fixes to the electrum Dockerfile 2021-03-24 16:24:04 -07:00
wiz
a4253301dc Merge pull request #403 from bitcoincore-dev/makefile
docker: add Makefiles for easier docker deploy
2021-03-24 22:37:18 +09:00
randymcmillan
402c5e3444 deploy: add Makefile for easier docker deploy 2021-03-23 19:57:04 -04:00
softsimon
f12eb333d2 Reuse same i18n string for fee warning tooltip. 2021-03-23 05:18:08 +07:00
wiz
a0b50d7735 Merge pull request #404 from mempool/simon/cpfp-frontend
Visualize the CPFP transactions.
2021-03-22 21:30:00 +09:00
softsimon
3967ce0854 Fix: Compare with tx.feePerVsize to determine if modified fee is the same.
refs #401
2021-03-22 18:24:51 +07:00
softsimon
ed55e86a9d Visualize the CPFP transactions.
fixes #401
2021-03-22 18:04:50 +07:00
softsimon
c93adba276 Merge pull request #402 from mempool/simon/mempool-lazy-delete
Flag transactions for lazy deletion.
2021-03-21 14:58:22 +07:00
softsimon
1ae002385d Merge branch 'simon/cpfp-frontend' into simon/bisq-dashboard
* simon/cpfp-frontend: (46 commits)
  Bugfix: Don't extend already extended transactions to not override the firstSeen property. fixes #390
  Shuffle mempool transactions before saving disk cache. (#398)
  Adding missing return after expressjs response.
  CPFP support (#395)
  Round sat/vB in fee rating tooltip. fixes #364
  Add the GNU AGPLv3 logo to About page
  Update package.json license tags
  Add recommended fee percentile config (#394)
  Fix typo in README (#392)
  Fix icon for Specter Wallet on About page
  Add link to Specter Wallet on our About page
  Add link to WARden Portfolio app as Community Integration on About page
  Delete MIT+CC license from Terms of Service, add AGPLv3 to About page
  Change mempool project license to GNU Affero General Public License v3
  Lower volume for sound effects (#385)
  Improve grammar, layout, and formatting of Terms of Service page
  Display all Project Contributors on About page using GitHub API (#382)
  Modify nginx.conf to cache HTML for 10m and static resources for 1h
  Proxy /api/v1/contributors from mempool.space, also fix HTTP headers
  Add link to Bisq's GitHub repo on About page
  ...
2021-03-21 06:12:41 +07:00
softsimon
e05ca7d691 Flag transactions for lazy deletion.
fixes #400
2021-03-21 06:06:03 +07:00
softsimon
dc36bfcfe4 Adding Bisq markets logo. 2021-03-21 02:40:37 +07:00
softsimon
e688948e42 Bugfix: Don't extend already extended transactions to not override the firstSeen property.
fixes #390
2021-03-19 19:10:11 +07:00
softsimon
5148de8f17 Shuffle mempool transactions before saving disk cache. (#398)
fixes #397
2021-03-19 13:47:37 +07:00
softsimon
6f1cdd0c8b Adding missing return after expressjs response. 2021-03-18 23:53:39 +07:00
softsimon
d3c53c7406 CPFP support (#395)
* CPFP support.

fixes #5
fixes #353
fixes #360

* Use effectiveFeePerVsize for mempool statistics.

* Renaming endpoint cpfp-info to just cpfp.

* Renaming decended to BestDescendant.

* Updating language file with new strings.
2021-03-18 23:47:40 +07:00
softsimon
b2d08d69cf Round sat/vB in fee rating tooltip.
fixes #364
2021-03-18 19:18:59 +07:00
wiz
b85c2a6e0f Merge pull request #396 from mempool/wiz/add-agpl-logo-to-about-page
Add the GNU AGPLv3 logo to About page
2021-03-18 17:48:32 +09:00
wiz
f1f847a9f8 Add the GNU AGPLv3 logo to About page 2021-03-18 17:44:25 +09:00
wiz
8b5d3dabe7 Update package.json license tags 2021-03-18 16:30:10 +09:00
andrewtoth
ac4588cdab Add recommended fee percentile config (#394) 2021-03-18 12:52:46 +07:00
andrewtoth
baa75b77a7 Fix typo in README (#392) 2021-03-18 12:46:16 +07:00
wiz
f2a08444fe Fix icon for Specter Wallet on About page 2021-03-18 01:14:25 +09:00
wiz
c866fbf6df Add link to Specter Wallet on our About page 2021-03-17 22:23:29 +09:00
softsimon
da77dbece1 Bisq markets: General trading volume graph. 2021-03-16 01:17:40 +07:00
wiz
6a07eb0d91 Add link to WARden Portfolio app as Community Integration on About page 2021-03-16 01:56:19 +09:00
wiz
057a96001d Merge pull request #388 from mempool/wiz/change-license-to-agplv3
Change mempool project license to GNU Affero General Public License v3
2021-03-15 06:26:09 +09:00
wiz
f173b17b90 Delete MIT+CC license from Terms of Service, add AGPLv3 to About page 2021-03-15 05:45:53 +09:00
softsimon
8e29a4cefd Bisq markets: Titles 2021-03-14 23:24:06 +07:00
wiz
6b47895aec Change mempool project license to GNU Affero General Public License v3
The files contained in this source code repository are currently
released as "open source" under the terms of the [MIT license](https://opensource.org/licenses/MIT),
with the additional protections of the [Commons Clause License Condition v1](https://commonsclause.com/),
in order to restrict monetization of the mempool app, with the
intended result of mempool remaining free software (as in free
beer) for the Bitcoin community.

However, because of the Commons Clause being added to our license terms,
The Mempool Open Source Project cannot formally be considered as [Free
and open-source software (FOSS)](https://en.wikipedia.org/wiki/Free_and_open-source_software),
according to the generally accepted definition of ["What is free
software?"](https://www.gnu.org/philosophy/free-sw.en.html), and this
has drawn some criticism from the Bitcoin open source community.

Therefore, in order to make The Mempool Open Source Project truly FOSS,
I hereby propose to change our project's license to the [GNU Affero
General Public License v3](https://www.gnu.org/licenses/agpl-3.0.html),
which seems most suitable for a web application. While this won't keep
the mempool free as in free beer, it will keep mempool free as in free
speech, which is what actually matters.

Here is [the TL;DR of AGPLv3](https://tldrlegal.com/license/gnu-affero-general-public-license-v3-(agpl-3.0)):
> The AGPL license differs from the other GNU licenses in that it was
> built for network software. You can distribute modified versions if
> you keep track of the changes and the date you made them. As per usual
> with GNU licenses, you must license derivatives under AGPL. It
> provides the same restrictions and freedoms as the GPLv3 but with an
> additional clause which makes it so that source code must be
> distributed along with web publication. Since web sites and services
> are never distributed in the traditional sense, the AGPL is the GPL of
> the web.

Could all contributors to The Mempool Open Source Project please ACK
this PR?  @softsimon @wiz @bguillaumat @TechMiX @junderw @andrerfneves
@pox @jambolo @6102bitcoin @devinbileck @fiatjaf @timlucmiptev @Czino
@lucasmoten
2021-03-15 00:59:31 +09:00
softsimon
146fcfc16d Bisq markets: Hide altcoins when not in official bisq markets mode 2021-03-14 02:42:14 +07:00
softsimon
308dd2c7ad Bisq markets: Recent trades. Separate Bisq master page. 2021-03-13 18:24:50 +07:00
Jonathan Underwood
4cbf2e0eb4 Lower volume for sound effects (#385)
* Turn down that racket *shakes cane*

* Maybe a little lower

* Maybe 80%?

* 70?

* 30 ok?

* 65 sounds best
2021-03-12 13:20:40 +07:00
softsimon
1d4ed85d50 Bisq markets: Volume and other fixes. 2021-03-10 23:02:55 +07:00
wiz
a530d8b17f Improve grammar, layout, and formatting of Terms of Service page 2021-03-09 14:22:14 +09:00
wiz
e32066affd Display all Project Contributors on About page using GitHub API (#382) 2021-03-09 01:56:41 +07:00
wiz
d5cc558670 Modify nginx.conf to cache HTML for 10m and static resources for 1h
Fixes #61
2021-03-08 18:50:57 +09:00
wiz
a52f98c39d Proxy /api/v1/contributors from mempool.space, also fix HTTP headers
Fixes #366
2021-03-08 18:34:04 +09:00
wiz
7beb832007 Merge pull request #380 from junderw/fixCacheUpdate
Fix bug where legend state is reverted when clicking 1-2 after a 1-minute auto-update.
2021-03-08 16:10:10 +09:00
wiz
3e1c4a7e59 Add link to Bisq's GitHub repo on About page 2021-03-08 12:58:00 +09:00
softsimon
3b8d3221cf Adding enterprise sponsors i18n string. 2021-03-07 21:48:33 +07:00
junderw
b594a9d249 Fix? 2021-03-07 23:45:43 +09:00
softsimon
d20cec4e59 Updating translations from transifex. 2021-03-07 20:13:39 +07:00
softsimon
e5972aa181 Updating transifex. 2021-03-07 20:05:20 +07:00
wiz
b0912064cc Minor tweak of ToS formatting, clarify Bitcoin Only, add 3rd party licenses 2021-03-07 09:37:49 +09:00
wiz
84737bca6e Merge pull request #376 from jambolo/master
Fix mempool-graph legend off-by-one
2021-03-07 03:44:15 +09:00
wiz
14db7e4c8b Update ToS for copyright, mempool.space operator, external link policy (#377)
Update ToS for copyright, mempool.space operator, external link policy
2021-03-05 19:07:31 +07:00
softsimon
d99fd5d59a Bisq markets dashboard: Market backend tracking. WIP. 2021-03-05 15:38:46 +07:00
wiz
9624801716 Add a bit more margin to alliances on About page 2021-03-05 16:33:05 +09:00
John Bolton
904cf62c78 Fixes mempool-graph legend off-by-one
Resolves issue #283.
2021-03-04 23:31:09 -08:00
wiz
92e2df4627 Move the Bisq logo on About page from Integrations to Alliances (#375) 2021-03-05 14:30:08 +07:00
wiz
f157a50952 Update hostname in index.html for stats.mempool.space 2021-03-05 15:19:56 +09:00
wiz
c3927c9f0a Fix community integration links on About page to point to GitHub repos 2021-03-05 13:32:52 +09:00
wiz
45505c86d9 Merge pull request #374 from junderw/showFeeTiles
Show fee tiles on mobile
2021-03-05 11:51:07 +09:00
Jonathan Underwood
4fbab41cc8 Show fee tiles on mobile 2021-03-05 11:28:59 +09:00
softsimon
b2769d2af3 Adding Sparrow wallet to about page. 2021-03-05 02:46:23 +07:00
softsimon
2fca34faaa Bisq markets dashboard: Offers list. WIP. 2021-03-05 02:02:21 +07:00
wiz
8fa672e312 Merge pull request #373 from junderw/betterGraph
Graph hides all fee rates below clicked value
2021-03-04 19:34:30 +09:00
Jonathan Underwood
2c5cf94982 Graph hides all fee rates below clicked value 2021-03-04 19:07:20 +09:00
wiz
72ded16543 Tweak padding/margins on About page logos 2021-03-04 16:27:36 +09:00
wiz
7d67c8ea6e Merge pull request #371 from mempool/wiz/add-stuff-to-about-page
Add community integrations / alliances to About page
2021-03-04 16:12:15 +09:00
wiz
1051919a8a Add BLW and Satpile to About page integrations 2021-03-04 16:07:59 +09:00
wiz
8ca6f06650 Fix i18n tags on new About page titles 2021-03-04 15:47:59 +09:00
wiz
906189c43a Add community integrations / alliances to About page, move us to bottom 2021-03-04 12:46:57 +09:00
wiz
0ba6d651c0 Merge pull request #369 from junderw/hex2utf8
Decode hex into utf8 instead of ascii
2021-03-03 21:37:46 +09:00
Jonathan Underwood
2a7b4f9aed Decode hex into utf8 instead of ascii 2021-03-03 21:29:22 +09:00
wiz
892cebd8f4 Enable sending CORS headers from electrs backend in startup script
Fixes #367
2021-03-03 21:29:18 +09:00
wiz
2e8bd7f32e Put the project title back on the About page 2021-03-03 15:48:55 +09:00
wiz
275895bedd Update index.html <head> metadata, OG tags, twitter tags 2021-03-03 11:55:53 +09:00
wiz
ec699f28fb Update link on About page for mempool Twitter account 2021-03-03 11:21:05 +09:00
softsimon
38e866995f Bisq markets dashboard: 24H Volume. WIP. 2021-02-28 17:18:29 +07:00
wiz
85ad0aaa27 Merge pull request #362 from bguillaumat/update-docker
Update docker part
2021-02-27 14:44:52 +09:00
softsimon
eeb7447988 Bisq markets dashboard. Base views. WIP. 2021-02-27 04:19:56 +07:00
bguillaumat
9e2581d734 Update var from ELECTRS to ELECTRUM for more compatibility 2021-02-26 09:04:14 +01:00
softsimon
be0fd7c582 Credit Hebrew translator 2021-02-25 17:34:21 +07:00
softsimon
26b4bd899b Adding Hebrew language 2021-02-25 17:22:03 +07:00
softsimon
a3d9e87f0e Adding Hebrew language 2021-02-25 17:16:22 +07:00
bguillaumat
4a24a173d3 Update docker README 2021-02-25 10:40:14 +01:00
bguillaumat
05098b1141 Update docker mempool-config 2021-02-25 10:33:04 +01:00
wiz
6a7d5fbe6a Don't start production instances if backend folder doesn't exist 2021-02-25 02:38:38 +09:00
wiz
75b8ec855b Update logo for Liquid network (#359) 2021-02-24 15:16:06 +07:00
wiz
b89630953c Merge pull request #358 from mempool/simon/fee-api-minfee
Send mempoolminfee in fee api.
2021-02-24 16:47:32 +09:00
softsimon
04c42b82f4 Renaming feeApi minimumFee and display as rounded satoshis. 2021-02-24 14:39:34 +07:00
softsimon
6ec07e5315 Re-fixing bug where high priority fee could display as lower than the medium and low fee.
fixes #278
2021-02-24 12:30:40 +07:00
softsimon
ea5dc8738c Send mempoolminfee in fee api.
fixes #357
2021-02-24 12:26:55 +07:00
wiz
619eee9492 Improve production high availability using structured failover and cache 2021-02-23 13:33:52 +09:00
wiz
c9f2bd4029 Update nginx and mempool backend configuration for active failover HA 2021-02-22 20:22:38 +09:00
softsimon
795fb9342a Fix: Double BTC is displayed. 2021-02-21 19:12:50 +07:00
wiz
0b04dbbca2 Merge pull request #352 from mempool/simon/signet-frontend
Signet support in the frontend.
2021-02-21 03:56:46 +09:00
softsimon
55df5dbd35 Signet network color. 2021-02-21 01:45:52 +07:00
wiz
0b79aaaf2f Don't use rust from rustup, use OS package rust instead 2021-02-21 03:44:54 +09:00
wiz
7d858a8abd Modify production startup scripts to support signet 2021-02-21 03:44:33 +09:00
wiz
32af9420dc Update production frontend/backend config to support signet 2021-02-21 03:41:52 +09:00
wiz
7195d6ea31 Update nginx.conf for signet, services, and disable SSR for now 2021-02-21 03:39:19 +09:00
softsimon
a111dc044f Signet should use sBTC not tBTC. 2021-02-21 00:40:47 +07:00
softsimon
563ae8540b Signet support in the frontend. 2021-02-20 23:12:22 +07:00
wiz
279cba5d79 More tweaking of project description on About page 2021-02-18 21:46:16 +09:00
wiz
32c740e572 More tweaking of project description on About page 2021-02-18 21:36:05 +09:00
wiz
28bc08c5a8 Change all usage of <h2> to <h3> on About page 2021-02-18 21:29:15 +09:00
wiz
a0e3468c51 Change 'SNAPSHOT' tag to 'dev' in semver on About page 2021-02-18 21:07:00 +09:00
softsimon
d50e25bed7 Create README.md 2021-02-18 15:40:59 +07:00
wiz
7f8329aa4d Update project name and description on About page (#350) 2021-02-18 15:33:59 +07:00
wiz
6619f92502 Merge pull request #349 from mempool/simon/mempool-space-logo
Updating mempool logo and adding new mempool space logo.
2021-02-18 16:33:00 +09:00
softsimon
edce0d118a Updating mempool logo and adding new mempool space logo. New frontend config OFFICIAL_MEMPOOL_SPACE to enable the latter.
fixes #336
2021-02-18 13:34:05 +07:00
pox
26ba41cb91 a bit of formatting for the docker readme (#348) 2021-02-18 11:11:31 +07:00
Czino
475baf5634 Fix style on block hover (#347)
* Fix style on block hover

* Fix style on block hover

Co-authored-by: Eric Lehmann <eric@machinas.com>
2021-02-18 03:05:39 +07:00
wiz
6866b12e84 Update hard-coded LN node URI for sponsors on About page 2021-02-17 17:16:32 +09:00
softsimon
2743b35ea2 Update from transifex. 2021-02-15 00:15:04 +07:00
softsimon
d39207e097 Adding Telegram group link on about page. 2021-02-14 23:23:03 +07:00
wiz
033d1451d0 Merge pull request #343 from mempool/simon/clear-protection-config
Make clear protection timeout configurable.
2021-02-15 00:26:47 +09:00
wiz
befb192651 Reduce backend heap size setting to 2G since cache memory usage was optimized (#345)
On powerful servers, nodejs automatically sets the limit at 4GB
```
% node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
node heap limit = 4144 Mb
```

On a Raspberry Pi with 8GB RAM, nodejs automatically sets the limit at 1GB
```
% node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
node heap limit = 1048 Mb
```

On a Raspberry Pi with 4GB RAM, nodejs automatically sets the limit at 740MB
```
% node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)'
node heap limit = 739.4694900512695 Mb
```

After testing with manually setting the limit to 768MB, mempool starts
up fine, but crashes when saving the cache when the mempool is quite
large (over 400MB with custom bitcoin.conf setting).

So it's probably safe to reduce the 4GB limit setting to 2GB for
all devices and and just use the automatically set values, now that the
backend's disk cache memory usage was recently optimized.

However, a new npm script for `npm run start-production` will be added
so we can keep our production mempool.space servers running with a very
large bitcoin.conf mempool
2021-02-14 22:25:29 +07:00
softsimon
7489d3360a Make clear protection timeout configurable.
fixes #335
2021-02-14 20:32:00 +07:00
wiz
2641ae0c8e Merge pull request #342 from mempool/simon/optimize-disk-cache
Optimized cache chunks. Default cache files to cache/ directory.
2021-02-14 22:11:33 +09:00
softsimon
32290d1e0d Apply suggestions from code review
Co-authored-by: wiz <j@wiz.biz>
2021-02-14 20:03:45 +07:00
softsimon
584ef87fc8 Optimized cache chunks. Default cache files to /cache directory.
fixes #341
2021-02-14 19:50:31 +07:00
softsimon
63b52b9d9b Use mempool clear protection feature also when in bitcoind mode.
fixes #335
2021-02-14 01:04:44 +07:00
wiz
5f6b7d94b1 Update URL for RoninRojo repo to their self-hosted GitLab 2021-02-12 16:20:57 +09:00
wiz
95a1c002eb Update README with instructions for various installation methods 2021-02-11 14:57:43 +09:00
wiz
2085833720 Fix docker/README example docker-compose.xml to use latest tag 2021-02-10 22:56:42 +09:00
Bastien Guillaumat
20ff62779d Re-implement Docker workflow using GitHub Actions (#326)
* Recreate a docker dir with all docker files inside and add init.sh
* Add docker/README.md with example docker-compose.xml
* Add mysql vars for mempool-config.json
* Port can be set from env var in docker-compose.xml
* Update docker-compose.xml example to use latest tag
* Remove armv7 architecture from build workflow
* Remove master git-hash file
* Remove useless ':' in sed
2021-02-10 22:51:01 +09:00
softsimon
181cb8e03f Removing lightning htlc matching since it has false positives.
refs #324
2021-02-10 19:55:11 +07:00
wiz
cef6bc8345 Enable our GitHub Sponsors program "Sponsor" button 2021-02-10 21:30:16 +09:00
Devin Bileck
a67d82ea94 Fix BSQ token market cap calculation (#332)
Fixes #331
2021-02-10 19:05:16 +07:00
softsimon
89efd410fb Fix for hard coded sponsor url.
refs #319
2021-02-07 03:00:02 +07:00
softsimon
eb0c20dd92 Removing sponsors code.
Support new sponsor confirmation polling.
fixes #319
2021-02-07 02:20:07 +07:00
softsimon
c733497e52 Adding v2.1 screen shot. 2021-02-04 17:58:23 +07:00
wiz
378a56b2c7 Set production electrs scripts to store db in /electrs 2021-02-04 15:53:08 +09:00
wiz
8e42d573ee Modify production electrs scripts to use relative paths from homedir 2021-02-04 12:17:28 +09:00
wiz
a7adf3a345 Bump version number to v2.2-SNAPSHOT 2021-02-04 12:16:47 +09:00
softsimon
ccdf41c5b6 Don't display multisig tag on lightning/liquid contracts.
refs #324
2021-02-03 19:03:59 +07:00
388 changed files with 135601 additions and 68639 deletions

4
.github/FUNDING.yml vendored
View File

@@ -1,6 +1,6 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: ['mempool'] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://mempool.space/about'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: ['https://mempool.space/sponsor'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

77
.github/workflows/cypress.yml vendored Normal file
View File

@@ -0,0 +1,77 @@
name: Cypress Tests
on: [push, pull_request]
jobs:
cypress:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4, 5]
os: ["ubuntu-latest"]
browser: [chrome]
name: E2E tests on ${{ matrix.browser }} - ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: ${{ matrix.browser }} browser tests (Mempool)
uses: cypress-io/github-action@v2
with:
working-directory: frontend
build: npm run config:defaults:mempool
start: npm run start:local-prod
wait-on: 'http://localhost:4200'
wait-on-timeout: 120
record: true
parallel: true
env: BASE_MODULE=mempool
group: Tests on ${{ matrix.browser }} (Mempool)
browser: ${{ matrix.browser }}
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
- name: ${{ matrix.browser }} browser tests (Liquid)
uses: cypress-io/github-action@v2
if: always()
with:
working-directory: frontend
build: npm run config:defaults:liquid
start: npm run start:local-prod
wait-on: 'http://localhost:4200'
wait-on-timeout: 120
record: true
parallel: true
spec: cypress/integration/liquid/liquid.spec.ts
env: BASE_MODULE=liquid
group: Tests on ${{ matrix.browser }} (Liquid)
browser: ${{ matrix.browser }}
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
- name: ${{ matrix.browser }} browser tests (Bisq)
uses: cypress-io/github-action@v2
if: always()
with:
working-directory: frontend
build: npm run config:defaults:bisq
start: npm run start:local-prod
wait-on: 'http://localhost:4200'
wait-on-timeout: 120
record: true
parallel: true
spec: cypress/integration/bisq/bisq.spec.ts
env: BASE_MODULE=bisq
group: Tests on ${{ matrix.browser }} (Bisq)
browser: ${{ matrix.browser }}
ci-build-id: '${{ github.sha }}-${{ github.workflow }}-${{ github.event_name }}'
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}

View File

@@ -27,6 +27,9 @@ jobs:
- name: Show set environment variables
run: |
printf " TAG: %s\n" "$TAG"
- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
- name: Login to Docker for building
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
@@ -34,6 +37,9 @@ jobs:
- name: Checkout project
uses: actions/checkout@v2
- name: Init repo for Dockerization
run: docker/init.sh "$TAG"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
id: qemu
@@ -61,14 +67,6 @@ jobs:
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--tag ${{ secrets.DOCKER_HUB_USER }}/${{ matrix.service }}:$TAG \
--output "type=registry" ./${{ matrix.service }}/
- name: Run Docker buildx for ${{ matrix.service }} against latest
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--tag ${{ secrets.DOCKER_HUB_USER }}/${{ matrix.service }}:latest \
--output "type=registry" ./${{ matrix.service }}/
--output "type=registry" ./${{ matrix.service }}/ \
--build-arg commitHash=$SHORT_SHA

3
.gitignore vendored
View File

@@ -1 +1,4 @@
sitemap
data
docker-compose.yml
backend/mempool-config.json

4
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"editor.tabSize": 2,
"typescript.tsdk": "./backend/node_modules/typescript/lib"
}

48
GNUmakefile Executable file
View File

@@ -0,0 +1,48 @@
# If you see pwd_unknown showing up check permissions
PWD ?= pwd_unknown
# DATABASE DEPLOY FOLDER CONFIG - default ./data
ifeq ($(data),)
DATA := data
export DATA
else
DATA := $(data)
export DATA
endif
.PHONY: help
help:
@echo ''
@echo ''
@echo ' Usage: make [COMMAND]'
@echo ''
@echo ' make all # build init mempool and electrs'
@echo ' make init # setup some useful configs'
@echo ' make mempool # build q dockerized mempool.space'
@echo ' make electrs # build a docker electrs image'
@echo ''
.PHONY: init
init:
@echo ''
mkdir -p $(DATA) $(DATA)/mysql $(DATA)/mysql/db-scripts $(DATA)/mysql/data
install -v mariadb-structure.sql $(DATA)/mysql/db-scripts
#REF: https://github.com/mempool/mempool/blob/master/docker/README.md
cat docker/docker-compose.yml > docker-compose.yml
cat backend/mempool-config.sample.json > backend/mempool-config.json
.PHONY: mempool
mempool: init
@echo ''
docker-compose up --force-recreate --always-recreate-deps
@echo ''
.PHONY: electrs
electrum:
#REF: https://hub.docker.com/r/beli/electrum
@echo ''
docker build -f docker/electrum/Dockerfile .
@echo ''
.PHONY: all
all: init
make mempool
#######################
-include Makefile

52
LICENSE
View File

@@ -1,35 +1,29 @@
MIT License with Commons Clause License Condition v1.0
The Mempool Open Source Project
Copyright (c) 2019-2021 The Mempool Open Source Project Developers
Copyright (c) 2019-2020 The Mempool Open Source Project
This program is free software; you can redistribute it and/or modify it under
the terms of (at your option) either:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, and/or sublicense
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
1) the GNU Affero General Public License as published by the Free Software
Foundation, either version 3 of the License or any later version approved by a
proxy statement published on <https://mempool.space/about>; or
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
2) the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License or any later version approved by a
proxy statement published on <https://mempool.space/about>.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
However, this copyright license does not include an implied right or license to
use our trademarks: The Mempool Open Source Project™, mempool.space™, the
mempool Logo™, the mempool.space Vertical Logo™, the mempool.space Horizontal
Logo™, the mempool Square Logo™, and the mempool Blocks logo™ are registered
trademarks or trademarks of Mempool Space K.K in Japan, the United States,
and/or other countries. See our full Trademark Policy and Guidelines for more
details, published on <https://mempool.space/trademark-policy>.
Commons Clause License Condition v1.0
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the full license terms for more details.
Without limiting other conditions in the License, the grant of rights under
the License will not include, and the License does not grant to you, the
right to Sell the Software.
For purposes of the foregoing, “Sell” means practicing any or all of the
rights granted to you under the License to provide to third parties, for a
fee or other consideration (including without limitation fees for hosting or
consulting/ support services related to the Software), a product or service
whose value derives, entirely or substantially, from the functionality of
the Software. Any license notice or attribution required by the License must
also include this Commons Cause License Condition notice.
You should have received a copy of both the GNU Affero General Public License
and the GNU General Public License along with this program. If not, see
<http://www.gnu.org/licenses/>.

660
LICENSE.AGPL-3.md Normal file
View File

@@ -0,0 +1,660 @@
### GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains
free software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing
under this license.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public
License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your
version supports such interaction) an opportunity to receive the
Corresponding Source of your version by providing access to the
Corresponding Source from a network server at no charge, through some
standard or customary means of facilitating copying of software. This
Corresponding Source shall include the Corresponding Source for any
work covered by version 3 of the GNU General Public License that is
incorporated pursuant to the following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Affero General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever
published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper
mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for
the specific requirements.
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU AGPL, see <https://www.gnu.org/licenses/>.

675
LICENSE.GPL-3.md Normal file
View File

@@ -0,0 +1,675 @@
### GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc.
<https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
### Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program--to make sure it remains
free software for all its users. We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors. You can apply
it to your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
### TERMS AND CONDITIONS
#### 0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a "modified version" of
the earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
An interactive user interface displays "Appropriate Legal Notices" to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
#### 1. Source Code.
The "source code" for a work means the preferred form of the work for
making modifications to it. "Object code" means any non-source form of
a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same
work.
#### 2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10 makes
it unnecessary.
#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
#### 4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
#### 5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
- a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
- b) The work must carry prominent notices stating that it is
released under this License and any conditions added under
section 7. This requirement modifies the requirement in section 4
to "keep intact all notices".
- c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
- d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
#### 6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
- a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
- b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the Corresponding
Source from a network server at no charge.
- c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
- d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
- e) Convey the object code using peer-to-peer transmission,
provided you inform other peers where the object code and
Corresponding Source of the work are being offered to the general
public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
"normally used" refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
#### 7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
- a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
- b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
- c) Prohibiting misrepresentation of the origin of that material,
or requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
- d) Limiting the use for publicity purposes of names of licensors
or authors of the material; or
- e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
- f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions
of it) with contractual assumptions of liability to the recipient,
for any liability that these contractual assumptions directly
impose on those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
#### 8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
#### 9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
#### 10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
#### 11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
#### 12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree to
terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
#### 13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
#### 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in
detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If the
Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free
Software Foundation.
If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
#### 15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
#### 16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#### 17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
### How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively state
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper
mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands \`show w' and \`show c' should show the
appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an "about box".
You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. For more information on this, and how to apply and follow
the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the
GNU Lesser General Public License instead of this License. But first,
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.

1
Makefile Normal file
View File

@@ -0,0 +1 @@
# For additional configs/scripting

View File

@@ -1,10 +1,22 @@
# The Mempool Open Source Project
Mempool is the fully featured mempool visualizer and block explorer website and API service running on [mempool.space](https://mempool.space/). The instructions below are for most users at home running on low-powered Raspberry Pi devices, but if you want to run a production website on a powerful server, see the [production setup guide](https://github.com/mempool/mempool/tree/master/production)
Mempool is the fully featured visualizer, explorer, and API service running on [mempool.space](https://mempool.space/), an open source project developed and operated for the benefit of the Bitcoin community, with a focus on the emerging transaction fee market to help our transition into a multi-layer ecosystem.
![mempool](https://pbs.twimg.com/media/Ei8p_flUcAEjfXE?format=jpg&name=4096x4096)
![mempool](https://mempool.space/resources/screenshots/v2.2.0-dashboard.png)
# Installation
## Installation Methods
Mempool can be self-hosted on a wide variety of your own hardware, ranging from a simple one-click installation on a Raspberry Pi distro, all the way to an advanced high availability cluster of powerful servers for a production instance. We support the following installation methods, ranked in order from simple to advanced:
1) One-click installation on: [Umbrel](https://github.com/getumbrel/umbrel), [RaspiBlitz](https://github.com/rootzoll/raspiblitz), [RoninDojo](https://code.samourai.io/ronindojo/RoninDojo), or [MyNode](https://github.com/mynodebtc/mynode).
2) [Docker installation on Linux using docker-compose](https://github.com/mempool/mempool/tree/master/docker)
3) [Manual installation on Linux or FreeBSD](https://github.com/mempool/mempool#manual-installation)
4) [Production installation on a powerful FreeBSD server](https://github.com/mempool/mempool/tree/master/production)
5) [High Availability cluster using powerful FreeBSD servers](https://github.com/mempool/mempool/tree/master/production#high-availability)
# Manual Installation
The following instructions are for a manual installation on Linux or FreeBSD. The file and directory paths may need to be changed to match your OS.
## Dependencies
@@ -67,7 +79,7 @@ Install mempool dependencies from npm and build the backend:
```bash
# backend
cd ../backend/
cd backend
npm install
npm run build
```
@@ -155,7 +167,7 @@ Install mempool dependencies from npm and build the frontend static HTML/CSS/JS:
Install the output into nginx webroot folder:
```bash
sudo rsync -av --delete dist/mempool/ /var/www/html/
sudo rsync -av --delete dist/mempool /var/www/
```
## nginx + certbot
@@ -167,7 +179,7 @@ Install the supplied nginx.conf and nginx-mempool.conf in /etc/nginx
apt-get install -y nginx python-certbot-nginx
# install the mempool configuration for nginx
cp nginx.conf nginx-mempool.conf /etc/nginx/nginx.conf
cp nginx.conf nginx-mempool.conf /etc/nginx/
# replace example.com with your domain name
certbot --nginx -d example.com

11
backend/.gitignore vendored
View File

@@ -41,14 +41,3 @@ testem.log
#System Files
.DS_Store
Thumbs.db
cache.json
cache1.json
cache2.json
cache3.json
cache4.json
cache5.json
cache6.json
cache7.json
cache8.json
cache9.json

4
backend/.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,4 @@
{
"editor.tabSize": 2,
"typescript.tsdk": "../backend/node_modules/typescript/lib"
}

1
backend/cache/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.json

View File

@@ -1 +0,0 @@
9d02ab1eb5ffb60d38128df903e47e11b95f13d5

View File

@@ -6,7 +6,13 @@
"SPAWN_CLUSTER_PROCS": 0,
"API_URL_PREFIX": "/api/v1/",
"POLL_RATE_MS": 2000,
"CACHE_DIR": "./"
"CACHE_DIR": "./cache",
"CLEAR_PROTECTION_MINUTES": 20,
"RECOMMENDED_FEE_PERCENTILE": 50,
"BLOCK_WEIGHT_UNITS": 4000000,
"INITIAL_BLOCKS_AMOUNT": 8,
"MEMPOOL_BLOCKS_AMOUNT": 8,
"PRICE_FEED_UPDATE_INTERVAL": 3600
},
"CORE_RPC": {
"HOST": "127.0.0.1",
@@ -37,23 +43,19 @@
"USERNAME": "mempool",
"PASSWORD": "mempool"
},
"SYSLOG": {
"ENABLED": true,
"HOST": "127.0.0.1",
"PORT": 514,
"MIN_PRIORITY": "info",
"FACILITY": "local7"
},
"STATISTICS": {
"ENABLED": true,
"TX_PER_SECOND_SAMPLE_PERIOD": 150
},
"BISQ_BLOCKS": {
"ENABLED": false,
"DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db/json"
},
"BISQ_MARKETS": {
"BISQ": {
"ENABLED": false,
"DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db"
},
"SPONSORS": {
"ENABLED": false,
"BTCPAY_URL": "",
"BTCPAY_AUTH": "",
"BTCPAY_WEBHOOK_URL": "",
"TWITTER_BEARER_AUTH": ""
}
}

View File

@@ -1,32 +1,32 @@
{
"name": "mempool-backend",
"version": "2.0.0",
"version": "2.2.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mempool-backend",
"version": "2.0.0",
"license": "MIT",
"version": "2.2.2",
"license": "GNU Affero General Public License v3.0",
"dependencies": {
"@mempool/bitcoin": "^3.0.2",
"@mempool/bitcoin": "^3.0.3",
"@mempool/electrum-client": "^1.1.7",
"axios": "^0.21.1",
"bitcoinjs-lib": "^5.2.0",
"crypto-js": "^4.0.0",
"express": "^4.17.1",
"locutus": "^2.0.12",
"mysql2": "^2.2.5",
"node-worker-threads-pool": "^1.4.2",
"ws": "^7.3.1"
"mysql2": "2.2.5",
"node-worker-threads-pool": "^1.4.3",
"ws": "^7.4.6"
},
"devDependencies": {
"@types/compression": "^1.0.1",
"@types/express": "^4.17.2",
"@types/locutus": "^0.0.6",
"@types/ws": "^6.0.4",
"tslint": "~6.1.0",
"typescript": "~3.9.7"
"@types/ws": "^7.4.4",
"tslint": "^6.1.0",
"typescript": "4.4.2"
}
},
"node_modules/@babel/code-frame": {
@@ -56,9 +56,9 @@
}
},
"node_modules/@mempool/bitcoin": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.2.tgz",
"integrity": "sha512-WNHFTDJEEBmakSPAbrJ933mGgm1uYxmOElyQYZVW7D7CRUd8mKek+QlViin63e71vyfMVOGXtWwSb87dxghggQ==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.3.tgz",
"integrity": "sha512-10UdbwchnevlebDTN+Xhv75AEhDmTMy9UgWHlqx5MG2mheFG6+eqmtHsdxeYnv3IAtTtlRfA6fY0RbV/x4TNFQ==",
"engines": {
"node": ">= 0.10.0"
}
@@ -163,10 +163,11 @@
}
},
"node_modules/@types/ws": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.4.tgz",
"integrity": "sha512-PpPrX7SZW9re6+Ha8ojZG4Se8AZXgf0GK6zmfqEuCsY49LFDNXO3SByp44X3dFEqtB73lkCDAdUazhAjVPiNwg==",
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.4.tgz",
"integrity": "sha512-d/7W23JAXPodQNbOZNXvl2K+bqAQrCMwlh/nuQsPSQk6Fq0opHoPrUw43aHsvSbIiQPr8Of2hkFbnz1XBFVyZQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*"
}
@@ -548,17 +549,17 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"node_modules/elliptic": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"version": "6.5.4",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
"dependencies": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"bn.js": "^4.11.9",
"brorand": "^1.1.0",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
"hmac-drbg": "^1.0.1",
"inherits": "^2.0.4",
"minimalistic-assert": "^1.0.1",
"minimalistic-crypto-utils": "^1.0.1"
}
},
"node_modules/encodeurl": {
@@ -569,11 +570,6 @@
"node": ">= 0.8"
}
},
"node_modules/es6-promise": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -895,14 +891,11 @@
}
},
"node_modules/locutus": {
"version": "2.0.14",
"resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.14.tgz",
"integrity": "sha512-0H1o1iHNEp3kJ5rW57bT/CAP5g6Qm0Zd817Wcx2+rOMTYyIJoc482Ja1v9dB6IUjwvWKcBNdYi7x2lRXtlJ3bA==",
"dependencies": {
"es6-promise": "^4.2.5"
},
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.15.tgz",
"integrity": "sha512-2xWC4RkoAoCVXEb/stzEgG1TNgd+mrkLBj6TuEDNyUoKeQ2XzDTyJUC23sMiqbL6zJmJSP3w59OZo+zc4IBOmA==",
"engines": {
"node": ">= 0.12.0"
"node": ">= 10"
}
},
"node_modules/long": {
@@ -1480,10 +1473,11 @@
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
},
"node_modules/typescript": {
"version": "3.9.7",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
"integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -1544,9 +1538,9 @@
"dev": true
},
"node_modules/ws": {
"version": "7.4.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz",
"integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA==",
"version": "7.4.6",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
"engines": {
"node": ">=8.3.0"
},
@@ -1597,9 +1591,9 @@
}
},
"@mempool/bitcoin": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.2.tgz",
"integrity": "sha512-WNHFTDJEEBmakSPAbrJ933mGgm1uYxmOElyQYZVW7D7CRUd8mKek+QlViin63e71vyfMVOGXtWwSb87dxghggQ=="
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@mempool/bitcoin/-/bitcoin-3.0.3.tgz",
"integrity": "sha512-10UdbwchnevlebDTN+Xhv75AEhDmTMy9UgWHlqx5MG2mheFG6+eqmtHsdxeYnv3IAtTtlRfA6fY0RbV/x4TNFQ=="
},
"@mempool/electrum-client": {
"version": "1.1.8",
@@ -1698,9 +1692,9 @@
}
},
"@types/ws": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-6.0.4.tgz",
"integrity": "sha512-PpPrX7SZW9re6+Ha8ojZG4Se8AZXgf0GK6zmfqEuCsY49LFDNXO3SByp44X3dFEqtB73lkCDAdUazhAjVPiNwg==",
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.4.tgz",
"integrity": "sha512-d/7W23JAXPodQNbOZNXvl2K+bqAQrCMwlh/nuQsPSQk6Fq0opHoPrUw43aHsvSbIiQPr8Of2hkFbnz1XBFVyZQ==",
"dev": true,
"requires": {
"@types/node": "*"
@@ -2042,17 +2036,17 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"elliptic": {
"version": "6.5.3",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz",
"integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==",
"version": "6.5.4",
"resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
"integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==",
"requires": {
"bn.js": "^4.4.0",
"brorand": "^1.0.1",
"bn.js": "^4.11.9",
"brorand": "^1.1.0",
"hash.js": "^1.0.0",
"hmac-drbg": "^1.0.0",
"inherits": "^2.0.1",
"minimalistic-assert": "^1.0.0",
"minimalistic-crypto-utils": "^1.0.0"
"hmac-drbg": "^1.0.1",
"inherits": "^2.0.4",
"minimalistic-assert": "^1.0.1",
"minimalistic-crypto-utils": "^1.0.1"
}
},
"encodeurl": {
@@ -2060,11 +2054,6 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
},
"es6-promise": {
"version": "4.2.8",
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
"integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -2321,12 +2310,9 @@
}
},
"locutus": {
"version": "2.0.14",
"resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.14.tgz",
"integrity": "sha512-0H1o1iHNEp3kJ5rW57bT/CAP5g6Qm0Zd817Wcx2+rOMTYyIJoc482Ja1v9dB6IUjwvWKcBNdYi7x2lRXtlJ3bA==",
"requires": {
"es6-promise": "^4.2.5"
}
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/locutus/-/locutus-2.0.15.tgz",
"integrity": "sha512-2xWC4RkoAoCVXEb/stzEgG1TNgd+mrkLBj6TuEDNyUoKeQ2XzDTyJUC23sMiqbL6zJmJSP3w59OZo+zc4IBOmA=="
},
"long": {
"version": "4.0.0",
@@ -2785,9 +2771,9 @@
"integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g=="
},
"typescript": {
"version": "3.9.7",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
"integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
"dev": true
},
"unpipe": {
@@ -2833,9 +2819,9 @@
"dev": true
},
"ws": {
"version": "7.4.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.2.tgz",
"integrity": "sha512-T4tewALS3+qsrpGI/8dqNMLIVdq/g/85U98HPMa6F0m6xTbvhXU6RCQLqPH3+SlomNV/LdY6RXEbBpMH6EOJnA==",
"version": "7.4.6",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
"requires": {}
},
"yallist": {

View File

@@ -1,8 +1,8 @@
{
"name": "mempool-backend",
"version": "2.0.0",
"version": "2.2.2",
"description": "Bitcoin mempool visualizer and blockchain explorer backend",
"license": "MIT",
"license": "GNU Affero General Public License v3.0",
"homepage": "https://mempool.space",
"repository": {
"type": "git",
@@ -23,11 +23,12 @@
"ng": "./node_modules/@angular/cli/bin/ng",
"tsc": "./node_modules/typescript/bin/tsc",
"build": "npm run tsc",
"start": "node --max-old-space-size=4096 dist/index.js",
"start": "node --max-old-space-size=2048 dist/index.js",
"start-production": "node --max-old-space-size=4096 dist/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"@mempool/bitcoin": "^3.0.2",
"@mempool/bitcoin": "^3.0.3",
"@mempool/electrum-client": "^1.1.7",
"axios": "^0.21.1",
"bitcoinjs-lib": "^5.2.0",
@@ -35,15 +36,15 @@
"express": "^4.17.1",
"locutus": "^2.0.12",
"mysql2": "2.2.5",
"node-worker-threads-pool": "^1.4.2",
"ws": "^7.3.1"
"node-worker-threads-pool": "^1.4.3",
"ws": "^7.4.6"
},
"devDependencies": {
"@types/compression": "^1.0.1",
"@types/express": "^4.17.2",
"@types/locutus": "^0.0.6",
"@types/ws": "^6.0.4",
"tslint": "~6.1.0",
"typescript": "~3.9.7"
"@types/ws": "^7.4.4",
"tslint": "^6.1.0",
"typescript": "4.4.2"
}
}

View File

@@ -1,20 +1,24 @@
import * as fs from 'fs';
import * as os from 'os';
import logger from '../logger';
import { IBackendInfo } from '../mempool.interfaces';
class BackendInfo {
gitCommitHash = '';
hostname = '';
private gitCommitHash = '';
private hostname = '';
private version = '';
constructor() {
this.setLatestCommitHash();
this.setVersion();
this.hostname = os.hostname();
}
public getBackendInfo() {
public getBackendInfo(): IBackendInfo {
return {
'hostname': this.hostname,
'git-commit': this.gitCommitHash,
hostname: this.hostname,
gitCommit: this.gitCommitHash,
version: this.version,
};
}
@@ -26,7 +30,16 @@ class BackendInfo {
try {
this.gitCommitHash = fs.readFileSync('../.git/refs/heads/master').toString().trim();
} catch (e) {
logger.err('Could not load git commit info: ' + e.message || e);
logger.err('Could not load git commit info: ' + (e instanceof Error ? e.message : e));
}
}
private setVersion(): void {
try {
const packageJson = fs.readFileSync('package.json').toString();
this.version = JSON.parse(packageJson).version;
} catch (e) {
throw new Error(e instanceof Error ? e.message : 'Error');
}
}
}

View File

@@ -8,9 +8,10 @@ import { StaticPool } from 'node-worker-threads-pool';
import logger from '../../logger';
class Bisq {
private static BLOCKS_JSON_FILE_PATH = config.BISQ_BLOCKS.DATA_PATH + '/all/blocks.json';
private static BLOCKS_JSON_FILE_PATH = config.BISQ.DATA_PATH + '/json/all/blocks.json';
private latestBlockHeight = 0;
private blocks: BisqBlock[] = [];
private allBlocks: BisqBlock[] = [];
private transactions: BisqTransaction[] = [];
private transactionIndex: { [txId: string]: BisqTransaction } = {};
private blockIndex: { [hash: string]: BisqBlock } = {};
@@ -98,7 +99,7 @@ class Bisq {
this.topDirectoryWatcher.close();
}
let fsWait: NodeJS.Timeout | null = null;
this.topDirectoryWatcher = fs.watch(config.BISQ_BLOCKS.DATA_PATH, () => {
this.topDirectoryWatcher = fs.watch(config.BISQ.DATA_PATH + '/json', () => {
if (fsWait) {
clearTimeout(fsWait);
}
@@ -126,7 +127,7 @@ class Bisq {
return;
}
let fsWait: NodeJS.Timeout | null = null;
this.subdirectoryWatcher = fs.watch(config.BISQ_BLOCKS.DATA_PATH + '/all', () => {
this.subdirectoryWatcher = fs.watch(config.BISQ.DATA_PATH + '/json/all', () => {
if (fsWait) {
clearTimeout(fsWait);
}
@@ -161,7 +162,7 @@ class Bisq {
this.buildIndex();
this.calculateStats();
} catch (e) {
logger.err('loadBisqDumpFile() error.' + e.message || e);
logger.info('loadBisqDumpFile() error.' + (e instanceof Error ? e.message : e));
}
}
@@ -171,7 +172,7 @@ class Bisq {
this.transactionIndex = {};
this.addressIndex = {};
this.blocks.forEach((block) => {
this.allBlocks.forEach((block) => {
/* Build block index */
if (!this.blockIndex[block.hash]) {
this.blockIndex[block.hash] = block;
@@ -245,9 +246,10 @@ class Bisq {
if (cacheData && cacheData.length !== 0) {
logger.debug('Processing Bisq data dump...');
const data: BisqBlocks = await this.jsonParsePool.exec(cacheData);
if (data.blocks && data.blocks.length !== this.blocks.length) {
this.blocks = data.blocks.filter((block) => block.txs.length > 0);
this.blocks.reverse();
if (data.blocks && data.blocks.length !== this.allBlocks.length) {
this.allBlocks = data.blocks;
this.allBlocks.reverse();
this.blocks = this.allBlocks.filter((block) => block.txs.length > 0);
this.latestBlockHeight = data.chainHeight;
const time = new Date().getTime() - start;
logger.debug('Bisq dump processed in ' + time + ' ms (worker thread)');

View File

@@ -457,6 +457,30 @@ class BisqMarketsApi {
}
}
getVolumesByTime(time: number): MarketVolume[] {
const timestamp_from = new Date().getTime() / 1000 - time;
const timestamp_to = new Date().getTime() / 1000;
const trades = this.getTradesByCriteria(undefined, timestamp_to, timestamp_from,
undefined, undefined, undefined, 'asc', Number.MAX_SAFE_INTEGER);
const markets: any = {};
for (const trade of trades) {
if (!markets[trade._market]) {
markets[trade._market] = {
'volume': 0,
'num_trades': 0,
};
}
markets[trade._market]['volume'] += this.fiatCurrenciesIndexed[trade.currency] ? trade._tradeAmount : trade._tradeVolume;
markets[trade._market]['num_trades']++;
}
return markets;
}
private getTradesSummarized(trades: TradesData[], timestamp_from: number, interval?: string): SummarizedIntervals {
const intervals: any = {};
const intervals_prices: any = {};

View File

@@ -6,7 +6,7 @@ import logger from '../../logger';
class Bisq {
private static FOLDER_WATCH_CHANGE_DETECTION_DEBOUNCE = 4000;
private static MARKET_JSON_PATH = config.BISQ_MARKETS.DATA_PATH;
private static MARKET_JSON_PATH = config.BISQ.DATA_PATH;
private static MARKET_JSON_FILE_PATHS = {
activeCryptoCurrency: '/active_crypto_currency_list.json',
activeFiatCurrency: '/active_fiat_currency_list.json',
@@ -102,7 +102,7 @@ class Bisq {
logger.debug('Bisq market data updated in ' + time + ' ms');
}
} catch (e) {
logger.err('loadBisqMarketDataDumpFile() error.' + e.message || e);
logger.err('loadBisqMarketDataDumpFile() error.' + (e instanceof Error ? e.message : e));
}
}

View File

@@ -3,10 +3,10 @@ import { IEsploraApi } from './esplora-api.interface';
export interface AbstractBitcoinApi {
$getRawMempool(): Promise<IEsploraApi.Transaction['txid'][]>;
$getRawTransaction(txId: string, skipConversion?: boolean, addPrevout?: boolean): Promise<IEsploraApi.Transaction>;
$getRawTransactionBitcoind(txId: string, skipConversion?: boolean, addPrevout?: boolean): Promise<IEsploraApi.Transaction>;
$getBlockHeightTip(): Promise<number>;
$getTxIdsForBlock(hash: string): Promise<string[]>;
$getBlockHash(height: number): Promise<string>;
$getBlockHeader(hash: string): Promise<string>;
$getBlock(hash: string): Promise<IEsploraApi.Block>;
$getAddress(address: string): Promise<IEsploraApi.Address>;
$getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]>;

View File

@@ -98,12 +98,15 @@ export namespace IBitcoinApi {
export interface AddressInformation {
isvalid: boolean; // (boolean) If the address is valid or not. If not, this is the only property returned.
isvalid_parent?: boolean; // (boolean) Elements only
address: string; // (string) The bitcoin address validated
scriptPubKey: string; // (string) The hex-encoded scriptPubKey generated by the address
isscript: boolean; // (boolean) If the key is a script
iswitness: boolean; // (boolean) If the address is a witness
witness_version?: boolean; // (numeric, optional) The version number of the witness program
witness_program: string; // (string, optional) The hex value of the witness program
confidential_key?: string; // (string) Elements only
unconfidential?: string; // (string) Elements only
}
export interface ChainTips {
@@ -113,4 +116,46 @@ export namespace IBitcoinApi {
status: 'invalid' | 'headers-only' | 'valid-headers' | 'valid-fork' | 'active';
}
export interface BlockchainInfo {
chain: number; // (string) current network name as defined in BIP70 (main, test, regtest)
blocks: number; // (numeric) the current number of blocks processed in the server
headers: number; // (numeric) the current number of headers we have validated
bestblockhash: string, // (string) the hash of the currently best block
difficulty: number; // (numeric) the current difficulty
mediantime: number; // (numeric) median time for the current best block
verificationprogress: number; // (numeric) estimate of verification progress [0..1]
initialblockdownload: boolean; // (bool) (debug information) estimate of whether this node is in Initial Block Download mode.
chainwork: string // (string) total amount of work in active chain, in hexadecimal
size_on_disk: number; // (numeric) the estimated size of the block and undo files on disk
pruned: number; // (boolean) if the blocks are subject to pruning
pruneheight: number; // (numeric) lowest-height complete block stored (only present if pruning is enabled)
automatic_pruning: number; // (boolean) whether automatic pruning is enabled (only present if pruning is enabled)
prune_target_size: number; // (numeric) the target size used by pruning (only present if automatic pruning is enabled)
softforks: SoftFork[]; // (array) status of softforks in progress
bip9_softforks: { [name: string]: Bip9SoftForks[] } // (object) status of BIP9 softforks in progress
warnings: string; // (string) any network and blockchain warnings.
}
interface SoftFork {
id: string; // (string) name of softfork
version: number; // (numeric) block version
reject: { // (object) progress toward rejecting pre-softfork blocks
status: boolean; // (boolean) true if threshold reached
},
}
interface Bip9SoftForks {
status: number; // (string) one of defined, started, locked_in, active, failed
bit: number; // (numeric) the bit (0-28) in the block version field used to signal this softfork (only for started status)
startTime: number; // (numeric) the minimum median time past of a block at which the bit gains its meaning
timeout: number; // (numeric) the median time past of a block at which the deployment is considered failed if not yet locked in
since: number; // (numeric) height of the first block to which the status applies
statistics: { // (object) numeric statistics about BIP9 signalling for a softfork (only for started status)
period: number; // (numeric) the length in blocks of the BIP9 signalling period
threshold: number; // (numeric) the number of blocks with the version bit set required to activate the feature
elapsed: number; // (numeric) the number of blocks elapsed since the beginning of the current period
count: number; // (numeric) the number of blocks with the version bit set in the current period
possible: boolean; // (boolean) returns false if there are not enough blocks left in this period to pass activation threshold
}
}
}

View File

@@ -22,16 +22,6 @@ class BitcoinApi implements AbstractBitcoinApi {
});
}
$getRawTransactionBitcoind(txId: string, skipConversion = false, addPrevout = false): Promise<IEsploraApi.Transaction> {
return this.bitcoindClient.getRawTransaction(txId, true)
.then((transaction: IBitcoinApi.Transaction) => {
if (skipConversion) {
return transaction;
}
return this.$convertTransaction(transaction, addPrevout);
});
}
$getRawTransaction(txId: string, skipConversion = false, addPrevout = false): Promise<IEsploraApi.Transaction> {
// If the transaction is in the mempool we already converted and fetched the fee. Only prevouts are missing
const txInMempool = mempool.getMempool()[txId];
@@ -47,6 +37,9 @@ class BitcoinApi implements AbstractBitcoinApi {
return this.bitcoindClient.getRawTransaction(txId, true)
.then((transaction: IBitcoinApi.Transaction) => {
if (skipConversion) {
transaction.vout.forEach((vout) => {
vout.value = vout.value * 100000000;
});
return transaction;
}
return this.$convertTransaction(transaction, addPrevout);
@@ -63,10 +56,18 @@ class BitcoinApi implements AbstractBitcoinApi {
.then((rpcBlock: IBitcoinApi.Block) => rpcBlock.tx);
}
$getRawBlock(hash: string): Promise<string> {
return this.bitcoindClient.getBlock(hash, 0);
}
$getBlockHash(height: number): Promise<string> {
return this.bitcoindClient.getBlockHash(height);
}
$getBlockHeader(hash: string): Promise<string> {
return this.bitcoindClient.getBlockHeader(hash, false);
}
async $getBlock(hash: string): Promise<IEsploraApi.Block> {
const foundBlock = blocks.getBlocks().find((block) => block.id === hash);
if (foundBlock) {
@@ -154,6 +155,9 @@ class BitcoinApi implements AbstractBitcoinApi {
esploraTransaction = await this.$calculateFeeFromInputs(esploraTransaction, addPrevout);
} else {
esploraTransaction = await this.$appendMempoolFeeData(esploraTransaction);
if (addPrevout) {
esploraTransaction = await this.$calculateFeeFromInputs(esploraTransaction, addPrevout);
}
}
return esploraTransaction;
@@ -233,10 +237,6 @@ class BitcoinApi implements AbstractBitcoinApi {
});
}
protected $validateAddress(address: string): Promise<IBitcoinApi.AddressInformation> {
return this.bitcoindClient.validateAddress(address);
}
private $getMempoolEntry(txid: string): Promise<IBitcoinApi.MempoolEntry> {
return this.bitcoindClient.getMempoolEntry(txid);
}

View File

@@ -40,6 +40,14 @@ class BitcoinBaseApi {
}
return this.bitcoindClient.getMempoolInfo();
}
$getBlockchainInfo(): Promise<IBitcoinApi.BlockchainInfo> {
return this.bitcoindClient.getBlockchainInfo();
}
$validateAddress(address: string): Promise<IBitcoinApi.AddressInformation> {
return this.bitcoindClient.validateAddress(address);
}
}
export default new BitcoinBaseApi();

View File

@@ -11,6 +11,7 @@ import * as sha256 from 'crypto-js/sha256';
import * as hexEnc from 'crypto-js/enc-hex';
import loadingIndicators from '../loading-indicators';
import memoryCache from '../memory-cache';
import bitcoinBaseApi from './bitcoin-base.api';
class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
private electrumClient: any;
@@ -44,7 +45,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
}
async $getAddress(address: string): Promise<IEsploraApi.Address> {
const addressInfo = await this.$validateAddress(address);
const addressInfo = await bitcoinBaseApi.$validateAddress(address);
if (!addressInfo || !addressInfo.isvalid) {
return ({
'address': address,
@@ -93,12 +94,12 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
if (e === 'failed to get confirmed status') {
e = 'The number of transactions on this address exceeds the Electrum server limit';
}
throw new Error(e);
throw new Error(typeof e === 'string' ? e : 'Error');
}
}
async $getAddressTransactions(address: string, lastSeenTxId: string): Promise<IEsploraApi.Transaction[]> {
const addressInfo = await this.$validateAddress(address);
const addressInfo = await bitcoinBaseApi.$validateAddress(address);
if (!addressInfo || !addressInfo.isvalid) {
return [];
}
@@ -131,7 +132,7 @@ class BitcoindElectrsApi extends BitcoinApi implements AbstractBitcoinApi {
if (e === 'failed to get confirmed status') {
e = 'The number of transactions on this address exceeds the Electrum server limit';
}
throw new Error(e);
throw new Error(typeof e === 'string' ? e : 'Error');
}
}

View File

@@ -9,6 +9,7 @@ export namespace IEsploraApi {
vin: Vin[];
vout: Vout[];
status: Status;
hex?: string;
}
export interface Recent {

View File

@@ -35,6 +35,11 @@ class ElectrsApi implements AbstractBitcoinApi {
.then((response) => response.data);
}
$getBlockHeader(hash: string): Promise<string> {
return axios.get<string>(config.ESPLORA.REST_API_URL + '/block/' + hash + '/header', this.axiosConfig)
.then((response) => response.data);
}
$getBlock(hash: string): Promise<IEsploraApi.Block> {
return axios.get<IEsploraApi.Block>(config.ESPLORA.REST_API_URL + '/block/' + hash, this.axiosConfig)
.then((response) => response.data);
@@ -48,11 +53,6 @@ class ElectrsApi implements AbstractBitcoinApi {
throw new Error('Method getAddressTransactions not implemented.');
}
$getRawTransactionBitcoind(txId: string): Promise<IEsploraApi.Transaction> {
return axios.get<IEsploraApi.Transaction>(config.ESPLORA.REST_API_URL + '/tx/' + txId, this.axiosConfig)
.then((response) => response.data);
}
$getAddressPrefix(prefix: string): string[] {
throw new Error('Method not implemented.');
}

View File

@@ -6,12 +6,14 @@ import { BlockExtended, TransactionExtended } from '../mempool.interfaces';
import { Common } from './common';
import diskCache from './disk-cache';
import transactionUtils from './transaction-utils';
import bitcoinBaseApi from './bitcoin/bitcoin-base.api';
class Blocks {
private static INITIAL_BLOCK_AMOUNT = 8;
private blocks: BlockExtended[] = [];
private currentBlockHeight = 0;
private currentDifficulty = 0;
private lastDifficultyAdjustmentTime = 0;
private previousDifficultyRetarget = 0;
private newBlockCallbacks: ((block: BlockExtended, txIds: string[], transactions: TransactionExtended[]) => void)[] = [];
constructor() { }
@@ -32,21 +34,32 @@ class Blocks {
const blockHeightTip = await bitcoinApi.$getBlockHeightTip();
if (this.blocks.length === 0) {
this.currentBlockHeight = blockHeightTip - Blocks.INITIAL_BLOCK_AMOUNT;
this.currentBlockHeight = blockHeightTip - config.MEMPOOL.INITIAL_BLOCKS_AMOUNT;
} else {
this.currentBlockHeight = this.blocks[this.blocks.length - 1].height;
}
if (blockHeightTip - this.currentBlockHeight > Blocks.INITIAL_BLOCK_AMOUNT * 2) {
logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${Blocks.INITIAL_BLOCK_AMOUNT} recent blocks`);
this.currentBlockHeight = blockHeightTip - Blocks.INITIAL_BLOCK_AMOUNT;
if (blockHeightTip - this.currentBlockHeight > config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 2) {
logger.info(`${blockHeightTip - this.currentBlockHeight} blocks since tip. Fast forwarding to the ${config.MEMPOOL.INITIAL_BLOCKS_AMOUNT} recent blocks`);
this.currentBlockHeight = blockHeightTip - config.MEMPOOL.INITIAL_BLOCKS_AMOUNT;
}
if (!this.lastDifficultyAdjustmentTime) {
const heightDiff = blockHeightTip % 2016;
const blockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff);
const block = await bitcoinApi.$getBlock(blockHash);
this.lastDifficultyAdjustmentTime = block.timestamp;
const blockchainInfo = await bitcoinBaseApi.$getBlockchainInfo();
if (blockchainInfo.blocks === blockchainInfo.headers) {
const heightDiff = blockHeightTip % 2016;
const blockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff);
const block = await bitcoinApi.$getBlock(blockHash);
this.lastDifficultyAdjustmentTime = block.timestamp;
this.currentDifficulty = block.difficulty;
const previousPeriodBlockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff - 2016);
const previousPeriodBlock = await bitcoinApi.$getBlock(previousPeriodBlockHash);
this.previousDifficultyRetarget = (block.difficulty - previousPeriodBlock.difficulty) / previousPeriodBlock.difficulty * 100;
logger.debug(`Initial difficulty adjustment data set.`);
} else {
logger.debug(`Blockchain headers (${blockchainInfo.headers}) and blocks (${blockchainInfo.blocks}) not in sync. Waiting...`);
}
}
while (this.currentBlockHeight < blockHeightTip) {
@@ -76,7 +89,7 @@ class Blocks {
const tx = await transactionUtils.$getTransactionExtended(txIds[i]);
transactions.push(tx);
} catch (e) {
logger.debug('Error fetching block tx: ' + e.message || e);
logger.debug('Error fetching block tx: ' + (e instanceof Error ? e.message : e));
if (i === 0) {
throw new Error('Failed to fetch Coinbase transaction: ' + txIds[i]);
}
@@ -84,22 +97,31 @@ class Blocks {
}
}
transactions.forEach((tx) => {
if (!tx.cpfpChecked) {
Common.setRelativesAndGetCpfpInfo(tx, mempool);
}
});
logger.debug(`${transactionsFound} of ${txIds.length} found in mempool. ${txIds.length - transactionsFound} not found.`);
const blockExtended: BlockExtended = Object.assign({}, block);
blockExtended.reward = transactions[0].vout.reduce((acc, curr) => acc + curr.value, 0);
blockExtended.coinbaseTx = transactionUtils.stripCoinbaseTransaction(transactions[0]);
transactions.sort((a, b) => b.feePerVsize - a.feePerVsize);
blockExtended.medianFee = transactions.length > 1 ? Common.median(transactions.map((tx) => tx.feePerVsize)) : 0;
blockExtended.feeRange = transactions.length > 1 ? Common.getFeesInRange(transactions.slice(0, transactions.length - 1), 8) : [0, 0];
transactions.shift();
transactions.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize);
blockExtended.medianFee = transactions.length > 0 ? Common.median(transactions.map((tx) => tx.effectiveFeePerVsize)) : 0;
blockExtended.feeRange = transactions.length > 0 ? Common.getFeesInRange(transactions, 8) : [0, 0];
if (block.height % 2016 === 0) {
this.previousDifficultyRetarget = (block.difficulty - this.currentDifficulty) / this.currentDifficulty * 100;
this.lastDifficultyAdjustmentTime = block.timestamp;
this.currentDifficulty = block.difficulty;
}
this.blocks.push(blockExtended);
if (this.blocks.length > Blocks.INITIAL_BLOCK_AMOUNT * 4) {
this.blocks = this.blocks.slice(-Blocks.INITIAL_BLOCK_AMOUNT * 4);
if (this.blocks.length > config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4) {
this.blocks = this.blocks.slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT * 4);
}
if (this.newBlockCallbacks.length) {
@@ -115,6 +137,10 @@ class Blocks {
return this.lastDifficultyAdjustmentTime;
}
public getPreviousDifficultyRetarget(): number {
return this.previousDifficultyRetarget;
}
public getCurrentBlockHeight(): number {
return this.currentBlockHeight;
}

View File

@@ -1,5 +1,5 @@
import { TransactionExtended, TransactionStripped } from '../mempool.interfaces';
import { CpfpInfo, TransactionExtended, TransactionStripped } from '../mempool.interfaces';
import config from '../config';
export class Common {
static median(numbers: number[]) {
let medianNr = 0;
@@ -12,17 +12,28 @@ export class Common {
return medianNr;
}
static percentile(numbers: number[], percentile: number) {
if (percentile === 50) {
return this.median(numbers);
}
const index = Math.ceil(numbers.length * (100 - percentile) * 1e-2);
if (index < 0 || index > numbers.length - 1) {
return 0;
}
return numbers[index];
}
static getFeesInRange(transactions: TransactionExtended[], rangeLength: number) {
const arr = [transactions[transactions.length - 1].feePerVsize];
const arr = [transactions[transactions.length - 1].effectiveFeePerVsize];
const chunk = 1 / (rangeLength - 1);
let itemsToAdd = rangeLength - 2;
while (itemsToAdd > 0) {
arr.push(transactions[Math.floor(transactions.length * chunk * itemsToAdd)].feePerVsize);
arr.push(transactions[Math.floor(transactions.length * chunk * itemsToAdd)].effectiveFeePerVsize);
itemsToAdd--;
}
arr.push(transactions[0].feePerVsize);
arr.push(transactions[0].effectiveFeePerVsize);
return arr;
}
@@ -64,4 +75,74 @@ export class Common {
}, ms);
});
}
static shuffleArray(array: any[]) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
static setRelativesAndGetCpfpInfo(tx: TransactionExtended, memPool: { [txid: string]: TransactionExtended }): CpfpInfo {
const parents = this.findAllParents(tx, memPool);
const lowerFeeParents = parents.filter((parent) => parent.feePerVsize < tx.effectiveFeePerVsize);
let totalWeight = tx.weight + lowerFeeParents.reduce((prev, val) => prev + val.weight, 0);
let totalFees = tx.fee + lowerFeeParents.reduce((prev, val) => prev + val.fee, 0);
tx.ancestors = parents
.map((t) => {
return {
txid: t.txid,
weight: t.weight,
fee: t.fee,
};
});
// Add high (high fee) decendant weight and fees
if (tx.bestDescendant) {
totalWeight += tx.bestDescendant.weight;
totalFees += tx.bestDescendant.fee;
}
tx.effectiveFeePerVsize = Math.max(config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1, totalFees / (totalWeight / 4));
tx.cpfpChecked = true;
return {
ancestors: tx.ancestors,
bestDescendant: tx.bestDescendant || null,
};
}
private static findAllParents(tx: TransactionExtended, memPool: { [txid: string]: TransactionExtended }): TransactionExtended[] {
let parents: TransactionExtended[] = [];
tx.vin.forEach((parent) => {
if (parents.find((p) => p.txid === parent.txid)) {
return;
}
const parentTx = memPool[parent.txid];
if (parentTx) {
if (tx.bestDescendant && tx.bestDescendant.fee / (tx.bestDescendant.weight / 4) > parentTx.feePerVsize) {
if (parentTx.bestDescendant && parentTx.bestDescendant.fee < tx.fee + tx.bestDescendant.fee) {
parentTx.bestDescendant = {
weight: tx.weight + tx.bestDescendant.weight,
fee: tx.fee + tx.bestDescendant.fee,
txid: tx.txid,
};
}
} else if (tx.feePerVsize > parentTx.feePerVsize) {
parentTx.bestDescendant = {
weight: tx.weight,
fee: tx.fee,
txid: tx.txid
};
}
parents.push(parentTx);
parents = parents.concat(this.findAllParents(parentTx, memPool));
}
});
return parents;
}
}

View File

@@ -5,37 +5,55 @@ import memPool from './mempool';
import blocks from './blocks';
import logger from '../logger';
import config from '../config';
import { TransactionExtended } from '../mempool.interfaces';
import { Common } from './common';
class DiskCache {
private static FILE_NAME = config.MEMPOOL.CACHE_DIR + 'cache.json';
private static FILE_NAMES = config.MEMPOOL.CACHE_DIR + 'cache{number}.json';
private static CHUNK_SIZE = 10000;
private static FILE_NAME = config.MEMPOOL.CACHE_DIR + '/cache.json';
private static FILE_NAMES = config.MEMPOOL.CACHE_DIR + '/cache{number}.json';
private static CHUNK_FILES = 25;
private isWritingCache = false;
constructor() { }
async $saveCacheToDisk(): Promise<void> {
if (!cluster.isMaster) {
return;
}
if (this.isWritingCache) {
logger.debug('Saving cache already in progress. Skipping.')
return;
}
try {
logger.debug('Writing mempool and blocks data to disk cache (async)...');
const mempoolChunk_1 = Object.fromEntries(Object.entries(memPool.getMempool()).slice(0, DiskCache.CHUNK_SIZE));
this.isWritingCache = true;
const mempool = memPool.getMempool();
const mempoolArray: TransactionExtended[] = [];
for (const tx in mempool) {
mempoolArray.push(mempool[tx]);
}
Common.shuffleArray(mempoolArray);
const chunkSize = Math.floor(mempoolArray.length / DiskCache.CHUNK_FILES);
await fsPromises.writeFile(DiskCache.FILE_NAME, JSON.stringify({
blocks: blocks.getBlocks(),
mempool: mempoolChunk_1
mempool: {},
mempoolArray: mempoolArray.splice(0, chunkSize),
}), {flag: 'w'});
for (let i = 1; i < 10; i++) {
const mempoolChunk = Object.fromEntries(
Object.entries(memPool.getMempool()).slice(
DiskCache.CHUNK_SIZE * i, i === 9 ? undefined : DiskCache.CHUNK_SIZE * i + DiskCache.CHUNK_SIZE
)
);
for (let i = 1; i < DiskCache.CHUNK_FILES; i++) {
await fsPromises.writeFile(DiskCache.FILE_NAMES.replace('{number}', i.toString()), JSON.stringify({
mempool: mempoolChunk
mempool: {},
mempoolArray: mempoolArray.splice(0, chunkSize),
}), {flag: 'w'});
}
logger.debug('Mempool and blocks data saved to disk cache');
this.isWritingCache = false;
} catch (e) {
logger.warn('Error writing to cache file: ' + e.message || e);
logger.warn('Error writing to cache file: ' + (e instanceof Error ? e.message : e));
this.isWritingCache = false;
}
}
@@ -49,20 +67,35 @@ class DiskCache {
if (cacheData) {
logger.info('Restoring mempool and blocks data from disk cache');
data = JSON.parse(cacheData);
if (data.mempoolArray) {
for (const tx of data.mempoolArray) {
data.mempool[tx.txid] = tx;
}
}
}
for (let i = 1; i < 10; i++) {
for (let i = 1; i < DiskCache.CHUNK_FILES; i++) {
const fileName = DiskCache.FILE_NAMES.replace('{number}', i.toString());
if (fs.existsSync(fileName)) {
const cacheData2 = JSON.parse(fs.readFileSync(fileName, 'utf8'));
Object.assign(data.mempool, cacheData2.mempool);
try {
if (fs.existsSync(fileName)) {
const cacheData2 = JSON.parse(fs.readFileSync(fileName, 'utf8'));
if (cacheData2.mempoolArray) {
for (const tx of cacheData2.mempoolArray) {
data.mempool[tx.txid] = tx;
}
} else {
Object.assign(data.mempool, cacheData2.mempool);
}
}
} catch (e) {
logger.debug('Error parsing ' + fileName + '. Skipping.');
}
}
memPool.setMempool(data.mempool);
blocks.setBlocks(data.blocks);
} catch (e) {
logger.warn('Failed to parse mempoool and blocks cache. Skipping...');
logger.warn('Failed to parse mempoool and blocks cache. Skipping.');
}
}
}

View File

@@ -1,198 +0,0 @@
import config from '../config';
import axios from 'axios';
import { DB } from '../database';
import logger from '../logger';
class Donations {
private notifyDonationStatusCallback: ((invoiceId: string) => void) | undefined;
private options = {
baseURL: config.SPONSORS.BTCPAY_URL,
headers: {
'Content-Type': 'application/json',
'Authorization': config.SPONSORS.BTCPAY_AUTH,
},
timeout: 10000,
};
sponsorsCache: any[] = [];
constructor() {}
public async $updateCache() {
try {
this.sponsorsCache = await this.$getDonationsFromDatabase('handle, image');
} catch (e) {
logger.warn('Setting sponsorsCache failed ' + e.message || e);
}
}
setNotfyDonationStatusCallback(fn: any): void {
this.notifyDonationStatusCallback = fn;
}
async $createRequest(amount: number, orderId: string): Promise<any> {
logger.notice('New invoice request. Handle: ' + orderId + ' Amount: ' + amount + ' BTC');
const postData = {
'price': amount,
'orderId': orderId,
'currency': 'BTC',
'itemDesc': 'Sponsor mempool.space',
'notificationUrl': config.SPONSORS.BTCPAY_WEBHOOK_URL,
'redirectURL': 'https://mempool.space/about',
};
const response = await axios.post('/invoices', postData, this.options);
return {
id: response.data.data.id,
amount: parseFloat(response.data.data.btcPrice),
addresses: response.data.data.addresses,
};
}
async $handleWebhookRequest(data: any): Promise<void> {
if (!data || !data.id) {
return;
}
const response = await this.$getStatus(data.id);
logger.notice(`Received BTCPayServer webhook. Invoice ID: ${data.id} Status: ${response.status} BTC Paid: ${response.btcPaid}`);
if (response.status !== 'complete' && response.status !== 'confirmed' && response.status !== 'paid') {
return;
}
if (this.notifyDonationStatusCallback) {
this.notifyDonationStatusCallback(data.id);
}
if (parseFloat(response.btcPaid) < 0.01) {
return;
}
if (response.orderId !== '') {
try {
const userData = await this.$getTwitterUserData(response.orderId);
const imageUrl = userData.profile_image_url.replace('normal', '200x200');
const imageBlob = await this.$downloadProfileImageBlob(imageUrl);
logger.debug('Creating database entry for donation with invoice id: ' + response.id);
await this.$addDonationToDatabase(response.btcPaid, userData.screen_name, userData.id, response.id, imageUrl, imageBlob);
this.$updateCache();
} catch (e) {
logger.err(`Error fetching twitter data for handle ${response.orderId}: ${e.message}`);
}
}
}
getSponsorImage(id: string): any | undefined {
const sponsor = this.sponsorsCache.find((s) => s.handle === id);
if (sponsor) {
return sponsor.image;
}
}
async $getDonationsFromDatabase(fields: string): Promise<any[]> {
try {
const connection = await DB.pool.getConnection();
const query = `SELECT ${fields} FROM donations ORDER BY id DESC`;
const [rows] = await connection.query<any>(query);
connection.release();
return rows;
} catch (e) {
logger.err('$getDonationsFromDatabase() error: ' + e.message || e);
return [];
}
}
private async $getOldDonations(): Promise<any[]> {
try {
const connection = await DB.pool.getConnection();
const query = `SELECT * FROM donations WHERE twitter_id IS NULL AND handle != ''`;
const [rows] = await connection.query<any>(query);
connection.release();
return rows;
} catch (e) {
logger.err('$getLegacyDonations() error' + e.message || e);
return [];
}
}
private async $getStatus(id: string): Promise<any> {
logger.debug('Fetching status for invoice: ' + id);
const response = await axios.get('/invoices/' + id, this.options);
logger.debug('Invoice status received: ' + JSON.stringify(response.data));
return response.data.data;
}
private async $addDonationToDatabase(btcPaid: number, handle: string, twitter_id: number | null,
orderId: string, imageUrl: string, image: string): Promise<void> {
try {
const connection = await DB.pool.getConnection();
const query = `INSERT IGNORE INTO donations(added, amount, handle, twitter_id, order_id, imageUrl, image) VALUES (NOW(), ?, ?, ?, ?, ?, FROM_BASE64(?))`;
const params: (string | number | null)[] = [
btcPaid,
handle,
twitter_id,
orderId,
imageUrl,
image,
];
const [result]: any = await connection.query(query, params);
connection.release();
} catch (e) {
logger.err('$addDonationToDatabase() error' + e.message || e);
}
}
private async $updateDonation(id: number, handle: string, twitterId: number, imageUrl: string, image: string): Promise<void> {
try {
const connection = await DB.pool.getConnection();
const query = `UPDATE donations SET handle = ?, twitter_id = ?, imageUrl = ?, image = FROM_BASE64(?) WHERE id = ?`;
const params: (string | number)[] = [
handle,
twitterId,
imageUrl,
image,
id,
];
const [result]: any = await connection.query(query, params);
connection.release();
} catch (e) {
logger.err('$updateDonation() error' + e.message || e);
}
}
private async $getTwitterUserData(handle: string): Promise<any> {
logger.debug('Fetching Twitter API data...');
const res = await axios.get(`https://api.twitter.com/1.1/users/show.json?screen_name=${handle}`, {
headers: {
Authorization: 'Bearer ' + config.SPONSORS.TWITTER_BEARER_AUTH
},
timeout: 10000,
});
logger.debug('Twitter user data fetched:' + JSON.stringify(res.data));
return res.data;
}
private async $downloadProfileImageBlob(url: string): Promise<string> {
logger.debug('Fetching image blob...');
const res = await axios.get(url, { responseType: 'arraybuffer', timeout: 10000 });
logger.debug('Image downloaded.');
return Buffer.from(res.data, 'utf8').toString('base64');
}
private async refreshSponsors(): Promise<void> {
const oldDonations = await this.$getOldDonations();
oldDonations.forEach(async (donation: any) => {
logger.debug('Migrating donation for handle: ' + donation.handle);
try {
const twitterData = await this.$getTwitterUserData(donation.handle);
const imageUrl = twitterData.profile_image_url.replace('normal', '200x200');
const imageBlob = await this.$downloadProfileImageBlob(imageUrl);
await this.$updateDonation(donation.id, twitterData.screen_name, twitterData.id, imageUrl, imageBlob);
} catch (e) {
logger.err('Failed to migrate donation for handle: ' + donation.handle + '. ' + (e.message || e));
}
});
}
}
export default new Donations();

View File

@@ -1,5 +1,6 @@
import config from '../config';
import { MempoolBlock } from '../mempool.interfaces';
import mempool from './mempool';
import projectedBlocks from './mempool-blocks';
class FeeApi {
@@ -9,12 +10,15 @@ class FeeApi {
public getRecommendedFee() {
const pBlocks = projectedBlocks.getMempoolBlocks();
const mPool = mempool.getMempoolInfo();
const minimumFee = Math.ceil(mPool.mempoolminfee * 100000);
if (!pBlocks.length) {
return {
'fastestFee': this.defaultFee,
'halfHourFee': this.defaultFee,
'hourFee': this.defaultFee,
'minimumFee': minimumFee,
};
}
@@ -26,6 +30,7 @@ class FeeApi {
'fastestFee': firstMedianFee,
'halfHourFee': secondMedianFee,
'hourFee': thirdMedianFee,
'minimumFee': minimumFee,
};
}
@@ -34,11 +39,11 @@ class FeeApi {
if (pBlock.blockVSize <= 500000) {
return this.defaultFee;
}
if (pBlock.blockVSize <= 950000 && nextBlock) {
if (pBlock.blockVSize <= 950000 && !nextBlock) {
const multiplier = (pBlock.blockVSize - 500000) / 500000;
return Math.max(Math.round(useFee * multiplier), this.defaultFee);
}
return Math.round(useFee);
return Math.ceil(useFee);
}
}

View File

@@ -1,6 +1,7 @@
import logger from '../logger';
import axios from 'axios';
import { IConversionRates } from '../mempool.interfaces';
import config from '../config';
class FiatConversion {
private conversionRates: IConversionRates = {
@@ -16,7 +17,7 @@ class FiatConversion {
public startService() {
logger.info('Starting currency rates service');
setInterval(this.updateCurrency.bind(this), 1000 * 60 * 60);
setInterval(this.updateCurrency.bind(this), 1000 * config.MEMPOOL.PRICE_FEED_UPDATE_INTERVAL);
this.updateCurrency();
}
@@ -35,7 +36,7 @@ class FiatConversion {
this.ratesChangedCallback(this.conversionRates);
}
} catch (e) {
logger.err('Error updating fiat conversion rates: ' + e);
logger.err('Error updating fiat conversion rates: ' + (e instanceof Error ? e.message : e));
}
}
}

View File

@@ -1,8 +1,9 @@
import logger from '../logger';
import { MempoolBlock, TransactionExtended, MempoolBlockWithTransactions } from '../mempool.interfaces';
import { Common } from './common';
import config from '../config';
class MempoolBlocks {
private static DEFAULT_PROJECTED_BLOCKS_AMOUNT = 8;
private mempoolBlocks: MempoolBlockWithTransactions[] = [];
constructor() {}
@@ -32,36 +33,67 @@ class MempoolBlocks {
memPoolArray.push(latestMempool[i]);
}
}
const start = new Date().getTime();
// Clear bestDescendants & ancestors
memPoolArray.forEach((tx) => {
tx.bestDescendant = null;
tx.ancestors = [];
tx.cpfpChecked = false;
if (!tx.effectiveFeePerVsize) {
tx.effectiveFeePerVsize = tx.feePerVsize;
}
});
// First sort
memPoolArray.sort((a, b) => b.feePerVsize - a.feePerVsize);
const transactionsSorted = memPoolArray.filter((tx) => tx.feePerVsize);
this.mempoolBlocks = this.calculateMempoolBlocks(transactionsSorted);
// Loop through and traverse all ancestors and sum up all the sizes + fees
// Pass down size + fee to all unconfirmed children
let sizes = 0;
memPoolArray.forEach((tx, i) => {
sizes += tx.weight;
if (sizes > 4000000 * 8) {
return;
}
Common.setRelativesAndGetCpfpInfo(tx, memPool);
});
// Final sort, by effective fee
memPoolArray.sort((a, b) => b.effectiveFeePerVsize - a.effectiveFeePerVsize);
const end = new Date().getTime();
const time = end - start;
logger.debug('Mempool blocks calculated in ' + time / 1000 + ' seconds');
this.mempoolBlocks = this.calculateMempoolBlocks(memPoolArray);
}
private calculateMempoolBlocks(transactionsSorted: TransactionExtended[]): MempoolBlockWithTransactions[] {
const mempoolBlocks: MempoolBlockWithTransactions[] = [];
let blockVSize = 0;
let blockWeight = 0;
let blockSize = 0;
let transactions: TransactionExtended[] = [];
transactionsSorted.forEach((tx) => {
if (blockVSize + tx.vsize <= 1000000 || mempoolBlocks.length === MempoolBlocks.DEFAULT_PROJECTED_BLOCKS_AMOUNT - 1) {
blockVSize += tx.vsize;
if (blockWeight + tx.weight <= config.MEMPOOL.BLOCK_WEIGHT_UNITS || mempoolBlocks.length === config.MEMPOOL.MEMPOOL_BLOCKS_AMOUNT) {
blockWeight += tx.weight;
blockSize += tx.size;
transactions.push(tx);
} else {
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockVSize, mempoolBlocks.length));
blockVSize = tx.vsize;
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockWeight, mempoolBlocks.length));
blockWeight = tx.weight;
blockSize = tx.size;
transactions = [tx];
}
});
if (transactions.length) {
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockVSize, mempoolBlocks.length));
mempoolBlocks.push(this.dataToMempoolBlocks(transactions, blockSize, blockWeight, mempoolBlocks.length));
}
return mempoolBlocks;
}
private dataToMempoolBlocks(transactions: TransactionExtended[],
blockSize: number, blockVSize: number, blocksIndex: number): MempoolBlockWithTransactions {
blockSize: number, blockWeight: number, blocksIndex: number): MempoolBlockWithTransactions {
let rangeLength = 4;
if (blocksIndex === 0) {
rangeLength = 8;
@@ -73,10 +105,10 @@ class MempoolBlocks {
}
return {
blockSize: blockSize,
blockVSize: blockVSize,
blockVSize: blockWeight / 4,
nTx: transactions.length,
totalFees: transactions.reduce((acc, cur) => acc + cur.fee, 0),
medianFee: Common.median(transactions.map((tx) => tx.feePerVsize)),
medianFee: Common.percentile(transactions.map((tx) => tx.effectiveFeePerVsize), config.MEMPOOL.RECOMMENDED_FEE_PERCENTILE),
feeRange: Common.getFeesInRange(transactions, rangeLength),
transactionIds: transactions.map((tx) => tx.txid),
};

View File

@@ -10,11 +10,11 @@ import loadingIndicators from './loading-indicators';
class Mempool {
private static WEBSOCKET_REFRESH_RATE_MS = 10000;
private static CLEAR_PROTECTION_MINUTES = 10;
private static LAZY_DELETE_AFTER_SECONDS = 30;
private inSync: boolean = false;
private mempoolCache: { [txId: string]: TransactionExtended } = {};
private mempoolInfo: IBitcoinApi.MempoolInfo = { loaded: false, size: 0, bytes: 0, usage: 0,
maxmempool: 0, mempoolminfee: 0, minrelaytxfee: 0 };
maxmempool: 300000000, mempoolminfee: 0.00001000, minrelaytxfee: 0.00001000 };
private mempoolChangedCallback: ((newMempool: {[txId: string]: TransactionExtended; }, newTransactions: TransactionExtended[],
deletedTransactions: TransactionExtended[]) => void) | undefined;
@@ -28,6 +28,7 @@ class Mempool {
constructor() {
setInterval(this.updateTxPerSecond.bind(this), 1000);
setInterval(this.deleteExpiredTransactions.bind(this), 20000);
}
public isInSync(): boolean {
@@ -63,7 +64,7 @@ class Mempool {
this.mempoolInfo = await bitcoinBaseApi.$getMempoolInfo();
}
public getMempoolInfo(): IBitcoinApi.MempoolInfo | undefined {
public getMempoolInfo(): IBitcoinApi.MempoolInfo {
return this.mempoolInfo;
}
@@ -123,7 +124,7 @@ class Mempool {
}
newTransactions.push(transaction);
} catch (e) {
logger.debug('Error finding transaction in mempool: ' + e.message || e);
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
}
}
@@ -134,7 +135,6 @@ class Mempool {
// Prevent mempool from clear on bitcoind restart by delaying the deletion
if (this.mempoolProtection === 0
&& config.MEMPOOL.BACKEND === 'esplora'
&& currentMempoolSize > 20000
&& transactions.length / currentMempoolSize <= 0.80
) {
@@ -144,10 +144,9 @@ class Mempool {
setTimeout(() => {
this.mempoolProtection = 2;
logger.warn('Mempool clear protection resumed.');
}, 1000 * 60 * Mempool.CLEAR_PROTECTION_MINUTES);
}, 1000 * 60 * config.MEMPOOL.CLEAR_PROTECTION_MINUTES);
}
let newMempool = {};
const deletedTransactions: TransactionExtended[] = [];
if (this.mempoolProtection !== 1) {
@@ -156,35 +155,31 @@ class Mempool {
const transactionsObject = {};
transactions.forEach((txId) => transactionsObject[txId] = true);
// Replace mempool to separate deleted transactions
// Flag transactions for lazy deletion
for (const tx in this.mempoolCache) {
if (transactionsObject[tx]) {
newMempool[tx] = this.mempoolCache[tx];
} else {
if (!transactionsObject[tx] && !this.mempoolCache[tx].deleteAfter) {
deletedTransactions.push(this.mempoolCache[tx]);
this.mempoolCache[tx].deleteAfter = new Date().getTime() + Mempool.LAZY_DELETE_AFTER_SECONDS * 1000;
}
}
} else {
newMempool = this.mempoolCache;
}
const newTransactionsStripped = newTransactions.map((tx) => Common.stripTransaction(tx));
this.latestTransactions = newTransactionsStripped.concat(this.latestTransactions).slice(0, 6);
if (!this.inSync && transactions.length === Object.keys(newMempool).length) {
if (!this.inSync && transactions.length === Object.keys(this.mempoolCache).length) {
this.inSync = true;
logger.info('The mempool is now in sync!');
logger.notice('The mempool is now in sync!');
loadingIndicators.setProgress('mempool', 100);
}
if (this.mempoolChangedCallback && (hasChange || deletedTransactions.length)) {
this.mempoolCache = newMempool;
this.mempoolChangedCallback(this.mempoolCache, newTransactions, deletedTransactions);
}
const end = new Date().getTime();
const time = end - start;
logger.debug(`New mempool size: ${Object.keys(newMempool).length} Change: ${diff}`);
logger.debug(`New mempool size: ${Object.keys(this.mempoolCache).length} Change: ${diff}`);
logger.debug('Mempool updated in ' + time / 1000 + ' seconds');
}
@@ -200,6 +195,16 @@ class Mempool {
);
}
}
private deleteExpiredTransactions() {
const now = new Date().getTime();
for (const tx in this.mempoolCache) {
const lazyDeleteAt = this.mempoolCache[tx].deleteAfter;
if (lazyDeleteAt && lazyDeleteAt < now) {
delete this.mempoolCache[tx];
}
}
}
}
export default new Mempool();

View File

@@ -68,13 +68,13 @@ class Statistics {
}
}
// Remove 0 and undefined
memPoolArray = memPoolArray.filter((tx) => tx.feePerVsize);
memPoolArray = memPoolArray.filter((tx) => tx.effectiveFeePerVsize);
if (!memPoolArray.length) {
return;
}
memPoolArray.sort((a, b) => a.feePerVsize - b.feePerVsize);
memPoolArray.sort((a, b) => a.effectiveFeePerVsize - b.effectiveFeePerVsize);
const totalWeight = memPoolArray.map((tx) => tx.vsize).reduce((acc, curr) => acc + curr) * 4;
const totalFee = memPoolArray.map((tx) => tx.fee).reduce((acc, curr) => acc + curr);
@@ -85,7 +85,7 @@ class Statistics {
memPoolArray.forEach((transaction) => {
for (let i = 0; i < logFees.length; i++) {
if ((logFees[i] === 2000 && transaction.feePerVsize >= 2000) || transaction.feePerVsize <= logFees[i]) {
if ((logFees[i] === 2000 && transaction.effectiveFeePerVsize >= 2000) || transaction.effectiveFeePerVsize <= logFees[i]) {
if (weightVsizeFees[logFees[i]]) {
weightVsizeFees[logFees[i]] += transaction.vsize;
} else {
@@ -255,7 +255,7 @@ class Statistics {
connection.release();
return result.insertId;
} catch (e) {
logger.err('$create() error' + e.message || e);
logger.err('$create() error' + (e instanceof Error ? e.message : e));
}
}
@@ -313,7 +313,7 @@ class Statistics {
return this.mapStatisticToOptimizedStatistic([rows[0]])[0];
}
} catch (e) {
logger.err('$list2H() error' + e.message || e);
logger.err('$list2H() error' + (e instanceof Error ? e.message : e));
}
}
@@ -325,7 +325,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list2H() error' + e.message || e);
logger.err('$list2H() error' + (e instanceof Error ? e.message : e));
return [];
}
}
@@ -338,7 +338,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list24h() error' + e.message || e);
logger.err('$list24h() error' + (e instanceof Error ? e.message : e));
return [];
}
}
@@ -351,7 +351,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list1W() error' + e);
logger.err('$list1W() error' + (e instanceof Error ? e.message : e));
return [];
}
}
@@ -364,7 +364,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list1M() error' + e);
logger.err('$list1M() error' + (e instanceof Error ? e.message : e));
return [];
}
}
@@ -377,7 +377,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list3M() error' + e);
logger.err('$list3M() error' + (e instanceof Error ? e.message : e));
return [];
}
}
@@ -390,7 +390,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list6M() error' + e);
logger.err('$list6M() error' + (e instanceof Error ? e.message : e));
return [];
}
}
@@ -403,7 +403,7 @@ class Statistics {
connection.release();
return this.mapStatisticToOptimizedStatistic(rows);
} catch (e) {
logger.err('$list6M() error' + e);
logger.err('$list6M() error' + (e instanceof Error ? e.message : e));
return [];
}
}

View File

@@ -1,7 +1,7 @@
import bitcoinApi from './bitcoin/bitcoin-api-factory';
import logger from '../logger';
import { TransactionExtended, TransactionMinerInfo } from '../mempool.interfaces';
import { IEsploraApi } from './bitcoin/esplora-api.interface';
import config from '../config';
class TransactionUtils {
constructor() { }
@@ -26,9 +26,16 @@ class TransactionUtils {
}
private extendTransaction(transaction: IEsploraApi.Transaction): TransactionExtended {
// @ts-ignore
if (transaction.vsize) {
// @ts-ignore
return transaction;
}
const feePerVbytes = Math.max(config.MEMPOOL.NETWORK === 'liquid' ? 0.1 : 1, (transaction.fee || 0) / (transaction.weight / 4));
const transactionExtended: TransactionExtended = Object.assign({
vsize: Math.round(transaction.weight / 4),
feePerVsize: Math.max(1, (transaction.fee || 0) / (transaction.weight / 4)),
feePerVsize: feePerVbytes,
effectiveFeePerVsize: feePerVbytes,
}, transaction);
if (!transaction.status.confirmed) {
transactionExtended.firstSeen = Math.round((new Date().getTime() / 1000));

View File

@@ -34,7 +34,7 @@ class WebsocketHandler {
this.wss.on('connection', (client: WebSocket) => {
client.on('error', logger.info);
client.on('message', (message: string) => {
client.on('message', async (message: string) => {
try {
const parsedMessage: WebsocketResponse = JSON.parse(message);
const response = {};
@@ -53,9 +53,25 @@ class WebsocketHandler {
if (parsedMessage['watch-mempool']) {
const tx = memPool.getMempool()[client['track-tx']];
if (tx) {
response['tx'] = tx;
if (config.MEMPOOL.BACKEND === 'esplora') {
response['tx'] = tx;
} else {
// tx.prevouts is missing from transactions when in bitcoind mode
try {
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
response['tx'] = fullTx;
} catch (e) {
logger.debug('Error finding transaction: ' + (e instanceof Error ? e.message : e));
}
}
} else {
client['track-mempool-tx'] = parsedMessage['track-tx'];
try {
const fullTx = await transactionUtils.$getTransactionExtended(client['track-tx'], true);
response['tx'] = fullTx;
} catch (e) {
logger.debug('Error finding transaction. ' + (e instanceof Error ? e.message : e));
client['track-mempool-tx'] = parsedMessage['track-tx'];
}
}
}
} else {
@@ -64,9 +80,13 @@ class WebsocketHandler {
}
if (parsedMessage && parsedMessage['track-address']) {
if (/^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,87})$/
if (/^([a-km-zA-HJ-NP-Z1-9]{26,35}|[a-km-zA-HJ-NP-Z1-9]{80}|[a-z]{2,5}1[ac-hj-np-z02-9]{8,100}|[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100})$/
.test(parsedMessage['track-address'])) {
client['track-address'] = parsedMessage['track-address'];
let matchedAddress = parsedMessage['track-address'];
if (/^[A-Z]{2,5}1[AC-HJ-NP-Z02-9]{8,100}$/.test(parsedMessage['track-address'])) {
matchedAddress = matchedAddress.toLowerCase();
}
client['track-address'] = matchedAddress;
} else {
client['track-address'] = null;
}
@@ -81,7 +101,7 @@ class WebsocketHandler {
}
if (parsedMessage.action === 'init') {
const _blocks = blocks.getBlocks().slice(-8);
const _blocks = blocks.getBlocks().slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT);
if (!_blocks) {
return;
}
@@ -96,11 +116,19 @@ class WebsocketHandler {
client['track-donation'] = parsedMessage['track-donation'];
}
if (parsedMessage['track-bisq-market']) {
if (/^[a-z]{3}_[a-z]{3}$/.test(parsedMessage['track-bisq-market'])) {
client['track-bisq-market'] = parsedMessage['track-bisq-market'];
} else {
client['track-bisq-market'] = null;
}
}
if (Object.keys(response).length) {
client.send(JSON.stringify(response));
}
} catch (e) {
logger.debug('Error parsing websocket message: ' + e.message || e);
logger.debug('Error parsing websocket message: ' + (e instanceof Error ? e.message : e));
}
});
});
@@ -149,18 +177,18 @@ class WebsocketHandler {
getInitData(_blocks?: BlockExtended[]) {
if (!_blocks) {
_blocks = blocks.getBlocks().slice(-8);
_blocks = blocks.getBlocks().slice(-config.MEMPOOL.INITIAL_BLOCKS_AMOUNT);
}
return {
'mempoolInfo': memPool.getMempoolInfo(),
'vBytesPerSecond': memPool.getVBytesPerSecond(),
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
'previousRetarget': blocks.getPreviousDifficultyRetarget(),
'blocks': _blocks,
'conversions': fiatConversion.getConversionRates(),
'mempool-blocks': mempoolBlocks.getMempoolBlocks(),
'transactions': memPool.getLatestTransactions(),
'git-commit': backendInfo.gitCommitHash,
'hostname': backendInfo.hostname,
'backendInfo': backendInfo.getBackendInfo(),
'loadingIndicators': loadingIndicators.getLoadingIndicators(),
...this.extraInitProperties
};
@@ -194,10 +222,15 @@ class WebsocketHandler {
mempoolBlocks.updateMempoolBlocks(newMempool);
const mBlocks = mempoolBlocks.getMempoolBlocks();
const mempool = memPool.getMempool();
const mempoolInfo = memPool.getMempoolInfo();
const vBytesPerSecond = memPool.getVBytesPerSecond();
const rbfTransactions = Common.findRbfTransactions(newTransactions, deletedTransactions);
for (const rbfTransaction in rbfTransactions) {
delete mempool[rbfTransaction];
}
this.wss.clients.forEach(async (client: WebSocket) => {
if (client.readyState !== WebSocket.OPEN) {
return;
@@ -223,7 +256,7 @@ class WebsocketHandler {
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
response['tx'] = fullTx;
} catch (e) {
logger.debug('Error finding transaction in mempool: ' + e.message || e);
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
}
} else {
response['tx'] = tx;
@@ -243,7 +276,7 @@ class WebsocketHandler {
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
foundTransactions.push(fullTx);
} catch (e) {
logger.debug('Error finding transaction in mempool: ' + e.message || e);
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
}
} else {
foundTransactions.push(tx);
@@ -257,7 +290,7 @@ class WebsocketHandler {
const fullTx = await transactionUtils.$getTransactionExtended(tx.txid, true);
foundTransactions.push(fullTx);
} catch (e) {
logger.debug('Error finding transaction in mempool: ' + e.message || e);
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
}
} else {
foundTransactions.push(tx);
@@ -308,7 +341,7 @@ class WebsocketHandler {
const fullTx = await transactionUtils.$getTransactionExtended(rbfTransaction, true);
response['rbfTransaction'] = fullTx;
} catch (e) {
logger.debug('Error finding transaction in mempool: ' + e.message || e);
logger.debug('Error finding transaction in mempool: ' + (e instanceof Error ? e.message : e));
}
} else {
response['rbfTransaction'] = rbfTx;
@@ -329,28 +362,23 @@ class WebsocketHandler {
throw new Error('WebSocket.Server is not set');
}
// Check how many transactions in the new block matches the latest projected mempool block
// If it's more than 0, recalculate the mempool blocks and send to client in the same update
let mBlocks: undefined | MempoolBlock[];
let matchRate = 0;
const _memPool = memPool.getMempool();
const _mempoolBlocks = mempoolBlocks.getMempoolBlocksWithTransactions();
if (_mempoolBlocks[0]) {
const matches: string[] = [];
for (const txId of txIds) {
if (_mempoolBlocks[0].transactionIds.indexOf(txId) > -1) {
matches.push(txId);
}
delete _memPool[txId];
}
matchRate = Math.round((matches.length / (txIds.length - 1)) * 100);
if (matchRate > 0) {
const currentMemPool = memPool.getMempool();
for (const txId of matches) {
delete currentMemPool[txId];
}
mempoolBlocks.updateMempoolBlocks(currentMemPool);
mBlocks = mempoolBlocks.getMempoolBlocks();
}
mempoolBlocks.updateMempoolBlocks(_memPool);
mBlocks = mempoolBlocks.getMempoolBlocks();
}
block.matchRate = matchRate;
@@ -368,6 +396,7 @@ class WebsocketHandler {
'block': block,
'mempoolInfo': memPool.getMempoolInfo(),
'lastDifficultyAdjustment': blocks.getLastDifficultyAdjustmentTime(),
'previousRetarget': blocks.getPreviousDifficultyRetarget(),
};
if (mBlocks && client['want-mempool-blocks']) {

View File

@@ -2,13 +2,19 @@ const configFile = require('../mempool-config.json');
interface IConfig {
MEMPOOL: {
NETWORK: 'mainnet' | 'testnet' | 'liquid';
NETWORK: 'mainnet' | 'testnet' | 'signet' | 'liquid';
BACKEND: 'esplora' | 'electrum' | 'none';
HTTP_PORT: number;
SPAWN_CLUSTER_PROCS: number;
API_URL_PREFIX: string;
POLL_RATE_MS: number;
CACHE_DIR: string;
CLEAR_PROTECTION_MINUTES: number;
RECOMMENDED_FEE_PERCENTILE: number;
BLOCK_WEIGHT_UNITS: number;
INITIAL_BLOCKS_AMOUNT: number;
MEMPOOL_BLOCKS_AMOUNT: number;
PRICE_FEED_UPDATE_INTERVAL: number;
};
ESPLORA: {
REST_API_URL: string;
@@ -39,25 +45,21 @@ interface IConfig {
USERNAME: string;
PASSWORD: string;
};
SYSLOG: {
ENABLED: boolean;
HOST: string;
PORT: number;
MIN_PRIORITY: 'emerg' | 'alert' | 'crit' | 'err' |'warn' | 'notice' | 'info' | 'debug';
FACILITY: string;
};
STATISTICS: {
ENABLED: boolean;
TX_PER_SECOND_SAMPLE_PERIOD: number;
};
BISQ_BLOCKS: {
BISQ: {
ENABLED: boolean;
DATA_PATH: string;
};
BISQ_MARKETS: {
ENABLED: boolean;
DATA_PATH: string;
};
SPONSORS: {
ENABLED: boolean;
BTCPAY_URL: string;
BTCPAY_AUTH: string;
BTCPAY_WEBHOOK_URL: string;
TWITTER_BEARER_AUTH: string;
};
}
const defaults: IConfig = {
@@ -68,7 +70,13 @@ const defaults: IConfig = {
'SPAWN_CLUSTER_PROCS': 0,
'API_URL_PREFIX': '/api/v1/',
'POLL_RATE_MS': 2000,
'CACHE_DIR': './'
'CACHE_DIR': './cache',
'CLEAR_PROTECTION_MINUTES': 20,
'RECOMMENDED_FEE_PERCENTILE': 50,
'BLOCK_WEIGHT_UNITS': 4000000,
'INITIAL_BLOCKS_AMOUNT': 8,
'MEMPOOL_BLOCKS_AMOUNT': 8,
'PRICE_FEED_UPDATE_INTERVAL': 3600,
},
'ESPLORA': {
'REST_API_URL': 'http://127.0.0.1:3000',
@@ -99,25 +107,21 @@ const defaults: IConfig = {
'USERNAME': 'mempool',
'PASSWORD': 'mempool'
},
'SYSLOG': {
'ENABLED': true,
'HOST': '127.0.0.1',
'PORT': 514,
'MIN_PRIORITY': 'info',
'FACILITY': 'local7'
},
'STATISTICS': {
'ENABLED': true,
'TX_PER_SECOND_SAMPLE_PERIOD': 150
},
'BISQ_BLOCKS': {
'ENABLED': false,
'DATA_PATH': '/bisq/statsnode-data/btc_mainnet/db/json'
},
'BISQ_MARKETS': {
'BISQ': {
'ENABLED': false,
'DATA_PATH': '/bisq/statsnode-data/btc_mainnet/db'
},
'SPONSORS': {
'ENABLED': false,
'BTCPAY_URL': '',
'BTCPAY_AUTH': '',
'BTCPAY_WEBHOOK_URL': '',
'TWITTER_BEARER_AUTH': ''
}
};
class Config implements IConfig {
@@ -127,10 +131,9 @@ class Config implements IConfig {
CORE_RPC: IConfig['CORE_RPC'];
CORE_RPC_MINFEE: IConfig['CORE_RPC_MINFEE'];
DATABASE: IConfig['DATABASE'];
SYSLOG: IConfig['SYSLOG'];
STATISTICS: IConfig['STATISTICS'];
BISQ_BLOCKS: IConfig['BISQ_BLOCKS'];
BISQ_MARKETS: IConfig['BISQ_MARKETS'];
SPONSORS: IConfig['SPONSORS'];
BISQ: IConfig['BISQ'];
constructor() {
const configs = this.merge(configFile, defaults);
@@ -140,10 +143,9 @@ class Config implements IConfig {
this.CORE_RPC = configs.CORE_RPC;
this.CORE_RPC_MINFEE = configs.CORE_RPC_MINFEE;
this.DATABASE = configs.DATABASE;
this.SYSLOG = configs.SYSLOG;
this.STATISTICS = configs.STATISTICS;
this.BISQ_BLOCKS = configs.BISQ_BLOCKS;
this.BISQ_MARKETS = configs.BISQ_MARKETS;
this.SPONSORS = configs.SPONSORS;
this.BISQ = configs.BISQ;
}
merge = (...objects: object[]): IConfig => {

View File

@@ -20,7 +20,7 @@ export async function checkDbConnection() {
logger.info('Database connection established.');
connection.release();
} catch (e) {
logger.err('Could not connect to database: ' + e.message || e);
logger.err('Could not connect to database: ' + (e instanceof Error ? e.message : e));
process.exit(1);
}
}

View File

@@ -1,7 +1,6 @@
import { Express, Request, Response, NextFunction } from 'express';
import * as express from 'express';
import * as http from 'http';
import * as https from 'https';
import * as WebSocket from 'ws';
import * as cluster from 'cluster';
import axios from 'axios';
@@ -17,7 +16,6 @@ import websocketHandler from './api/websocket-handler';
import fiatConversion from './api/fiat-conversion';
import bisq from './api/bisq/bisq';
import bisqMarkets from './api/bisq/markets';
import donations from './api/donations';
import logger from './logger';
import backendInfo from './api/backend-info';
import loadingIndicators from './api/loading-indicators';
@@ -25,7 +23,7 @@ import mempool from './api/mempool';
class Server {
private wss: WebSocket.Server | undefined;
private server: https.Server | http.Server | undefined;
private server: http.Server | undefined;
private app: Express;
private currentBackendRetryInterval = 5;
@@ -75,33 +73,27 @@ class Server {
this.server = http.createServer(this.app);
this.wss = new WebSocket.Server({ server: this.server });
this.setUpWebsocketHandling();
diskCache.loadMempoolCache();
if (config.DATABASE.ENABLED) {
await checkDbConnection();
}
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED && cluster.isMaster) {
statistics.startStatistics();
}
fiatConversion.startService();
if (config.SPONSORS.ENABLED) {
donations.$updateCache();
}
this.setUpHttpApiRoutes();
this.setUpWebsocketHandling();
this.runMainUpdateLoop();
if (config.BISQ_BLOCKS.ENABLED) {
if (config.BISQ.ENABLED) {
bisq.startBisqService();
bisq.setPriceCallbackFunction((price) => websocketHandler.setExtraInitProperties('bsq-price', price));
blocks.setNewBlockCallback(bisq.handleNewBitcoinBlock.bind(bisq));
}
if (config.BISQ_MARKETS.ENABLED) {
bisqMarkets.startBisqService();
}
@@ -116,13 +108,22 @@ class Server {
async runMainUpdateLoop() {
try {
await memPool.$updateMemPoolInfo();
try {
await memPool.$updateMemPoolInfo();
} catch (e) {
const msg = `updateMempoolInfo: ${(e instanceof Error ? e.message : e)}`;
if (config.CORE_RPC_MINFEE.ENABLED) {
logger.warn(msg);
} else {
logger.debug(msg);
}
}
await blocks.$updateBlocks();
await memPool.$updateMempool();
setTimeout(this.runMainUpdateLoop.bind(this), config.MEMPOOL.POLL_RATE_MS);
this.currentBackendRetryInterval = 5;
} catch (e) {
const loggerMsg = `runMainLoop error: ${(e.message || e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
const loggerMsg = `runMainLoop error: ${(e instanceof Error ? e.message : e)}. Retrying in ${this.currentBackendRetryInterval} sec.`;
if (this.currentBackendRetryInterval > 5) {
logger.warn(loggerMsg);
mempool.setOutOfSync();
@@ -144,7 +145,6 @@ class Server {
statistics.setNewStatisticsEntryCallback(websocketHandler.handleNewStatistic.bind(websocketHandler));
blocks.setNewBlockCallback(websocketHandler.handleNewBlock.bind(websocketHandler));
memPool.setMempoolChangedCallback(websocketHandler.handleMempoolChange.bind(websocketHandler));
donations.setNotfyDonationStatusCallback(websocketHandler.handleNewDonation.bind(websocketHandler));
fiatConversion.setProgressChangedCallback(websocketHandler.handleNewConversionRates.bind(websocketHandler));
loadingIndicators.setProgressChangedCallback(websocketHandler.handleLoadingChanged.bind(websocketHandler));
}
@@ -152,10 +152,49 @@ class Server {
setUpHttpApiRoutes() {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'transaction-times', routes.getTransactionTimes)
.get(config.MEMPOOL.API_URL_PREFIX + 'cpfp/:txId', routes.getCpfpInfo)
.get(config.MEMPOOL.API_URL_PREFIX + 'difficulty-adjustment', routes.getDifficultyChange)
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/recommended', routes.getRecommendedFees)
.get(config.MEMPOOL.API_URL_PREFIX + 'fees/mempool-blocks', routes.getMempoolBlocks)
.get(config.MEMPOOL.API_URL_PREFIX + 'backend-info', routes.getBackendInfo)
.get(config.MEMPOOL.API_URL_PREFIX + 'init-data', routes.getInitData)
.get(config.MEMPOOL.API_URL_PREFIX + 'validate-address/:address', routes.validateAddress)
.get(config.MEMPOOL.API_URL_PREFIX + 'donations', async (req, res) => {
try {
const response = await axios.get('https://mempool.space/api/v1/donations', { responseType: 'stream', timeout: 10000 });
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
})
.get(config.MEMPOOL.API_URL_PREFIX + 'donations/images/:id', async (req, res) => {
try {
const response = await axios.get('https://mempool.space/api/v1/donations/images/' + req.params.id, {
responseType: 'stream', timeout: 10000
});
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
})
.get(config.MEMPOOL.API_URL_PREFIX + 'contributors', async (req, res) => {
try {
const response = await axios.get('https://mempool.space/api/v1/contributors', { responseType: 'stream', timeout: 10000 });
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
})
.get(config.MEMPOOL.API_URL_PREFIX + 'contributors/images/:id', async (req, res) => {
try {
const response = await axios.get('https://mempool.space/api/v1/contributors/images/' + req.params.id, {
responseType: 'stream', timeout: 10000
});
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
})
;
if (config.STATISTICS.ENABLED && config.DATABASE.ENABLED) {
@@ -170,7 +209,7 @@ class Server {
;
}
if (config.BISQ_BLOCKS.ENABLED) {
if (config.BISQ.ENABLED) {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/stats', routes.getBisqStats)
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/tx/:txId', routes.getBisqTransaction)
@@ -179,11 +218,6 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/blocks/:index/:length', routes.getBisqBlocks)
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/address/:address', routes.getBisqAddress)
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/txs/:index/:length', routes.getBisqTransactions)
;
}
if (config.BISQ_MARKETS.ENABLED) {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/currencies', routes.getBisqMarketCurrencies.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/depth', routes.getBisqMarketDepth.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/hloc', routes.getBisqMarketHloc.bind(routes))
@@ -192,47 +226,21 @@ class Server {
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/ticker', routes.getBisqMarketTicker.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/trades', routes.getBisqMarketTrades.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/volumes', routes.getBisqMarketVolumes.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'bisq/markets/volumes/7d', routes.getBisqMarketVolumes7d.bind(routes))
;
}
if (config.SPONSORS.ENABLED) {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'donations', routes.getDonations.bind(routes))
.get(config.MEMPOOL.API_URL_PREFIX + 'donations/images/:id', routes.getSponsorImage.bind(routes))
.post(config.MEMPOOL.API_URL_PREFIX + 'donations', routes.createDonationRequest.bind(routes))
.post(config.MEMPOOL.API_URL_PREFIX + 'donations-webhook', routes.donationWebhook.bind(routes))
;
} else {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'donations', async (req, res) => {
try {
const response = await axios.get('https://mempool.space/api/v1/donations', { responseType: 'stream', timeout: 10000 });
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
})
.get(config.MEMPOOL.API_URL_PREFIX + 'donations/images/:id', async (req, res) => {
try {
const response = await axios.get('https://mempool.space/api/v1/donations/images/' + req.params.id, {
responseType: 'stream', timeout: 10000
});
response.data.pipe(res);
} catch (e) {
res.status(500).end();
}
});
}
if (config.MEMPOOL.BACKEND !== 'esplora') {
this.app
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool', routes.getMempool)
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool/txids', routes.getMempoolTxIds)
.get(config.MEMPOOL.API_URL_PREFIX + 'mempool/recent', routes.getRecentMempoolTransactions)
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId', routes.getTransaction)
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/hex', routes.getRawTransaction)
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/status', routes.getTransactionStatus)
.get(config.MEMPOOL.API_URL_PREFIX + 'tx/:txId/outspends', routes.getTransactionOutspends)
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash', routes.getBlock)
.get(config.MEMPOOL.API_URL_PREFIX + 'block/:hash/header', routes.getBlockHeader)
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks', routes.getBlocks)
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/:height', routes.getBlocks)
.get(config.MEMPOOL.API_URL_PREFIX + 'blocks/tip/height', routes.getBlockTipHeight)

View File

@@ -50,17 +50,11 @@ class Logger {
public debug: ((msg: string) => void);
private name = 'mempool';
private fac: any;
private loghost: string;
private logport: number;
private client: dgram.Socket;
private network: string;
constructor(fac) {
constructor() {
let prio;
this.fac = fac != null ? fac : Logger.facilities.local0;
this.loghost = '127.0.0.1';
this.logport = 514;
for (prio in Logger.priorities) {
if (true) {
this.addprio(prio);
@@ -79,7 +73,7 @@ class Logger {
}
private getNetwork(): string {
if (config.BISQ_BLOCKS.ENABLED) {
if (config.BISQ.ENABLED) {
return 'bisq';
}
if (config.MEMPOOL.NETWORK && config.MEMPOOL.NETWORK !== 'mainnet') {
@@ -97,10 +91,12 @@ class Logger {
}
const network = this.network ? ' <' + this.network + '>' : '';
prionum = Logger.priorities[priority] || Logger.priorities.info;
syslogmsg = `<${(this.fac * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`;
consolemsg = `${this.ts()} [${process.pid}] ${priority.toUpperCase()}:${network} ${msg}`;
this.syslog(syslogmsg);
if (config.SYSLOG.ENABLED && Logger.priorities[priority] <= Logger.priorities[config.SYSLOG.MIN_PRIORITY]) {
syslogmsg = `<${(Logger.facilities[config.SYSLOG.FACILITY] * 8 + prionum)}> ${this.name}[${process.pid}]: ${priority.toUpperCase()}${network} ${msg}`;
this.syslog(syslogmsg);
}
if (priority === 'warning') {
priority = 'warn';
}
@@ -116,7 +112,7 @@ class Logger {
private syslog(msg) {
let msgbuf;
msgbuf = Buffer.from(msg);
this.client.send(msgbuf, 0, msgbuf.length, this.logport, this.loghost, function(err, bytes) {
this.client.send(msgbuf, 0, msgbuf.length, config.SYSLOG.PORT, config.SYSLOG.HOST, function(err, bytes) {
if (err) {
console.log(err);
}
@@ -146,4 +142,4 @@ class Logger {
}
}
export default new Logger(Logger.facilities.local7);
export default new Logger();

View File

@@ -26,6 +26,28 @@ export interface TransactionExtended extends IEsploraApi.Transaction {
vsize: number;
feePerVsize: number;
firstSeen?: number;
effectiveFeePerVsize: number;
ancestors?: Ancestor[];
bestDescendant?: BestDescendant | null;
cpfpChecked?: boolean;
deleteAfter?: number;
}
interface Ancestor {
txid: string;
weight: number;
fee: number;
}
interface BestDescendant {
txid: string;
weight: number;
fee: number;
}
export interface CpfpInfo {
ancestors: Ancestor[];
bestDescendant: BestDescendant | null;
}
export interface TransactionStripped {
@@ -122,6 +144,7 @@ export interface WebsocketResponse {
'track-tx': string;
'track-address': string;
'watch-mempool': boolean;
'track-bisq-market': string;
}
export interface VbytesPerSecond {
@@ -138,3 +161,9 @@ interface RequiredParams {
export interface ILoadingIndicators { [name: string]: number; }
export interface IConversionRates { [currency: string]: number; }
export interface IBackendInfo {
hostname: string;
gitCommit: string;
version: string;
}

View File

@@ -8,16 +8,16 @@ import mempool from './api/mempool';
import bisq from './api/bisq/bisq';
import websocketHandler from './api/websocket-handler';
import bisqMarket from './api/bisq/markets-api';
import { OptimizedStatistic, RequiredSpec, TransactionExtended } from './mempool.interfaces';
import { RequiredSpec, TransactionExtended } from './mempool.interfaces';
import { MarketsApiError } from './api/bisq/interfaces';
import { IEsploraApi } from './api/bitcoin/esplora-api.interface';
import donations from './api/donations';
import logger from './logger';
import bitcoinApi from './api/bitcoin/bitcoin-api-factory';
import transactionUtils from './api/transaction-utils';
import blocks from './api/blocks';
import loadingIndicators from './api/loading-indicators';
import { Common } from './api/common';
import bitcoinBaseApi from './api/bitcoin/bitcoin-base.api';
class Routes {
constructor() {}
@@ -56,7 +56,7 @@ class Routes {
const result = websocketHandler.getInitData();
res.json(result);
} catch (e) {
res.status(500).send(e.message);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -75,7 +75,7 @@ class Routes {
const result = mempoolBlocks.getMempoolBlocks();
res.json(result);
} catch (e) {
res.status(500).send(e.message);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -95,83 +95,35 @@ class Routes {
res.json(times);
}
public getCpfpInfo(req: Request, res: Response) {
if (!/^[a-fA-F0-9]{64}$/.test(req.params.txId)) {
res.status(501).send(`Invalid transaction ID.`);
return;
}
const tx = mempool.getMempool()[req.params.txId];
if (!tx) {
res.status(404).send(`Transaction doesn't exist in the mempool.`);
return;
}
if (tx.cpfpChecked) {
res.json({
ancestors: tx.ancestors,
bestDescendant: tx.bestDescendant || null,
});
return;
}
const cpfpInfo = Common.setRelativesAndGetCpfpInfo(tx, mempool.getMempool());
res.json(cpfpInfo);
}
public getBackendInfo(req: Request, res: Response) {
res.json(backendInfo.getBackendInfo());
}
public async createDonationRequest(req: Request, res: Response) {
const constraints: RequiredSpec = {
'amount': {
required: true,
types: ['@float']
},
'orderId': {
required: true,
types: ['@string']
}
};
const p = this.parseRequestParameters(req.body, constraints);
if (p.error) {
res.status(400).send(p.error);
return;
}
if (p.orderId !== '' && !/^(@|)[a-zA-Z0-9_]{1,15}$/.test(p.orderId)) {
res.status(400).send('Invalid Twitter handle');
return;
}
if (p.amount < 0.001) {
res.status(400).send('Amount needs to be at least 0.001');
return;
}
if (p.amount > 1000) {
res.status(400).send('Amount too large');
return;
}
try {
const result = await donations.$createRequest(p.amount, p.orderId);
res.json(result);
} catch (e) {
res.status(500).send(e.message);
}
}
public async getDonations(req: Request, res: Response) {
try {
const result = await donations.$getDonationsFromDatabase('handle, imageUrl');
res.json(result);
} catch (e) {
res.status(500).send(e.message);
}
}
public async getSponsorImage(req: Request, res: Response) {
try {
const result = await donations.getSponsorImage(req.params.id);
if (result) {
res.set('Content-Type', 'image/jpeg');
res.send(result);
} else {
res.status(404).end();
}
} catch (e) {
res.status(500).send(e.message);
}
}
public async donationWebhook(req: Request, res: Response) {
try {
donations.$handleWebhookRequest(req.body);
res.end();
} catch (e) {
res.status(500).send(e);
}
}
public getBisqStats(req: Request, res: Response) {
const result = bisq.getStats();
res.json(result);
@@ -475,6 +427,15 @@ class Routes {
}
}
public getBisqMarketVolumes7d(req: Request, res: Response) {
const result = bisqMarket.getVolumesByTime(604800);
if (result) {
res.json(result);
} else {
res.status(500).json(this.getBisqMarketErrorResponse('getBisqMarketVolumes7d error'));
}
}
private parseRequestParameters(requestParams: object, params: RequiredSpec): { [name: string]: any; } {
const final = {};
for (const i in params) {
@@ -517,10 +478,24 @@ class Routes {
res.json(transaction);
} catch (e) {
let statusCode = 500;
if (e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
if (e instanceof Error && e instanceof Error && e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
statusCode = 404;
}
res.status(statusCode).send(e.message || e);
res.status(statusCode).send(e instanceof Error ? e.message : e);
}
}
public async getRawTransaction(req: Request, res: Response) {
try {
const transaction: IEsploraApi.Transaction = await bitcoinApi.$getRawTransaction(req.params.txId, true);
res.setHeader('content-type', 'text/plain');
res.send(transaction.hex);
} catch (e) {
let statusCode = 500;
if (e instanceof Error && e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
statusCode = 404;
}
res.status(statusCode).send(e instanceof Error ? e.message : e);
}
}
@@ -530,10 +505,10 @@ class Routes {
res.json(transaction.status);
} catch (e) {
let statusCode = 500;
if (e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
if (e instanceof Error && e.message && e.message.indexOf('No such mempool or blockchain transaction') > -1) {
statusCode = 404;
}
res.status(statusCode).send(e.message || e);
res.status(statusCode).send(e instanceof Error ? e.message : e);
}
}
@@ -542,7 +517,17 @@ class Routes {
const result = await bitcoinApi.$getBlock(req.params.hash);
res.json(result);
} catch (e) {
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
public async getBlockHeader(req: Request, res: Response) {
try {
const blockHeader = await bitcoinApi.$getBlockHeader(req.params.hash);
res.setHeader('content-type', 'text/plain');
res.send(blockHeader);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -579,7 +564,7 @@ class Routes {
res.json(returnBlocks);
} catch (e) {
loadingIndicators.setProgress('blocks', 100);
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -598,13 +583,13 @@ class Routes {
transactions.push(transaction);
loadingIndicators.setProgress('blocktxs-' + req.params.hash, (i + 1) / endIndex * 100);
} catch (e) {
logger.debug('getBlockTransactions error: ' + e.message || e);
logger.debug('getBlockTransactions error: ' + (e instanceof Error ? e.message : e));
}
}
res.json(transactions);
} catch (e) {
loadingIndicators.setProgress('blocktxs-' + req.params.hash, 100);
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -613,7 +598,7 @@ class Routes {
const blockHash = await bitcoinApi.$getBlockHash(parseInt(req.params.height, 10));
res.send(blockHash);
} catch (e) {
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -627,10 +612,10 @@ class Routes {
const addressData = await bitcoinApi.$getAddress(req.params.address);
res.json(addressData);
} catch (e) {
if (e.message && e.message.indexOf('exceeds') > 0) {
return res.status(413).send(e.message);
if (e instanceof Error && e.message && e.message.indexOf('exceeds') > 0) {
return res.status(413).send(e instanceof Error ? e.message : e);
}
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -644,10 +629,10 @@ class Routes {
const transactions = await bitcoinApi.$getAddressTransactions(req.params.address, req.params.txId);
res.json(transactions);
} catch (e) {
if (e.message && e.message.indexOf('exceeds') > 0) {
return res.status(413).send(e.message);
if (e instanceof Error && e.message && e.message.indexOf('exceeds') > 0) {
return res.status(413).send(e instanceof Error ? e.message : e);
}
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -660,7 +645,7 @@ class Routes {
const blockHash = await bitcoinApi.$getAddressPrefix(req.params.prefix);
res.send(blockHash);
} catch (e) {
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -681,7 +666,7 @@ class Routes {
const rawMempool = await bitcoinApi.$getRawMempool();
res.send(rawMempool);
} catch (e) {
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -690,7 +675,7 @@ class Routes {
const result = await bitcoinApi.$getBlockHeightTip();
res.json(result);
} catch (e) {
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
@@ -699,13 +684,76 @@ class Routes {
const result = await bitcoinApi.$getTxIdsForBlock(req.params.hash);
res.json(result);
} catch (e) {
res.status(500).send(e.message || e);
res.status(500).send(e instanceof Error ? e.message : e);
}
}
public async validateAddress(req: Request, res: Response) {
try {
const result = await bitcoinBaseApi.$validateAddress(req.params.address);
res.json(result);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
public getTransactionOutspends(req: Request, res: Response) {
res.status(501).send('Not implemented');
}
public getDifficultyChange(req: Request, res: Response) {
try {
const DATime = blocks.getLastDifficultyAdjustmentTime();
const previousRetarget = blocks.getPreviousDifficultyRetarget();
const blockHeight = blocks.getCurrentBlockHeight();
const now = new Date().getTime() / 1000;
const diff = now - DATime;
const blocksInEpoch = blockHeight % 2016;
const progressPercent = (blocksInEpoch >= 0) ? blocksInEpoch / 2016 * 100 : 100;
const remainingBlocks = 2016 - blocksInEpoch;
const nextRetargetHeight = blockHeight + remainingBlocks;
let difficultyChange = 0;
if (blocksInEpoch > 0) {
difficultyChange = (600 / (diff / blocksInEpoch ) - 1) * 100;
}
if (difficultyChange > 300) {
difficultyChange = 300;
}
if (difficultyChange < -75) {
difficultyChange = -75;
}
const timeAvgDiff = difficultyChange * 0.1;
let timeAvgMins = 10;
if (timeAvgDiff > 0) {
timeAvgMins -= Math.abs(timeAvgDiff);
} else {
timeAvgMins += Math.abs(timeAvgDiff);
}
const timeAvg = timeAvgMins * 60;
const remainingTime = remainingBlocks * timeAvg;
const estimatedRetargetDate = remainingTime + now;
const result = {
progressPercent,
difficultyChange,
estimatedRetargetDate,
remainingBlocks,
remainingTime,
previousRetarget,
nextRetargetHeight,
timeAvg,
};
res.json(result);
} catch (e) {
res.status(500).send(e instanceof Error ? e.message : e);
}
}
}
export default new Routes();

101
docker/README.md Normal file
View File

@@ -0,0 +1,101 @@
# Docker
## Initialization
In an empty dir create 2 sub-dirs
```bash
mkdir -p data mysql/data mysql/db-scripts
```
In the `mysql/db-scripts` sub-dir add the `mariadb-structure.sql` file from the mempool repo
Your dir should now look like that:
```bash
$ls -R
.:
data mysql
./data:
./mysql:
data db-scripts
./mysql/data:
./mysql/db-scripts:
mariadb-structure.sql
```
In the main dir add the following `docker-compose.yml`
```bash
version: "3.7"
services:
web:
image: mempool/frontend:latest
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'"
ports:
- 80:8080
environment:
FRONTEND_HTTP_PORT: "8080"
BACKEND_MAINNET_HTTP_HOST: "api"
api:
image: mempool/backend:latest
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh"
volumes:
- ./data:/backend/cache
environment:
RPC_HOST: "127.0.0.1"
RPC_PORT: "8332"
RPC_USER: "mempool"
RPC_PASS: "mempool"
ELECTRUM_HOST: "127.0.0.1"
ELECTRUM_PORT: "50002"
ELECTRUM_TLS: "false"
MYSQL_HOST: "db"
MYSQL_PORT: "3306"
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASS: "mempool"
BACKEND_MAINNET_HTTP_PORT: "8999"
CACHE_DIR: "/backend/cache"
MEMPOOL_CLEAR_PROTECTION_MINUTES: "20"
db:
image: mariadb:10.5.8
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/db-scripts:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"
```
You can update all the environment variables inside the API container, especially the RPC and ELECTRUM ones
## Run it
To run our docker-compose use the following cmd:
```bash
docker-compose up
```
If everything went okay you should see the beautiful mempool :grin:
If you get stuck on "loading blocks", this means the websocket can't connect.
Check your nginx proxy setup, firewalls, etc. and open an issue if you need help.

View File

@@ -3,17 +3,11 @@ FROM node:12-buster-slim AS builder
WORKDIR /build
COPY . .
RUN sed -i "s!../.git/refs/heads/master!master!g" ./src/api/backend-info.ts
RUN apt-get update
RUN apt-get install -y build-essential python3 pkg-config
RUN npm ci --production
RUN npm i typescript
RUN npm install
RUN npm run build
RUN mv ./docker/* .
RUN mv ./mempool-config-docker.json ./mempool-config.json
FROM node:12-buster-slim
WORKDIR /backend

View File

@@ -6,7 +6,8 @@
"SPAWN_CLUSTER_PROCS": 0,
"API_URL_PREFIX": "/api/v1/",
"POLL_RATE_MS": 2000,
"CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__"
"CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__",
"CLEAR_PROTECTION_MINUTES": __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__
},
"CORE_RPC": {
"HOST": "__BITCOIN_MAINNET_RPC_HOST__",
@@ -15,10 +16,9 @@
"PASSWORD": "__BITCOIN_MAINNET_RPC_PASS__"
},
"ELECTRUM": {
"HOST": "__ELECTRS_MAINNET_HTTP_HOST__",
"PORT": __ELECTRS_MAINNET_HTTP_PORT__,
"TLS_ENABLED": false,
"TX_LOOKUPS": true
"HOST": "__ELECTRUM_MAINNET_HTTP_HOST__",
"PORT": __ELECTRUM_MAINNET_HTTP_PORT__,
"TLS_ENABLED": __ELECTRUM_MAINNET_TLS_ENABLED__
},
"ESPLORA": {
"REST_API_URL": "http://127.0.0.1:3000"
@@ -27,9 +27,9 @@
"ENABLED": true,
"HOST": "__MYSQL_HOST__",
"PORT": __MYSQL_PORT__,
"DATABASE": "mempool",
"USERNAME": "mempool",
"PASSWORD": "mempool"
"DATABASE": "__MYSQL_DATABASE__",
"USERNAME": "__MYSQL_USERNAME__",
"PASSWORD": "__MYSQL_PASSWORD__"
},
"STATISTICS": {
"ENABLED": true,

View File

@@ -2,18 +2,23 @@
#MEMPOOL
__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999}
__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./}
__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache}
__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20}
# BITCOIN
__BITCOIN_MAINNET_RPC_HOST__=${RPC_HOST:=127.0.0.1}
__BITCOIN_MAINNET_RPC_PORT__=${RPC_PORT:=8332}
__BITCOIN_MAINNET_RPC_USER__=${RPC_USER:=mempool}
__BITCOIN_MAINNET_RPC_PASS__=${RPC_PASS:=mempool}
# ELECTRUM
__ELECTRS_MAINNET_HTTP_HOST__=${ELECTRS_HOST:=127.0.0.1}
__ELECTRS_MAINNET_HTTP_PORT__=${ELECTRS_PORT:=50002}
__ELECTRUM_MAINNET_HTTP_HOST__=${ELECTRUM_HOST:=127.0.0.1}
__ELECTRUM_MAINNET_HTTP_PORT__=${ELECTRUM_PORT:=50002} # 50001?
__ELECTRUM_MAINNET_TLS_ENABLED__=${ELECTRUM_TLS:=false}
# MYSQL
__MYSQL_HOST__=${MYSQL_HOST:=127.0.0.1}
__MYSQL_PORT__=${MYSQL_PORT:=3306}
__MYSQL_DATABASE__=${MYSQL_DATABASE:=mempool}
__MYSQL_USERNAME__=${MYSQL_USER:=mempool}
__MYSQL_PASSWORD__=${MYSQL_PASS:=mempool}
mkdir -p "${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}"
@@ -21,11 +26,16 @@ sed -i "s/__BITCOIN_MAINNET_RPC_HOST__/${__BITCOIN_MAINNET_RPC_HOST__}/g" mempoo
sed -i "s/__BITCOIN_MAINNET_RPC_PORT__/${__BITCOIN_MAINNET_RPC_PORT__}/g" mempool-config.json
sed -i "s/__BITCOIN_MAINNET_RPC_USER__/${__BITCOIN_MAINNET_RPC_USER__}/g" mempool-config.json
sed -i "s/__BITCOIN_MAINNET_RPC_PASS__/${__BITCOIN_MAINNET_RPC_PASS__}/g" mempool-config.json
sed -i "s/__ELECTRS_MAINNET_HTTP_HOST__/${__ELECTRS_MAINNET_HTTP_HOST__}/g" mempool-config.json
sed -i "s/__ELECTRS_MAINNET_HTTP_PORT__/${__ELECTRS_MAINNET_HTTP_PORT__}/g" mempool-config.json
sed -i "s/__ELECTRUM_MAINNET_HTTP_HOST__/${__ELECTRUM_MAINNET_HTTP_HOST__}/g" mempool-config.json
sed -i "s/__ELECTRUM_MAINNET_HTTP_PORT__/${__ELECTRUM_MAINNET_HTTP_PORT__}/g" mempool-config.json
sed -i "s/__ELECTRUM_MAINNET_TLS_ENABLED__/${__ELECTRUM_MAINNET_TLS_ENABLED__}/g" mempool-config.json
sed -i "s/__MYSQL_HOST__/${__MYSQL_HOST__}/g" mempool-config.json
sed -i "s/__MYSQL_PORT__/${__MYSQL_PORT__}/g" mempool-config.json
sed -i "s/__MYSQL_DATABASE__/${__MYSQL_DATABASE__}/g" mempool-config.json
sed -i "s/__MYSQL_USERNAME__/${__MYSQL_USERNAME__}/g" mempool-config.json
sed -i "s/__MYSQL_PASSWORD__/${__MYSQL_PASSWORD__}/g" mempool-config.json
sed -i "s!__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__!${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}!g" mempool-config.json
sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/${__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__}/g" mempool-config.json
sed -i "s/__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json
node /backend/dist/index.js

67
docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,67 @@
version: "3.7"
services:
electrum:
build:
context: .
dockerfile: docker/electrum/Dockerfile
user: "1000:1000"
restart: on-failure
command: ""
ports:
- 50001:50001
- 50002:50002
- 4224:4224
- 8332:8332
environment:
ELECTRUM: "electrum"
# add electrs configs
web:
image: mempool/frontend:latest
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'"
ports:
- 80:8080
environment:
FRONTEND_HTTP_PORT: "8080"
BACKEND_MAINNET_HTTP_HOST: "api"
api:
image: mempool/backend:latest
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh"
volumes:
- ./data:/backend/cache
environment:
RPC_HOST: "127.0.0.1"
RPC_PORT: "8332"
RPC_USER: "mempool"
RPC_PASS: "mempool"
ELECTRUM_HOST: "127.0.0.1"
ELECTRUM_PORT: "50002"
ELECTRUM_TLS: "false"
MYSQL_HOST: "db"
MYSQL_PORT: "3306"
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASS: "mempool"
BACKEND_MAINNET_HTTP_PORT: "8999"
CACHE_DIR: "/backend/cache"
MEMPOOL_CLEAR_PROTECTION_MINUTES: "20"
db:
image: mariadb:10.5.8
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/db-scripts:/docker-entrypoint-initdb.d
environment:
MYSQL_DATABASE: "mempool"
MYSQL_USER: "mempool"
MYSQL_PASSWORD: "mempool"
MYSQL_ROOT_PASSWORD: "admin"

View File

@@ -0,0 +1,32 @@
FROM ubuntu:18.04
MAINTAINER mempool.space developers
EXPOSE 50002
# runs as UID 1000 GID 1000 inside the container
ENV VERSION 4.0.9
RUN set -x \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gpg gpg-agent dirmngr \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget xpra python3-pyqt5 python3-wheel python3-pip python3-setuptools libsecp256k1-0 libsecp256k1-dev python3-numpy python3-dev build-essential \
&& wget -O /tmp/Electrum-${VERSION}.tar.gz https://download.electrum.org/${VERSION}/Electrum-${VERSION}.tar.gz \
&& wget -O /tmp/Electrum-${VERSION}.tar.gz.asc https://download.electrum.org/${VERSION}/Electrum-${VERSION}.tar.gz.asc \
&& gpg --keyserver keys.gnupg.net --recv-keys 6694D8DE7BE8EE5631BED9502BD5824B7F9470E6 \
&& gpg --verify /tmp/Electrum-${VERSION}.tar.gz.asc /tmp/Electrum-${VERSION}.tar.gz \
&& pip3 install /tmp/Electrum-${VERSION}.tar.gz \
&& test -f /usr/local/bin/electrum \
&& rm -vrf /tmp/Electrum-${VERSION}.tar.gz /tmp/Electrum-${VERSION}.tar.gz.asc ${HOME}/.gnupg \
&& apt-get purge --autoremove -y python3-wheel python3-pip python3-setuptools python3-dev build-essential libsecp256k1-dev curl gpg gpg-agent dirmngr \
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& useradd -d /home/mempool -m mempool \
&& mkdir /electrum \
&& ln -s /electrum /home/mempool/.electrum \
&& chown mempool:mempool /electrum
USER mempool
ENV HOME /home/mempool
WORKDIR /home/mempool
VOLUME /electrum
CMD ["/usr/bin/xpra", "start", ":100", "--start-child=/usr/local/bin/electrum", "--bind-tcp=0.0.0.0:50002","--daemon=yes", "--notifications=no", "--mdns=no", "--pulseaudio=no", "--html=off", "--speaker=disabled", "--microphone=disabled", "--webcam=no", "--printing=no", "--dbus-launch=", "--exit-with-children"]
ENTRYPOINT ["electrum"]

View File

@@ -1,5 +1,9 @@
FROM node:12-buster-slim AS builder
ARG commitHash
ENV DOCKER_COMMIT_HASH=${commitHash}
ENV CYPRESS_INSTALL_BINARY=0
WORKDIR /build
COPY . .
RUN apt-get update
@@ -7,8 +11,6 @@ RUN apt-get install -y build-essential rsync
RUN npm i
RUN npm run build
RUN mv ./docker/* .
FROM nginx:1.17.8-alpine
WORKDIR /patch
@@ -25,13 +27,12 @@ RUN chmod +x /patch/wait-for
RUN chown -R 1000:1000 /patch && chmod -R 755 /patch && \
chown -R 1000:1000 /var/cache/nginx && \
chown -R 1000:1000 /var/log/nginx && \
chown -R 1000:1000 /etc/nginx/nginx.conf && \
chown -R 1000:1000 /etc/nginx/conf.d
RUN touch /var/run/nginx.pid && \
chown -R 1000:1000 /var/run/nginx.pid
USER 1000
EXPOSE 8080
ENTRYPOINT ["/patch/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,8 +1,13 @@
#!/bin/sh
__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__=${BACKEND_MAINNET_HTTP_HOST:=127.0.0.1}
__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999}
__MEMPOOL_FRONTEND_HTTP_PORT__=${FRONTEND_HTTP_PORT:=8080}
sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__/${__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__}/g" /etc/nginx/conf.d/nginx-mempool.conf
sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/${__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__}/g" /etc/nginx/conf.d/nginx-mempool.conf
cp /etc/nginx/nginx.conf /patch/nginx.conf
sed -i "s/__MEMPOOL_FRONTEND_HTTP_PORT__/${__MEMPOOL_FRONTEND_HTTP_PORT__}/g" /patch/nginx.conf
cat /patch/nginx.conf > /etc/nginx/nginx.conf
exec "$@"

18
docker/init.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
#backend
gitMaster="\.\.\/\.git\/refs\/heads\/master"
git ls-remote https://github.com/mempool/mempool.git $1 | awk '{ print $1}' > ./backend/master
cp ./docker/backend/* ./backend/
sed -i "s/${gitMaster}/master/g" ./backend/src/api/backend-info.ts
#frontend
localhostIP="127.0.0.1"
cp ./docker/frontend/* ./frontend
cp ./nginx.conf ./frontend/
cp ./nginx-mempool.conf ./frontend/
sed -i "s/${localhostIP}:80/0.0.0.0:__MEMPOOL_FRONTEND_HTTP_PORT__/g" ./frontend/nginx.conf
sed -i "s/${localhostIP}/0.0.0.0/g" ./frontend/nginx.conf
sed -i "s/user nobody;//g" ./frontend/nginx.conf
sed -i "s!/etc/nginx/nginx-mempool.conf!/etc/nginx/conf.d/nginx-mempool.conf!g" ./frontend/nginx.conf
sed -i "s/${localhostIP}:8999/__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/g" ./frontend/nginx-mempool.conf

View File

@@ -0,0 +1,18 @@
#!/bin/sh
VERSION=$1
IMAGE=""
if [ -z "${VERSION}" ]; then
echo "no version provided (i.e, v2.2.0), using latest tag"
VERSION="latest"
fi
for package in frontend backend; do
PACKAGE=mempool/"$package"
IMAGE="$PACKAGE":"$VERSION"
HASH=`docker pull $IMAGE > /dev/null && docker inspect $IMAGE | sed -n '/RepoDigests/{n;p;}' | grep -o '[0-9a-f]\{64\}'`
if [ -n "${HASH}" ]; then
echo "$IMAGE"@sha256:"$HASH"
fi
done

8
frontend/.gitignore vendored
View File

@@ -54,3 +54,11 @@ src/resources/pools.json
# environment config
mempool-frontend-config.json
generated-config.js
# e2e results
cypress/videos
cypress/screenshots
# Base index
src/index.html

View File

@@ -16,11 +16,13 @@ https://www.transifex.com/mempool/mempool/dashboard/
* French @Bayernatoor
* Korean @kcalvinalvinn
* Italian @HodlBits
* Hebrew @Sh0ham
* Georgian @wyd_idk
* Hungarian @btcdragonlord
* Dutch @m__btc
* Japanese @wiz @japananon
* Norwegian @T82771355
* Polish @maciejsoltysiak
* Portugese @jgcastro1985
* Slovenian @thepkbadger
* Finnish @bio_bitcoin
@@ -29,3 +31,4 @@ https://www.transifex.com/mempool/mempool/dashboard/
* Ukrainian @volbil
* Vietnamese @bitcoin_vietnam
* Chinese @wdljt
* Russian @TonyCrusoe @Bitconan

View File

@@ -1,5 +1,8 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": false
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
@@ -15,14 +18,18 @@
"prefix": "app",
"i18n": {
"sourceLocale": {
"code":"en-US",
"baseHref":"/"
"code": "en-US",
"baseHref": "/"
},
"locales": {
"ar": {
"translation": "src/locale/messages.ar.xlf",
"baseHref": "/ar/"
},
"ca": {
"translation": "src/locale/messages.ca.xlf",
"baseHref": "/ca/"
},
"cs": {
"translation": "src/locale/messages.cs.xlf",
"baseHref": "/cs/"
@@ -59,6 +66,10 @@
"translation": "src/locale/messages.it.xlf",
"baseHref": "/it/"
},
"he": {
"translation": "src/locale/messages.he.xlf",
"baseHref": "/he/"
},
"nl": {
"translation": "src/locale/messages.nl.xlf",
"baseHref": "/nl/"
@@ -67,6 +78,10 @@
"translation": "src/locale/messages.nb.xlf",
"baseHref": "/nb/"
},
"pl": {
"translation": "src/locale/messages.pl.xlf",
"baseHref": "/pl/"
},
"pt": {
"translation": "src/locale/messages.pt.xlf",
"baseHref": "/pt/"
@@ -102,6 +117,14 @@
"zh": {
"translation": "src/locale/messages.zh.xlf",
"baseHref": "/zh/"
},
"ru": {
"translation": "src/locale/messages.ru.xlf",
"baseHref": "/ru/"
},
"hi": {
"translation": "src/locale/messages.hi.xlf",
"baseHref": "/hi/"
}
}
},
@@ -139,7 +162,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
@@ -166,6 +188,22 @@
"configurations": {
"production": {
"browserTarget": "mempool:build:production"
},
"local": {
"proxyConfig": "proxy.conf.json",
"verbose": true
},
"staging": {
"proxyConfig": "proxy.stg.conf.json",
"disableHostCheck": true,
"host": "0.0.0.0",
"verbose": true
},
"local-prod": {
"proxyConfig": "proxy.conf.js",
"disableHostCheck": true,
"host": "0.0.0.0",
"verbose": false
}
}
},
@@ -198,8 +236,8 @@
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"e2e/tsconfig.json",
"tsconfig.server.json"
"tsconfig.server.json",
"cypress/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
@@ -207,10 +245,11 @@
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"builder": "@cypress/schematic:cypress",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "mempool:serve"
"devServerTarget": "mempool:serve:local-prod",
"watch": true,
"headless": false
},
"configurations": {
"production": {
@@ -265,8 +304,27 @@
"configurations": {
"production": {}
}
},
"cypress-run": {
"builder": "@cypress/schematic:cypress",
"options": {
"devServerTarget": "mempool:serve"
},
"configurations": {
"production": {
"devServerTarget": "mempool:serve:production"
}
}
},
"cypress-open": {
"builder": "@cypress/schematic:cypress",
"options": {
"watch": true,
"headless": false
}
}
}
}},
}
},
"defaultProject": "mempool"
}

15
frontend/cypress.json Normal file
View File

@@ -0,0 +1,15 @@
{
"projectId": "ry4br7",
"integrationFolder": "cypress/integration",
"supportFile": "cypress/support/index.ts",
"videosFolder": "cypress/videos",
"screenshotsFolder": "cypress/screenshots",
"pluginsFile": "cypress/plugins/index.js",
"fixturesFolder": "cypress/fixtures",
"baseUrl": "http://localhost:4200",
"video": false,
"retries": {
"runMode": 3,
"openMode": 0
}
}

View File

@@ -0,0 +1,119 @@
{
"f59c5f3e8141f322276daa63ed5f307085808aea6d4ef9ba61e28154533fdec7": {
"asset_id": "f59c5f3e8141f322276daa63ed5f307085808aea6d4ef9ba61e28154533fdec7",
"contract": {
"entity": {
"domain": "listedreserve.com"
},
"issuer_pubkey": "031cc579d142a03b33cdd745922112821c16e5e8b74e3bd57f16f7fda872b6f1d0",
"name": "Liquid AUD",
"precision": 2,
"ticker": "AUDL",
"version": 0
},
"issuance_txin": {
"txid": "e5c5144ba3dc48259ae29023fe9f7775dec1fc049f456dd3d1f7178e31901fb5",
"vin": 0
},
"issuance_prevout": {
"txid": "ed48be2e035ffa425d2c6faaa82b6a7b648aed1246b6ac76c72e0408db8cf057",
"vout": 1
},
"name": "Liquid AUD",
"ticker": "AUDL",
"precision": 2,
"entity": {
"domain": "listedreserve.com"
},
"version": 0,
"issuer_pubkey": "031cc579d142a03b33cdd745922112821c16e5e8b74e3bd57f16f7fda872b6f1d0"
},
"0e99c1a6da379d1f4151fb9df90449d40d0608f6cb33a5bcbfc8c265f42bab0a": {
"asset_id": "0e99c1a6da379d1f4151fb9df90449d40d0608f6cb33a5bcbfc8c265f42bab0a",
"contract": {
"entity": {
"domain": "lcad.bullbitcoin.com"
},
"issuer_pubkey": "027fa34026195b05f3aa217335416811dca4f5b579d00271a1bb6304c0152458a8",
"name": "Liquid CAD",
"precision": 8,
"ticker": "LCAD",
"version": 0
},
"issuance_txin": {
"txid": "238badf029cadcf546d90ce23c7eafc2fa2082585c9bd62dc26f1aa11c7bd850",
"vin": 0
},
"issuance_prevout": {
"txid": "a87f13917c08c7ccd8eddb1830c5c9a2bcd59c7d167e9d528659ba40808a6b76",
"vout": 0
},
"name": "Liquid CAD",
"ticker": "LCAD",
"precision": 8,
"entity": {
"domain": "lcad.bullbitcoin.com"
},
"version": 0,
"issuer_pubkey": "027fa34026195b05f3aa217335416811dca4f5b579d00271a1bb6304c0152458a8"
},
"3438ecb49fc45c08e687de4749ed628c511e326460ea4336794e1cf02741329e": {
"asset_id": "3438ecb49fc45c08e687de4749ed628c511e326460ea4336794e1cf02741329e",
"contract": {
"entity": {
"domain": "settlenet.io"
},
"issuer_pubkey": "037b09d542bf7cea6a19fa624b4441790c1a6e44823597bf190e981a846a196541",
"name": "SETTLENET JPY Stablecoin by Crypto Garage",
"precision": 0,
"ticker": "JPYS",
"version": 0
},
"issuance_txin": {
"txid": "e33ad5ce8879297d8bfa7daa193920b94abd3fb12f4e8dade9543dbb292387cb",
"vin": 0
},
"issuance_prevout": {
"txid": "328c4fadd817ea75e634e3648eb4be0bf7e669539b8da921c0f77af3bc148894",
"vout": 1
},
"name": "SETTLENET JPY Stablecoin by Crypto Garage",
"ticker": "JPYS",
"precision": 0,
"entity": {
"domain": "settlenet.io"
},
"version": 0,
"issuer_pubkey": "037b09d542bf7cea6a19fa624b4441790c1a6e44823597bf190e981a846a196541"
},
"ce091c998b83c78bb71a632313ba3760f1763d9cfcffae02258ffa9865a37bd2": {
"asset_id": "ce091c998b83c78bb71a632313ba3760f1763d9cfcffae02258ffa9865a37bd2",
"contract": {
"entity": {
"domain": "tether.to"
},
"issuer_pubkey": "0337cceec0beea0232ebe14cba0197a9fbd45fcf2ec946749de920e71434c2b904",
"name": "Tether USD",
"precision": 8,
"ticker": "USDt",
"version": 0
},
"issuance_txin": {
"txid": "abb4080d91849e933ee2ed65da6b436f7c385cf363fb4aa08399f1e27c58ff3d",
"vin": 0
},
"issuance_prevout": {
"txid": "9596d259270ef5bac0020435e6d859aea633409483ba64e232b8ba04ce288668",
"vout": 0
},
"name": "Tether USD",
"ticker": "USDt",
"precision": 8,
"entity": {
"domain": "tether.to"
},
"version": 0,
"issuer_pubkey": "0337cceec0beea0232ebe14cba0197a9fbd45fcf2ec946749de920e71434c2b904"
}
}

View File

@@ -0,0 +1,33 @@
{
"f59c5f3e8141f322276daa63ed5f307085808aea6d4ef9ba61e28154533fdec7": [
"listedreserve.com",
"AUDL",
"Liquid AUD",
2
],
"0e99c1a6da379d1f4151fb9df90449d40d0608f6cb33a5bcbfc8c265f42bab0a": [
"lcad.bullbitcoin.com",
"LCAD",
"Liquid CAD",
8
],
"6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d": [
null,
"L-BTC",
"Liquid Bitcoin",
8
],
"ce091c998b83c78bb71a632313ba3760f1763d9cfcffae02258ffa9865a37bd2": [
"tether.to",
"USDt",
"Tether USD",
8
],
"3438ecb49fc45c08e687de4749ed628c511e326460ea4336794e1cf02741329e": [
"settlenet.io",
"JPYS",
"SETTLENET JPY Stablecoin by Crypto Garage",
0
]
}

View File

@@ -0,0 +1 @@
{"live-2h-chart":{"id":1319298,"added":"2021-07-23T18:27:34.000Z","unconfirmed_transactions":546,"tx_per_second":3.93333,"vbytes_per_second":1926,"mempool_byte_weight":1106656,"total_fee":6198583,"vsizes":[255,18128,43701,58534,17144,5532,4483,1759,2394,1089,1683,7409,751,101010,1151,592,1497,703,1369,4747,800,1221,0,0,712,0,0,0,0,0,0,0,0,0,0,0,0,0]}}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
describe('Bisq', () => {
let baseModule;
beforeEach(() => {
baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'bisq') ? '' : '/bisq';
cy.intercept('/sockjs-node/info*').as('socket');
cy.intercept('/bisq/api/markets/hloc?market=btc_usd&interval=day').as('hloc');
cy.intercept('/bisq/api/markets/ticker').as('ticker');
cy.intercept('/bisq/api/markets/markets').as('markets');
cy.intercept('/bisq/api/markets/volumes/7d').as('7d');
cy.intercept('/bisq/api/markets/trades?market=all').as('trades');
cy.intercept('/bisq/api/txs/*/*').as('txs');
cy.intercept('/bisq/api/blocks/*/*').as('blocks');
cy.intercept('/bisq/api/stats').as('stats');
Cypress.Commands.add('waitForDashboard', () => {
cy.wait('@socket');
cy.wait('@hloc');
cy.wait('@ticker');
cy.wait('@markets');
cy.wait('@7d');
cy.wait('@trades');
});
});
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'liquid') {
it('loads the dashboard', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
});
it('loads the transactions screen', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(2) > a').click().then(() => {
cy.get('.table > tr').should('have.length', 50);
});
});
it('loads the blocks screen', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait('@blocks');
cy.get('tbody tr').should('have.length', 10);
});
});
it('loads the stats screen', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.wait('@stats');
});
});
it('loads the api screen', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.get('.card').should('have.length.at.least', 1);
cy.get('.card').first().click();
cy.get('.card-body');
});
});
it('shows blocks pagination with 5 pages (desktop)', () => {
cy.viewport(760, 800);
cy.visit(`${baseModule}/blocks`);
cy.waitForSkeletonGone();
cy.get('tbody tr').should('have.length', 10);
// 5 pages + 4 buttons = 9 buttons
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9);
});
it('shows blocks pagination with 3 pages (mobile)', () => {
cy.viewport(669, 800);
cy.visit(`${baseModule}/blocks`);
cy.waitForSkeletonGone();
cy.get('tbody tr').should('have.length', 10);
// 3 pages + 4 buttons = 7 buttons
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7);
});
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
});

View File

@@ -0,0 +1,147 @@
describe('Liquid', () => {
let baseModule;
beforeEach(() => {
baseModule = (Cypress.env('BASE_MODULE') && Cypress.env('BASE_MODULE') === 'liquid') ? '' : '/liquid';
cy.intercept('/liquid/api/block/**').as('block');
cy.intercept('/liquid/api/blocks/').as('blocks');
cy.intercept('/liquid/api/tx/**/outspends').as('outspends');
cy.intercept('/liquid/api/block/**/txs/**').as('block-txs');
cy.intercept('/resources/pools.json').as('pools');
Cypress.Commands.add('waitForBlockData', () => {
cy.wait('@socket');
cy.wait('@block');
cy.wait('@outspends');
});
});
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") !== 'bisq') {
it('loads the dashboard', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
});
it('loads the blocks page', () => {
cy.visit(`${baseModule}/blocks`);
cy.waitForSkeletonGone();
});
it('loads a specific block page', () => {
cy.visit(`${baseModule}/block/7e1369a23a5ab861e7bdede2aadcccae4ea873ffd9caf11c7c5541eb5bcdff54`);
cy.waitForSkeletonGone();
});
it('loads the graphs page', () => {
cy.visit(`${baseModule}/graphs`);
cy.waitForSkeletonGone();
});
it('loads the tv page - desktop', () => {
cy.visit(`${baseModule}`);
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait(1000);
});
});
it('loads the graphs page - mobile', () => {
cy.visit(`${baseModule}`)
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.viewport('iphone-6');
cy.wait(1000);
cy.get('.tv-only').should('not.exist');
});
});
describe('assets', () => {
it('shows the assets screen', () => {
cy.visit(`${baseModule}/assets`);
cy.waitForSkeletonGone();
cy.get('table tr').should('have.length.at.least', 5);
});
it('allows searching assets', () => {
cy.visit(`${baseModule}/assets`);
cy.waitForSkeletonGone();
cy.get('.container-xl input').click().type('Liquid Bitcoin').then(() => {
cy.get('table tr').should('have.length', 1);
});
});
it('shows a specific asset ID', () => {
cy.visit(`${baseModule}/assets`);
cy.waitForSkeletonGone();
cy.get('.container-xl input').click().type('Liquid AUD').then(() => {
cy.get('table tr td:nth-of-type(1) a').click();
});
});
});
describe('unblinded TX', () => {
it('should not show an unblinding error message for regular txs', () => {
cy.visit(`${baseModule}/tx/82a479043ec3841e0d3f829afc8df4f0e2bbd675a13f013ea611b2fde0027d45`);
cy.waitForSkeletonGone();
cy.get('.error-unblinded' ).should('not.exist');
});
it('show unblinded TX', () => {
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`);
cy.waitForSkeletonGone();
cy.get('#table-tx-vin tr').should('have.class', 'assetBox');
cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
});
it('show empty unblinded TX', () => {
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=`);
cy.waitForSkeletonGone();
cy.get('#table-tx-vin tr').should('have.class', '');
cy.get('#table-tx-vout tr').should('have.class', '');
});
it('show invalid unblinded TX hex', () => {
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=123`);
cy.waitForSkeletonGone();
cy.get('#table-tx-vin tr').should('have.class', '');
cy.get('#table-tx-vout tr').should('have.class', '');
cy.get('.error-unblinded' ).contains('Error: Invalid blinding data (invalid hex)');
});
it('show first unblinded vout', () => {
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc`);
cy.waitForSkeletonGone();
cy.get('#table-tx-vout tr:first-child()').should('have.class', 'assetBox');
});
it('show second unblinded vout', () => {
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3a`);
cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
});
it('show invalid error unblinded TX', () => {
cy.visit(`${baseModule}/tx/f2f41c0850e8e7e3f1af233161fd596662e67c11ef10ed15943884186fbb7f46#blinded=100000,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,0ab9f70650f16b1db8dfada05237f7d0d65191c3a13183da8a2ddddfbde9a2ad,fd98b2edc5530d76acd553f206a431f4c1fab27e10e290ad719582af878e98fc,2364760,6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d,90c7a43b15b905bca045ca42a01271cfe71d2efe3133f4197792c24505cb32ed,12eb5959d9293b8842e7dd8bc9aa9639fd3fd031c5de3ba911adeca94eb57a3c`);
cy.waitForSkeletonGone();
cy.get('#table-tx-vout tr').should('have.class', 'assetBox');
cy.get('.error-unblinded' ).contains('Error: Invalid blinding data.');
});
it('shows asset peg in/out and burn transactions', () => {
cy.visit(`${baseModule}/asset/6f0279e9ed041c3d710a9f57d0c02928416460c4b722ae3457a11eec381c526d`);
cy.waitForSkeletonGone();
cy.get('#table-tx-vout tr').not('.assetBox');
cy.get('#table-tx-vin tr').not('.assetBox');
});
it('prevents regressing issue #644', () => {
cy.visit(`${baseModule}/tx/393b890966f305e7c440fcfb12a13f51a7a9011cc59ff5f14f6f93214261bd82`);
cy.waitForSkeletonGone();
});
});
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
});

View File

@@ -0,0 +1,368 @@
import { emitMempoolInfo, dropWebSocket } from "../../support/websocket";
describe('Mainnet', () => {
beforeEach(() => {
//cy.intercept('/sockjs-node/info*').as('socket');
cy.intercept('/api/block-height/*').as('block-height');
cy.intercept('/api/block/*').as('block');
cy.intercept('/api/block/*/txs/0').as('block-txs');
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
cy.intercept('/resources/pools.json').as('pools');
// Search Auto Complete
cy.intercept('/api/address-prefix/1wiz').as('search-1wiz');
cy.intercept('/api/address-prefix/1wizS').as('search-1wizS');
cy.intercept('/api/address-prefix/1wizSA').as('search-1wizSA');
Cypress.Commands.add('waitForBlockData', () => {
cy.wait('@tx-outspends');
cy.wait('@pools');
});
});
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
it('loads the status screen', () => {
cy.visit('/status');
cy.get('#mempool-block-0').should('be.visible');
cy.get('[id^="bitcoin-block-"]').should('have.length', 8);
cy.get('.footer').should('be.visible');
cy.get('.row > :nth-child(1)').invoke('text').then((text) => {
expect(text).to.match(/Tx vBytes per second:.* vB\/s/);
});
cy.get('.row > :nth-child(2)').invoke('text').then((text) => {
expect(text).to.match(/Unconfirmed:(.*)/);
});
cy.get('.row > :nth-child(3)').invoke('text').then((text) => {
expect(text).to.match(/Mempool size:(.*) (kB|MB) \((\d+) (block|blocks)\)/);
});
});
it('loads dashboard, drop websocket and reconnect', () => {
cy.viewport('macbook-16');
cy.mockMempoolSocket();
cy.visit('/');
cy.get('.badge').should('not.exist');
dropWebSocket();
cy.get('.badge').should('be.visible');
cy.get('.badge', {timeout: 25000}).should('not.exist');
emitMempoolInfo({
'params': {
loaded: true
}
});
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
});
it('loads the dashboard', () => {
cy.visit('/');
cy.waitForSkeletonGone();
});
describe('search', () => {
it('allows searching for partial Bitcoin addresses', () => {
cy.visit('/');
cy.get('.search-box-container > .form-control').type('1wiz').then(() => {
cy.wait('@search-1wiz');
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 10);
});
cy.get('.search-box-container > .form-control').type('S').then(() => {
cy.wait('@search-1wizS');
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 5);
});
cy.get('.search-box-container > .form-control').type('A').then(() => {
cy.wait('@search-1wizSA');
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 1)
});
cy.get('ngb-typeahead-window button.dropdown-item.active').click().then(() => {
cy.url().should('include', '/address/1wizSAYSbuyXbt9d8JV8ytm5acqq2TorC');
cy.waitForSkeletonGone();
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
});
});
['BC1PQYQSZQ', 'bc1PqYqSzQ'].forEach((searchTerm) => {
it(`allows searching for partial case insensitive bc1 addresses: ${searchTerm}`, () => {
cy.visit('/');
cy.get('.search-box-container > .form-control').type(searchTerm).then(() => {
cy.get('ngb-typeahead-window button.dropdown-item').should('have.length', 1);
cy.get('ngb-typeahead-window button.dropdown-item.active').click().then(() => {
cy.url().should('include', '/address/bc1pqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqs3wf0qm');
cy.waitForSkeletonGone();
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
});
});
});
});
});
describe('blocks navigation', () => {
describe('keyboard events', () => {
it('loads first blockchain blocks visible and keypress arrow right', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('.blockchain-blocks-0 > a').click().then(() => {
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.waitForPageIdle();
cy.document().right();
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
});
});
it('loads first blockchain blocks visible and keypress arrow left', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('.blockchain-blocks-0 > a').click().then(() => {
cy.waitForPageIdle();
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.document().left();
cy.get('.title-block h1').invoke('text').should('equal', 'Next block');
});
});
it('loads last blockchain blocks and keypress arrow right', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('.blockchain-blocks-4 > a').click().then(() => {
cy.waitForPageIdle();
// block 6
cy.document().right();
cy.wait(5000);
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
// block 7
cy.document().right();
cy.wait(5000);
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
// block 8 - last visible block
cy.document().right();
cy.wait(5000);
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
// block 9 - not visible at the blochchain blocks visible block
cy.document().right();
cy.wait(5000);
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
});
});
it('loads genesis block and keypress arrow right', () => {
cy.viewport('macbook-16');
cy.visit('/block/0');
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.document().right();
cy.wait(5000);
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
});
it('loads genesis block and keypress arrow left', () => {
cy.viewport('macbook-16');
cy.visit('/block/0');
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.document().left();
cy.wait(5000);
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
});
});
describe('mouse events', () => {
it('loads first blockchain blocks visible and click on the arrow right', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('.blockchain-blocks-0 > a').click().then(() => {
cy.waitForPageIdle();
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => {
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
});
});
});
it('loads genesis block and click on the arrow left', () => {
cy.viewport('macbook-16');
cy.visit('/block/0');
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('not.exist');
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').click().then(() => {
cy.get('[ngbtooltip="Next Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
cy.get('[ngbtooltip="Previous Block"] > .ng-fa-icon > .svg-inline--fa').should('be.visible');
});
});
});
});
it('loads skeleton when changes between networks', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.changeNetwork("testnet");
cy.changeNetwork("signet");
cy.changeNetwork("liquid");
cy.changeNetwork("mainnet");
cy.changeNetwork("bisq");
});
it('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket();
cy.visit("/");
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
cy.get('#mempool-block-0').should('be.visible');
cy.get('#mempool-block-1').should('be.visible');
cy.get('#mempool-block-2').should('be.visible');
emitMempoolInfo({
'params': {
loaded: true
}
});
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
});
it('loads the blocks screen', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(2) > a').click().then(() => {
cy.waitForPageIdle();
});
});
it('loads the graphs screen', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait(1000);
});
});
it('loads the tv screen - desktop', () => {
cy.viewport('macbook-16');
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.viewport('macbook-16');
cy.get('.chart-holder');
cy.get('.blockchain-wrapper').should('be.visible');
cy.get('#mempool-block-0').should('be.visible');
});
});
it('loads the tv screen - mobile', () => {
cy.viewport('iphone-6');
cy.visit('/tv');
cy.waitForSkeletonGone();
cy.get('.chart-holder');
cy.get('.blockchain-wrapper').should('be.visible');
});
it('loads the api screen', () => {
cy.visit('/');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.wait(1000);
});
});
describe('blocks', () => {
it('shows empty blocks properly', () => {
cy.visit('/block/0000000000000000000bd14f744ef2e006e61c32214670de7eb891a5732ee775');
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.get('h2').invoke('text').should('equal', '1 transaction');
});
it('expands and collapses the block details', () => {
cy.visit('/block/0');
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('be.visible');
});
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('not.be.visible');
});
});
it('shows blocks with no pagination', () => {
cy.visit('/block/00000000000000000001ba40caf1ad4cec0ceb77692662315c151953bfd7c4c4');
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.get('.block-tx-title h2').invoke('text').should('equal', '19 transactions');
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 5);
});
it('supports pagination on the block screen', () => {
// 41 txs
cy.visit('/block/00000000000000000009f9b7b0f63ad50053ad12ec3b7f5ca951332f134f83d8');
cy.waitForSkeletonGone();
cy.get('.pagination-container a').invoke('text').then((text1) => {
cy.get('.active + li').first().click().then(() => {
cy.waitForSkeletonGone();
cy.waitForPageIdle();
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
expect(text1).not.to.eq(text2);
});
});
});
});
it('shows blocks pagination with 5 pages (desktop)', () => {
cy.viewport(760, 800);
cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => {
cy.waitForSkeletonGone();
cy.waitForPageIdle();
});
// 5 pages + 4 buttons = 9 buttons
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 9);
});
it('shows blocks pagination with 3 pages (mobile)', () => {
cy.viewport(669, 800);
cy.visit('/block/000000000000000000049281946d26fcba7d99fdabc1feac524bc3a7003d69b3').then(() => {
cy.waitForSkeletonGone();
cy.waitForPageIdle();
});
// 3 pages + 4 buttons = 7 buttons
cy.get('.pagination-container ul.pagination').first().children().should('have.length', 7);
});
});
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
});

View File

@@ -0,0 +1,131 @@
import { emitMempoolInfo } from "../../support/websocket";
describe('Signet', () => {
beforeEach(() => {
cy.intercept('/api/block-height/*').as('block-height');
cy.intercept('/api/block/*').as('block');
cy.intercept('/api/block/*/txs/0').as('block-txs');
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
});
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
it('loads the dashboard', () => {
cy.visit('/signet');
cy.waitForSkeletonGone();
});
it('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket();
cy.visit("/signet");
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
cy.get('#mempool-block-0').should('be.visible');
cy.get('#mempool-block-1').should('be.visible');
cy.get('#mempool-block-2').should('be.visible');
emitMempoolInfo({
'params': {
"network": "signet"
}
});
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
});
it('loads the blocks screen', () => {
cy.visit('/signet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(2) > a').click().then(() => {
cy.wait(1000);
});
});
it('loads the graphs screen', () => {
cy.visit('/signet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait(1000);
});
});
describe('tv mode', () => {
it('loads the tv screen - desktop', () => {
cy.viewport('macbook-16');
cy.visit('/signet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.get('.chart-holder').should('be.visible');
cy.get('#mempool-block-0').should('be.visible');
cy.get('.tv-only').should('not.exist');
});
});
it('loads the tv screen - mobile', () => {
cy.visit('/signet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.viewport('iphone-8');
cy.get('.chart-holder').should('be.visible');
//TODO: Remove comment when the bug is fixed
//cy.get('#mempool-block-0').should('be.visible');
cy.get('.tv-only').should('not.exist');
});
});
});
it('loads the api screen', () => {
cy.visit('/signet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.wait(1000);
});
});
describe('blocks', () => {
it('shows empty blocks properly', () => {
cy.visit('/signet/block/00000133d54e4589f6436703b067ec23209e0a21b8a9b12f57d0592fd85f7a42');
cy.waitForSkeletonGone();
cy.get('h2').invoke('text').should('equal', '1 transaction');
});
it('expands and collapses the block details', () => {
cy.visit('/signet/block/0');
cy.waitForSkeletonGone();
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('be.visible');
});
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('not.be.visible');
});
});
it('shows blocks with no pagination', () => {
cy.visit('/signet/block/00000078f920a96a69089877b934ce7fd009ab55e3170920a021262cb258e7cc');
cy.waitForSkeletonGone();
cy.get('h2').invoke('text').should('equal', '13 transactions');
cy.get('ul.pagination').first().children().should('have.length', 5);
});
it('supports pagination on the block screen', () => {
// 43 txs
cy.visit('/signet/block/00000094bd52f73bdbfc4bece3a94c21fec2dc968cd54210496e69e4059d66a6');
cy.waitForSkeletonGone();
cy.get('.header-bg.box > a').invoke('text').then((text1) => {
cy.get('.active + li').first().click().then(() => {
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
expect(text1).not.to.eq(text2);
});
});
});
});
});
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
});

View File

@@ -0,0 +1,128 @@
import { confirmAddress, emitMempoolInfo, sendWsMock, showNewTx, startTrackingAddress } from "../../support/websocket";
describe('Testnet', () => {
beforeEach(() => {
cy.intercept('/api/block-height/*').as('block-height');
cy.intercept('/api/block/*').as('block');
cy.intercept('/api/block/*/txs/0').as('block-txs');
cy.intercept('/api/tx/*/outspends').as('tx-outspends');
});
if (Cypress.env("BASE_MODULE") === '' || Cypress.env("BASE_MODULE") === 'mempool') {
it('loads the dashboard', () => {
cy.visit('/testnet');
cy.waitForSkeletonGone();
});
it('loads the dashboard with the skeleton blocks', () => {
cy.mockMempoolSocket();
cy.visit("/testnet");
cy.get(':nth-child(1) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(2) > #bitcoin-block-0').should('be.visible');
cy.get(':nth-child(3) > #bitcoin-block-0').should('be.visible');
cy.get('#mempool-block-0').should('be.visible');
cy.get('#mempool-block-1').should('be.visible');
cy.get('#mempool-block-2').should('be.visible');
emitMempoolInfo({
'params': {
loaded: true
}
});
cy.get(':nth-child(1) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(2) > #bitcoin-block-0').should('not.exist');
cy.get(':nth-child(3) > #bitcoin-block-0').should('not.exist');
});
it('loads the blocks screen', () => {
cy.visit('/testnet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(2) > a').click().then(() => {
cy.wait(1000);
});
});
it('loads the graphs screen', () => {
cy.visit('/testnet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(3) > a').click().then(() => {
cy.wait(1000);
});
});
describe('tv mode', () => {
it('loads the tv screen - desktop', () => {
cy.viewport('macbook-16');
cy.visit('/testnet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.wait(1000);
cy.get('.tv-only').should('not.exist');
});
});
it('loads the tv screen - mobile', () => {
cy.visit('/testnet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(4) > a').click().then(() => {
cy.viewport('iphone-6');
cy.wait(1000);
cy.get('.tv-only').should('not.exist');
});
});
});
it('loads the api screen', () => {
cy.visit('/testnet');
cy.waitForSkeletonGone();
cy.get('li:nth-of-type(5) > a').click().then(() => {
cy.wait(1000);
});
});
describe('blocks', () => {
it('shows empty blocks properly', () => {
cy.visit('/testnet/block/0');
cy.waitForSkeletonGone();
cy.get('h2').invoke('text').should('equal', '1 transaction');
});
it('expands and collapses the block details', () => {
cy.visit('/testnet/block/0');
cy.waitForSkeletonGone();
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('be.visible');
});
cy.get('.btn.btn-outline-info').click().then(() => {
cy.get('#details').should('not.be.visible');
});
});
it('shows blocks with no pagination', () => {
cy.visit('/testnet/block/000000000000002f8ce27716e74ecc7ad9f7b5101fed12d09e28bb721b9460ea');
cy.waitForSkeletonGone();
cy.get('h2').invoke('text').should('equal', '11 transactions');
cy.get('ul.pagination').first().children().should('have.length', 5);
});
it('supports pagination on the block screen', () => {
// 48 txs
cy.visit('/testnet/block/000000000000002ca3878ebd98b313a1c2d531f2e70a6575d232ca7564dea7a9');
cy.waitForSkeletonGone();
cy.get('.header-bg.box > a').invoke('text').then((text1) => {
cy.get('.active + li').first().click().then(() => {
cy.get('.header-bg.box > a').invoke('text').then((text2) => {
expect(text1).not.to.eq(text2);
});
});
});
});
});
} else {
it.skip("Tests cannot be run on the selected BASE_MODULE");
}
});

View File

@@ -0,0 +1 @@
module.exports = (on, config) => {}

View File

@@ -0,0 +1,63 @@
// source: chrisp_68 @ https://stackoverflow.com/questions/50525143/how-do-you-reliably-wait-for-page-idle-in-cypress-io-test
export class PageIdleDetector
{
defaultOptions: Object = { timeout: 60000 };
public WaitForPageToBeIdle(): void
{
this.WaitForPageToLoad();
this.WaitForAngularRequestsToComplete();
this.WaitForAngularDigestCycleToComplete();
this.WaitForAnimationsToStop();
}
public WaitForPageToLoad(options: Object = this.defaultOptions): void
{
cy.document(options).should((myDocument: any) =>
{
expect(myDocument.readyState, "WaitForPageToLoad").to.be.oneOf(["interactive", "complete"]);
});
}
public WaitForAngularRequestsToComplete(options: Object = this.defaultOptions): void
{
cy.window(options).should((myWindow: any) =>
{
if (!!myWindow.angular)
{
expect(this.NumberOfPendingAngularRequests(myWindow), "WaitForAngularRequestsToComplete").to.have.length(0);
}
});
}
public WaitForAngularDigestCycleToComplete(options: Object = this.defaultOptions): void
{
cy.window(options).should((myWindow: any) =>
{
if (!!myWindow.angular)
{
expect(this.AngularRootScopePhase(myWindow), "WaitForAngularDigestCycleToComplete").to.be.null;
}
});
}
public WaitForAnimationsToStop(options: Object = this.defaultOptions): void
{
cy.get(":animated", options).should("not.exist");
}
private getInjector(myWindow: any)
{
return myWindow.angular.element(myWindow.document.body).injector();
}
private NumberOfPendingAngularRequests(myWindow: any)
{
return this.getInjector(myWindow).get('$http').pendingRequests;
}
private AngularRootScopePhase(myWindow: any)
{
return this.getInjector(myWindow).get("$rootScope").$$phase;
}
}

View File

@@ -0,0 +1,147 @@
// ***********************************************
// This example namespace declaration will help
// with Intellisense and code completion in your
// IDE or Text Editor.
// ***********************************************
// declare namespace Cypress {
// interface Chainable<Subject = any> {
// customCommand(param: any): typeof customCommand;
// }
// }
//
// function customCommand(param: any): void {
// console.warn(param);
// }
//
// NOTE: You can use it like so:
// Cypress.Commands.add('customCommand', customCommand);
//
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
'use strict'
import 'cypress-wait-until';
import { PageIdleDetector } from './PageIdleDetector';
import { mockWebSocket } from './websocket';
/* global Cypress */
const codes = {
ArrowLeft: 37,
ArrowUp: 38,
ArrowRight: 39,
ArrowDown: 40
}
Cypress.Commands.add('waitForSkeletonGone', () => {
cy.waitUntil(() => {
return Cypress.$('.skeleton-loader').length === 0;
}, { verbose: true, description: "waitForSkeletonGone", errorMsg: "skeleton loaders never went away", timeout: 15000, interval: 50});
});
Cypress.Commands.add(
"waitForPageIdle",
() => {
console.warn("Waiting for page idle state");
const pageIdleDetector = new PageIdleDetector();
pageIdleDetector.WaitForPageToBeIdle();
}
);
Cypress.Commands.add('mockMempoolSocket', () => {
mockWebSocket();
});
Cypress.Commands.add('changeNetwork', (network: "testnet"|"signet"|"liquid"|"bisq"|"mainnet" ) => {
cy.get('.dropdown-toggle').click().then(() => {
cy.get(`.${network}`).click().then(() => {
cy.waitForPageIdle();
if(network !== 'bisq'){
cy.waitForSkeletonGone();
}
});
});
});
// https://github.com/bahmutov/cypress-arrows/blob/8f0303842a343550fbeaf01528d01d1ff213b70c/src/index.js
function keydownCommand ($el, key) {
const message = `sending the "${key}" keydown event`
const log = Cypress.log({
name: `keydown: ${key}`,
message: message,
consoleProps: function () {
return {
Subject: $el
}
}
})
const e = $el.createEvent('KeyboardEvent')
Object.defineProperty(e, 'key', {
get: function () {
return key
}
})
Object.defineProperty(e, 'keyCode', {
get: function () {
return this.keyCodeVal
}
})
Object.defineProperty(e, 'which', {
get: function () {
return this.keyCodeVal
}
})
var metaKey = false
Object.defineProperty(e, 'metaKey', {
get: function () {
return metaKey
}
})
Object.defineProperty(e, 'shiftKey', {
get: function () {
return false
}
})
e.keyCodeVal = codes[key]
e.initKeyboardEvent('keydown', true, true,
$el.defaultView, false, false, false, false, e.keyCodeVal, e.keyCodeVal)
$el.dispatchEvent(e)
log.snapshot().end()
return $el
}
Cypress.Commands.add('keydown', { prevSubject: "dom" }, keydownCommand)
Cypress.Commands.add('left', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowLeft'))
Cypress.Commands.add('right', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowRight'))
Cypress.Commands.add('up', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowUp'))
Cypress.Commands.add('down', { prevSubject: "dom" }, $el => keydownCommand($el, 'ArrowDown'))

10
frontend/cypress/support/index.d.ts vendored Normal file
View File

@@ -0,0 +1,10 @@
/// <reference types="cypress" />
declare namespace Cypress {
interface Chainable<Subject> {
waitForSkeletonGone(): Chainable<any>
waitForPageIdle(): Chainable<any>
mockMempoolSocket(): Chainable<any>
changeNetwork(network: "testnet"|"signet"|"liquid"|"bisq"|"mainnet"): Chainable<any>
}
}

View File

@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// When a command from ./commands is ready to use, import with `import './commands'` syntax
import './commands';
import failOnConsoleError from 'cypress-fail-on-console-error';
failOnConsoleError();

View File

@@ -0,0 +1,92 @@
import { v4 as uuid } from 'uuid';
import { WebSocket, Server } from 'mock-socket';
declare global {
interface Window {
mockServer: Server;
mockSocket: WebSocket;
}
}
const mocks: { [key: string]: { server: Server; websocket: WebSocket } } = {};
const cleanupMock = (url: string) => {
if (mocks[url]) {
mocks[url].websocket.close();
mocks[url].server.stop();
delete mocks[url];
}
};
const createMock = (url: string) => {
cleanupMock(url);
const server = new Server(url);
const websocket = new WebSocket(url);
mocks[url] = { server, websocket };
return mocks[url];
};
export const mockWebSocket = () => {
cy.on('window:before:load', (win) => {
const winWebSocket = win.WebSocket;
cy.stub(win, 'WebSocket').callsFake((url) => {
console.log(url);
if ((new URL(url).pathname.indexOf('/sockjs-node/') !== 0)) {
const { server, websocket } = createMock(url);
win.mockServer = server;
win.mockServer.on('connection', (socket) => {
win.mockSocket = socket;
win.mockSocket.send('{"action":"init"}');
});
win.mockServer.on('message', (message) => {
console.log(message);
});
return websocket;
} else {
return new winWebSocket(url);
}
});
});
cy.on('window:before:unload', () => {
for (const url in mocks) {
cleanupMock(url);
}
});
};
export const emitMempoolInfo = ({
params
}: { params?: any } = {}) => {
cy.window().then((win) => {
//TODO: Refactor to take into account different parameterized mocking scenarios
switch (params.network) {
//TODO: Use network specific mocks
case "signet":
case "testnet":
default:
win.mockSocket.send('{"action":"init"}');
win.mockSocket.send('{"action":"want","data":["blocks","stats","mempool-blocks","live-2h-chart"]}');
win.mockSocket.send('{"conversions":{"USD":32365.338815782445}}');
cy.readFile('cypress/fixtures/mainnet_live2hchart.json', 'ascii').then((fixture) => {
win.mockSocket.send(JSON.stringify(fixture));
});
cy.readFile('cypress/fixtures/mainnet_mempoolInfo.json', 'ascii').then((fixture) => {
win.mockSocket.send(JSON.stringify(fixture));
});
}
});
cy.waitForSkeletonGone();
return cy.get('#mempool-block-0');
};
export const dropWebSocket = (() => {
cy.window().then((win) => {
win.mockServer.simulate("error");
});
return cy.wait(500);
});

View File

@@ -0,0 +1,10 @@
{
"extends": "../tsconfig.json",
"include": ["**/*.ts"],
"compilerOptions": {
"types": ["cypress"],
"lib": ["es2015", "dom"],
"allowJs": true,
"noEmit": true,
}
}

View File

@@ -1,62 +0,0 @@
access_log /var/log/nginx/access_mempool.log;
error_log /var/log/nginx/error_mempool.log;
root /var/www/mempool/browser;
index index.html;
# fallback for all URLs i.e. /address/foo /tx/foo /block/000
location / {
try_files /$lang/$uri /$lang/$uri/ $uri $uri/ /en-US/$uri @index-redirect;
}
location @index-redirect {
add_header vary accept-language;
rewrite (.*) /$lang/index.html;
}
# location block using regex are matched in order
# used to rewrite resources from /<lang>/ to /en-US/
location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/resources/ {
rewrite ^/[a-zA-Z-]*/resources/(.*) /en-US/resources/$1;
}
# used for cookie override
location ~ ^/(ar|bg|bs|ca|cs|da|de|et|el|es|eo|eu|fa|fr|gl|ko|hr|id|it|he|ka|lv|lt|hu|mk|ms|nl|ja|ka|no|nb|nn|pl|pt|pt-BR|ro|ru|sk|sl|sr|sh|fi|sv|th|tr|uk|vi|zh)/ {
try_files $uri $uri/ /$1/index.html =404;
}
# static API docs
location = /api {
try_files $uri $uri/ /en-US/index.html =404;
}
location = /api/ {
try_files $uri $uri/ /en-US/index.html =404;
}
# mainnet API
location /api/v1/donations {
proxy_pass https://mempool.space;
}
location /api/v1/donations/images {
proxy_pass https://mempool.space;
}
location /api/v1/ws {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /api/v1 {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/api/v1;
}
location /api/ {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/api/v1/;
}
# mainnet API
location /ws {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

View File

@@ -1,128 +0,0 @@
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 100000;
events {
worker_connections 9000;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# reset timed out connections freeing ram
reset_timedout_connection on;
# maximum time between packets the client can pause when sending nginx any data
client_body_timeout 10s;
# maximum time the client has to send the entire header to nginx
client_header_timeout 10s;
# timeout which a single keep-alive client connection will stay open
keepalive_timeout 69s;
# maximum time between packets nginx is allowed to pause when sending the client data
send_timeout 10s;
# number of requests per connection, does not affect SPDY
keepalive_requests 100;
# enable gzip compression
gzip on;
gzip_vary on;
gzip_comp_level 6;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
# text/html is always compressed by gzip module
gzip_types application/javascript application/json application/ld+json application/manifest+json application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard;
# limit request body size
client_max_body_size 10m;
# proxy cache
proxy_cache off;
proxy_cache_path /var/cache/nginx keys_zone=cache:20m levels=1:2 inactive=600s max_size=500m;
types_hash_max_size 2048;
# exempt localhost from rate limit
geo $limited_ip {
default 1;
0.0.0.0 0;
}
map $limited_ip $limited_ip_key {
1 $binary_remote_addr;
0 '';
}
# rate limit requests
limit_req_zone $limited_ip_key zone=api:5m rate=200r/m;
limit_req_zone $limited_ip_key zone=electrs:5m rate=2000r/m;
limit_req_status 429;
# rate limit connections
limit_conn_zone $limited_ip_key zone=websocket:10m;
limit_conn_status 429;
map $http_accept_language $header_lang {
default en-US;
~*^en-US en-US;
~*^en en-US;
~*^ar ar;
~*^cs cs;
~*^de de;
~*^es es;
~*^fa fa;
~*^fr fr;
~*^ja ja;
~*^ka ka;
~*^hu hu;
~*^nl nl;
~*^nn nn;
~*^pt pt;
~*^sl sl;
~*^sv sv;
~*^tr tr;
~*^uk uk;
~*^vi vi;
~*^zh zh;
}
map $cookie_lang $lang {
default $header_lang;
~*^en-US en-US;
~*^en en-US;
~*^ar ar;
~*^cs cs;
~*^de de;
~*^es es;
~*^fa fa;
~*^fr fr;
~*^ja ja;
~*^ka ka;
~*^hu hu;
~*^nl nl;
~*^nn nn;
~*^pt pt;
~*^sl sl;
~*^sv sv;
~*^tr tr;
~*^uk uk;
~*^vi vi;
~*^zh zh;
}
server {
listen 0.0.0.0:8080;
include /etc/nginx/conf.d/nginx-mempool.conf;
}
}

View File

@@ -1,32 +0,0 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@@ -1,23 +0,0 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to mempool!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

View File

@@ -1,11 +0,0 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}

View File

@@ -1,13 +0,0 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

View File

@@ -1,20 +1,44 @@
var fs = require('fs');
const { spawnSync } = require('child_process');
const CONFIG_FILE_NAME = 'mempool-frontend-config.json';
const GENERATED_CONFIG_FILE_NAME = 'generated-config.js';
let settings = [];
let configContent = {};
let gitCommitHash = '';
let packetJsonVersion = '';
try {
const rawConfig = fs.readFileSync(CONFIG_FILE_NAME);
configContent = JSON.parse(rawConfig);
console.log(`${CONFIG_FILE_NAME} file found, using provided config`);
} catch (e) {
if (e.code !== 'ENOENT') {
throw new Error(e);
} else {
console.log(`${CONFIG_FILE_NAME} file not found, using default config`);
}
}
const indexFilePath = configContent.BASE_MODULE ? 'src/index.' + configContent.BASE_MODULE + '.html' : 'src/index.mempool.html';
try {
fs.copyFileSync(indexFilePath, 'src/index.html');
console.log('Copied ' + indexFilePath + ' to src/index.html');
} catch (e) {
console.log('Error copying the index file');
throw new Error(e);
}
try {
const packageJson = fs.readFileSync('package.json');
packetJsonVersion = JSON.parse(packageJson).version;
console.log(`mempool version ${packetJsonVersion}`);
} catch (e) {
throw new Error(e);
}
for (setting in configContent) {
settings.push({
key: setting,
@@ -22,15 +46,64 @@ for (setting in configContent) {
});
}
const code = `(function (window) {
window.__env = window.__env || {};${settings.reduce((str, obj) => `${str}
window.__env.${obj.key} = ${ typeof obj.value === 'string' ? `'${obj.value}'` : obj.value };`, '')}
}(global || this));`;
try {
fs.writeFileSync(GENERATED_CONFIG_FILE_NAME, code, 'utf8');
} catch (e) {
throw new Error(e);
if (process.env.DOCKER_COMMIT_HASH) {
gitCommitHash = process.env.DOCKER_COMMIT_HASH;
} else {
try {
const gitRevParse = spawnSync('git', ['rev-parse', '--short', 'HEAD']);
if (!gitRevParse.error) {
gitCommitHash = gitRevParse.stdout.toString('utf-8').replace(/[\n\r\s]+$/, '');
console.log(`mempool revision ${gitCommitHash}`);
} else if (gitRevParse.error.code === 'ENOENT') {
console.log('git not found, cannot parse git hash');
gitCommitHash = '?';
}
} catch (e) {
console.log('Could not load git commit info: ' + e.message);
gitCommitHash = '?';
}
}
console.log('Config file generated');
const newConfig = `(function (window) {
window.__env = window.__env || {};${settings.reduce((str, obj) => `${str}
window.__env.${obj.key} = ${ typeof obj.value === 'string' ? `'${obj.value}'` : obj.value };`, '')}
window.__env.GIT_COMMIT_HASH = '${gitCommitHash}';
window.__env.PACKAGE_JSON_VERSION = '${packetJsonVersion}';
}(global || this));`;
function readConfig(path) {
try {
const currentConfig = fs.readFileSync(path).toString().trim();
return currentConfig;
} catch (e) {
return false;
}
}
function writeConfig(path, config) {
try {
fs.writeFileSync(path, config, 'utf8');
} catch (e) {
throw new Error(e);
}
}
const currentConfig = readConfig(GENERATED_CONFIG_FILE_NAME);
if (currentConfig && currentConfig === newConfig) {
console.log(`No configuration updates, skipping ${GENERATED_CONFIG_FILE_NAME} file update`);
return;
} else if (!currentConfig) {
console.log(`${GENERATED_CONFIG_FILE_NAME} file not found, creating new config file`);
console.log('CONFIG: ', newConfig);
writeConfig(GENERATED_CONFIG_FILE_NAME, newConfig);
console.log(`${GENERATED_CONFIG_FILE_NAME} file saved`);
return;
} else {
console.log(`Configuration changes detected, updating ${GENERATED_CONFIG_FILE_NAME} file`);
console.log('OLD CONFIG: ', currentConfig);
console.log('NEW CONFIG: ', newConfig);
writeConfig(GENERATED_CONFIG_FILE_NAME, newConfig);
console.log(`${GENERATED_CONFIG_FILE_NAME} file updated`);
};

View File

@@ -1,12 +1,15 @@
{
"TESTNET_ENABLED": false,
"SIGNET_ENABLED": false,
"LIQUID_ENABLED": false,
"BISQ_ENABLED": false,
"BISQ_SEPARATE_BACKEND": false,
"ITEMS_PER_PAGE": 10,
"KEEP_BLOCKS_AMOUNT": 8,
"SPONSORS_ENABLED": false,
"NGINX_PROTOCOL": "http",
"NGINX_HOSTNAME": "127.0.0.1",
"NGINX_PORT": "80"
"NGINX_PORT": "80",
"MEMPOOL_BLOCKS_AMOUNT": 8,
"BLOCK_WEIGHT_UNITS": 4000000,
"BASE_MODULE": "mempool"
}

22609
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
{
"name": "mempool-frontend",
"version": "2.0.0",
"version": "2.2.2",
"description": "Bitcoin mempool visualizer and blockchain explorer backend",
"license": "MIT",
"license": "GNU Affero General Public License v3.0",
"homepage": "https://mempool.space",
"repository": {
"type": "git",
@@ -22,75 +22,100 @@
"scripts": {
"ng": "./node_modules/@angular/cli/bin/ng",
"tsc": "./node_modules/typescript/bin/tsc",
"i18n-extract-from-source": "./node_modules/@angular/cli/bin/ng xi18n --ivy --out-file ./src/locale/messages.xlf",
"i18n-extract-from-source": "./node_modules/@angular/cli/bin/ng extract-i18n --ivy --out-file ./src/locale/messages.xlf",
"i18n-pull-from-transifex": "tx pull -a --parallel --minimum-perc 1 --force",
"serve": "ng serve --proxy-config proxy.conf.json",
"start": "npm run generate-config && npm run sync-assets-dev && ng serve --proxy-config proxy.conf.json",
"build": "npm run generate-config && ng build --prod --localize && npm run sync-assets",
"serve": "npm run generate-config && ng serve -c local",
"serve:stg": "npm run generate-config && ng serve -c staging",
"serve:local-prod": "npm run generate-config && ng serve -c local-prod",
"start": "npm run generate-config && npm run sync-assets-dev && ng serve -c local",
"start:stg": "npm run generate-config && npm run sync-assets-dev && ng serve -c staging",
"start:local-prod": "npm run generate-config && npm run sync-assets-dev && ng serve -c local-prod",
"build": "npm run generate-config && ng build --prod --localize && npm run sync-assets && npm run build-mempool.js",
"sync-assets": "node sync-assets.js && rsync -av ./dist/mempool/browser/en-US/resources ./dist/mempool/browser/resources",
"sync-assets-dev": "node sync-assets.js dev",
"generate-config": "node generate-config.js",
"build-mempool.js": "tsc | browserify -p tinyify ./node_modules/@mempool/mempool.js/lib/index.js --standalone mempoolJS > ./dist/mempool/browser/en-US/mempool.js",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"e2e": "npm run generate-config && ng e2e",
"e2e:ci": "npm run cypress:run:ci",
"config:defaults:mempool": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=mempool && npm run generate-config",
"config:defaults:liquid": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=liquid && npm run generate-config",
"config:defaults:bisq": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 BASE_MODULE=bisq && npm run generate-config",
"dev:ssr": "npm run generate-config && ng run mempool:serve-ssr",
"serve:ssr": "node server.run.js",
"build:ssr": "npm run build && ng run mempool:server:production && ./node_modules/typescript/bin/tsc server.run.ts",
"prerender": "ng run mempool:prerender"
"prerender": "ng run mempool:prerender",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:run:record": "cypress run --record",
"cypress:open:ci": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 && npm run generate-config && start-server-and-test serve:local-prod 4200 cypress:open",
"cypress:run:ci": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 && npm run generate-config && start-server-and-test serve:local-prod 4200 cypress:run:record"
},
"dependencies": {
"@angular/animations": "~10.2.3",
"@angular/common": "~10.2.3",
"@angular/compiler": "~10.2.3",
"@angular/core": "~10.2.3",
"@angular/forms": "~10.2.3",
"@angular/localize": "^10.2.3",
"@angular/platform-browser": "~10.2.3",
"@angular/platform-browser-dynamic": "~10.2.3",
"@angular/platform-server": "~10.2.2",
"@angular/router": "~10.2.3",
"@fortawesome/angular-fontawesome": "^0.7.0",
"@fortawesome/fontawesome-common-types": "^0.2.30",
"@fortawesome/fontawesome-svg-core": "^1.2.30",
"@fortawesome/free-solid-svg-icons": "^5.14.0",
"@angular/animations": "~11.2.8",
"@angular/common": "~11.2.8",
"@angular/compiler": "~11.2.8",
"@angular/core": "~11.2.8",
"@angular/forms": "~11.2.8",
"@angular/localize": "^11.2.8",
"@angular/platform-browser": "~11.2.8",
"@angular/platform-browser-dynamic": "~11.2.8",
"@angular/platform-server": "~11.2.8",
"@angular/router": "~11.2.8",
"@fortawesome/angular-fontawesome": "^0.8.2",
"@fortawesome/fontawesome-common-types": "^0.2.35",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@mempool/chartist": "^0.11.4",
"@mempool/mempool.js": "^2.2.4",
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
"@nguniversal/express-engine": "10.1.0",
"@nguniversal/express-engine": "11.2.1",
"@types/qrcode": "^1.3.4",
"bootstrap": "4.5.0",
"browserify": "^17.0.0",
"clipboard": "^2.0.4",
"domino": "^2.1.6",
"express": "^4.15.2",
"express": "^4.17.1",
"lightweight-charts": "^3.3.0",
"ngx-bootrap-multiselect": "^2.0.0",
"ngx-infinite-scroll": "^9.0.0",
"ngx-infinite-scroll": "^10.0.1",
"qrcode": "^1.4.4",
"rxjs": "^6.6.3",
"rxjs": "^6.6.7",
"tinyify": "^3.0.0",
"tlite": "^0.1.9",
"tslib": "^2.0.0",
"zone.js": "~0.10.3"
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1002.0",
"@angular/cli": "~10.2.0",
"@angular/compiler-cli": "~10.2.2",
"@angular/language-service": "~10.2.2",
"@nguniversal/builders": "^10.1.0",
"@angular-devkit/build-angular": "^0.1102.7",
"@angular/cli": "~11.2.7",
"@angular/compiler-cli": "~11.2.8",
"@angular/language-service": "~11.2.8",
"@nguniversal/builders": "^11.2.1",
"@types/express": "^4.17.0",
"@types/jasmine": "~3.3.8",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"codelyzer": "^6.0.1",
"http-proxy-middleware": "^1.0.5",
"jasmine-core": "~3.5.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~3.3.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.5"
"typescript": "~4.1.5"
},
"optionalDependencies": {
"@cypress/schematic": "^1.3.0",
"cypress": "^8.3.1",
"cypress-fail-on-console-error": "^2.1.0",
"cypress-wait-until": "^1.7.1",
"mock-socket": "^9.0.3",
"start-server-and-test": "^1.12.6"
}
}

64
frontend/proxy.conf.js Normal file
View File

@@ -0,0 +1,64 @@
const fs = require('fs');
let PROXY_CONFIG;
let configContent;
const CONFIG_FILE_NAME = 'mempool-frontend-config.json';
try {
const rawConfig = fs.readFileSync(CONFIG_FILE_NAME);
configContent = JSON.parse(rawConfig);
console.log(`${CONFIG_FILE_NAME} file found, using provided config`);
} catch (e) {
console.log(e);
if (e.code !== 'ENOENT') {
throw new Error(e);
} else {
console.log(`${CONFIG_FILE_NAME} file not found, using default config`);
}
}
PROXY_CONFIG = [
{
context: ['*',
'/api/**', '!/api/v1/ws',
'!/bisq', '!/bisq/**', '!/bisq/',
'!/liquid', '!/liquid/**', '!/liquid/',
'/testnet/api/**', '/signet/api/**'
],
target: "https://mempool.space",
ws: true,
secure: false,
changeOrigin: true
},
{
context: ['/api/v1/ws'],
target: "https://mempool.space",
ws: true,
secure: false,
changeOrigin: true,
},
{
context: ['/api/bisq**', '/bisq/api/**'],
target: "https://bisq.markets",
pathRewrite: {
"^/api/bisq/": "/bisq/api"
},
ws: true,
secure: false,
changeOrigin: true
},
{
context: ['/api/liquid**', '/liquid/api/**'],
target: "https://liquid.network",
pathRewrite: {
"^/api/liquid/": "/liquid/api"
},
ws: true,
secure: false,
changeOrigin: true
}
];
module.exports = PROXY_CONFIG;

View File

@@ -37,6 +37,28 @@
"^/testnet/api": ""
}
},
"/signet/api/v1": {
"target": "http://localhost:8999/",
"secure": false,
"pathRewrite": {
"^/signet/api/v1": "/api/v1"
}
},
"/signet/api/v1/ws": {
"target": "http://localhost:8999/",
"secure": false,
"ws": true,
"pathRewrite": {
"^/signet/api": "/api/v1/ws"
}
},
"/signet/api/": {
"target": "http://localhost:50001/",
"secure": false,
"pathRewrite": {
"^/signet/api": ""
}
},
"/liquid/api/v1/ws": {
"target": "http://localhost:8999/",
"secure": false,
@@ -45,11 +67,18 @@
"^/liquid/api": "/api/v1/ws"
}
},
"/liquid/api/": {
"target": "http://localhost:50001/",
"/liquid/api/v1/": {
"target": "http://localhost:8999/",
"secure": false,
"pathRewrite": {
"^/liquid/api/": ""
"^/liquid/api/": "/api/"
}
},
"/liquid/api/": {
"target": "http://localhost:8999/",
"secure": false,
"pathRewrite": {
"^/liquid/api/": "/api/v1/"
}
},
"/bisq/api/": {
@@ -66,5 +95,20 @@
"pathRewrite": {
"^/bisq/api": "/api/v1/ws"
}
},
"/resources/assets.minimal.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
},
"/resources/assets.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
},
"/resources/pools.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
}
}
}

View File

@@ -0,0 +1,99 @@
{
"/api/v1/ws": {
"target": "https://mempool.space",
"secure": false,
"ws": true
},
"/api": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true,
"logLevel": "debug",
"timeout": 3600000
},
"/testnet/api/v1/ws": {
"target": "https://mempool.space/testnet",
"secure": false,
"ws": true,
"loglevel": "debug",
"pathRewrite": {
"^/testnet/api": "/api/v1/ws"
}
},
"/testnet/api": {
"target": "https://mempool.space",
"secure": true,
"changeOrigin": true,
"loglevel": "debug",
"pathRewrite": {
"/testnet/api": "/testnet/api"
},
"timeout": 3600000
},
"/signet/api/v1/ws": {
"target": "https://mempool.space/signet",
"secure": false,
"ws": true,
"loglevel": "debug",
"pathRewrite": {
"^/signet/api": "/api/v1/ws"
}
},
"/signet/api": {
"target": "https://mempool.space",
"secure": true,
"changeOrigin": true,
"loglevel": "debug",
"pathRewrite": {
"/signet/api": "/signet/api"
},
"timeout": 3600000
},
"/bisq/api/v1/ws": {
"target": "https://mempool.space/bisq",
"secure": false,
"ws": true,
"pathRewrite": {
"^/bisq/api": "/api/v1/ws"
}
},
"/bisq/api": {
"target": "https://mempool.space/bisq",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/bisq/api/": "/api/v1/bisq/"
},
"timeout": 3600000
},
"/liquid/api/v1/ws": {
"target": "https://mempool.space",
"secure": false,
"ws": true
},
"/liquid/api": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/liquid/api/": "/liquid/api/"
},
"timeout": 3600000
},
"/resources/assets.minimal.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
},
"/resources/assets.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
},
"/resources/pools.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
}
}

View File

@@ -0,0 +1,100 @@
{
"/api/v1/ws": {
"target": "https://mempool.ninja",
"secure": false,
"ws": true
},
"/api/*": {
"target": "https://mempool.ninja",
"secure": false,
"changeOrigin": true,
"logLevel": "debug",
"pathRewrite": {
"^/api": "https://mempool.ninja/api"
},
"timeout": 3600000
},
"/testnet/api/v1/ws": {
"target": "https://mempool.ninja/testnet",
"secure": false,
"ws": true,
"pathRewrite": {
"^/testnet/api": "/api/v1/ws"
}
},
"/testnet/api/v1/*": {
"target": "https://mempool.ninja/testnet",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/testnet/api/v1": "/api/v1"
},
"timeout": 3600000
},
"/signet/api/v1/ws": {
"target": "https://mempool.ninja/signet",
"secure": false,
"ws": true,
"pathRewrite": {
"^/signet/api": "/api/v1/ws"
}
},
"/signet/api/v1/*": {
"target": "https://mempool.ninja/signet",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/signet/api/v1": "/api/v1"
},
"timeout": 3600000
},
"/bisq/api/v1/ws": {
"target": "https://mempool.ninja/bisq",
"secure": false,
"ws": true,
"pathRewrite": {
"^/bisq/api": "/api/v1/ws"
}
},
"/bisq/api/*": {
"target": "https://mempool.ninja/bisq",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/bisq/api/": "/api/v1/bisq/"
},
"timeout": 3600000
},
"/liquid/api/v1/ws": {
"target": "https://mempool.ninja/liquid",
"secure": false,
"ws": true,
"pathRewrite": {
"^/liquid/api": "/api/v1/ws"
}
},
"/liquid/api/*": {
"target": "https://mempool.ninja/liquid",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/liquid/api/": "/api/liquid/"
},
"timeout": 3600000
},
"/resources/assets.minimal.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
},
"/resources/assets.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
},
"/resources/pools.json": {
"target": "https://mempool.space",
"secure": false,
"changeOrigin": true
}
}

View File

@@ -91,6 +91,17 @@ export function app(locale: string): express.Express {
server.get('/testnet/tv', getLocalizedSSR(indexHtml));
server.get('/testnet/status', getLocalizedSSR(indexHtml));
server.get('/testnet/about', getLocalizedSSR(indexHtml));
server.get('/signet', getLocalizedSSR(indexHtml));
server.get('/signet/tx/*', getLocalizedSSR(indexHtml));
server.get('/signet/block/*', getLocalizedSSR(indexHtml));
server.get('/signet/mempool-block/*', getLocalizedSSR(indexHtml));
server.get('/signet/address/*', getLocalizedSSR(indexHtml));
server.get('/signet/blocks', getLocalizedSSR(indexHtml));
server.get('/signet/graphs', getLocalizedSSR(indexHtml));
server.get('/signet/api', getLocalizedSSR(indexHtml));
server.get('/signet/tv', getLocalizedSSR(indexHtml));
server.get('/signet/status', getLocalizedSSR(indexHtml));
server.get('/signet/about', getLocalizedSSR(indexHtml));
server.get('/bisq', getLocalizedSSR(indexHtml));
server.get('/bisq/tx/*', getLocalizedSSR(indexHtml));
server.get('/bisq/blocks', getLocalizedSSR(indexHtml));

View File

@@ -16,8 +16,13 @@ import { DashboardComponent } from './dashboard/dashboard.component';
import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks.component';
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component';
import { TrademarkPolicyComponent } from './components/trademark-policy/trademark-policy.component';
import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component';
import { SponsorComponent } from './components/sponsor/sponsor.component';
import { LiquidMasterPageComponent } from './components/liquid-master-page/liquid-master-page.component';
const routes: Routes = [
let routes: Routes = [
{
path: '',
component: MasterPageComponent,
@@ -64,11 +69,23 @@ const routes: Routes = [
path: 'terms-of-service',
component: TermsOfServiceComponent
},
{
path: 'privacy-policy',
component: PrivacyPolicyComponent
},
{
path: 'trademark-policy',
component: TrademarkPolicyComponent
},
{
path: 'address/:id',
children: [],
component: AddressComponent
},
{
path: 'sponsor',
component: SponsorComponent,
},
],
},
{
@@ -202,6 +219,68 @@ const routes: Routes = [
},
]
},
{
path: 'signet',
children: [
{
path: '',
component: MasterPageComponent,
children: [
{
path: '',
component: StartComponent,
children: [
{
path: '',
component: DashboardComponent
},
{
path: 'tx/:id',
component: TransactionComponent
},
{
path: 'block/:id',
component: BlockComponent
},
{
path: 'mempool-block/:id',
component: MempoolBlockComponent
},
],
},
{
path: 'blocks',
component: LatestBlocksComponent,
},
{
path: 'graphs',
component: StatisticsComponent,
},
{
path: 'address/:id',
children: [],
component: AddressComponent
},
{
path: 'api',
component: ApiDocsComponent,
},
],
},
{
path: 'tv',
component: TelevisionComponent
},
{
path: 'status',
component: StatusViewComponent
},
{
path: '**',
redirectTo: ''
},
]
},
{
path: 'bisq',
component: MasterPageComponent,
@@ -221,9 +300,110 @@ const routes: Routes = [
},
];
const browserWindow = window || {};
// @ts-ignore
const browserWindowEnv = browserWindow.__env || {};
if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'bisq') {
routes = [{
path: '',
component: BisqMasterPageComponent,
loadChildren: () => import('./bisq/bisq.module').then(m => m.BisqModule)
}];
}
if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'liquid') {
routes = [{
path: '',
component: LiquidMasterPageComponent,
children: [
{
path: '',
component: StartComponent,
children: [
{
path: '',
component: DashboardComponent
},
{
path: 'tx/:id',
component: TransactionComponent
},
{
path: 'block/:id',
component: BlockComponent
},
{
path: 'mempool-block/:id',
component: MempoolBlockComponent
},
],
},
{
path: 'blocks',
component: LatestBlocksComponent,
},
{
path: 'graphs',
component: StatisticsComponent,
},
{
path: 'address/:id',
component: AddressComponent
},
{
path: 'asset/:id',
component: AssetComponent
},
{
path: 'assets',
component: AssetsComponent,
},
{
path: 'api',
component: ApiDocsComponent,
},
{
path: 'about',
component: AboutComponent,
},
{
path: 'terms-of-service',
component: TermsOfServiceComponent
},
{
path: 'privacy-policy',
component: PrivacyPolicyComponent
},
{
path: 'trademark-policy',
component: TrademarkPolicyComponent
},
{
path: 'sponsor',
component: SponsorComponent,
},
],
},
{
path: 'tv',
component: TelevisionComponent
},
{
path: 'status',
component: StatusViewComponent
},
{
path: '**',
redirectTo: ''
}];
}
@NgModule({
imports: [RouterModule.forRoot(routes, {
initialNavigation: 'enabled'
initialNavigation: 'enabled',
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled'
})],
exports: [RouterModule]
})

View File

@@ -43,7 +43,7 @@ export const languages: Language[] = [
{ code: 'ar', name: 'العربية' }, // Arabic
// { code: 'bg', name: 'Български' }, // Bulgarian
// { code: 'bs', name: 'Bosanski' }, // Bosnian
// { code: 'ca', name: 'Català' }, // Catalan
{ code: 'ca', name: 'Català' }, // Catalan
{ code: 'cs', name: 'Čeština' }, // Czech
// { code: 'da', name: 'Dansk' }, // Danish
{ code: 'de', name: 'Deutsch' }, // German
@@ -59,8 +59,9 @@ export const languages: Language[] = [
{ code: 'ko', name: '한국어' }, // Korean
// { code: 'hr', name: 'Hrvatski' }, // Croatian
// { code: 'id', name: 'Bahasa Indonesia' },// Indonesian
{ code: 'hi', name: 'हिन्दी' }, // Hindi
{ code: 'it', name: 'Italiano' }, // Italian
// { code: 'he', name: 'עברית' }, // Hebrew
{ code: 'he', name: 'עברית' }, // Hebrew
{ code: 'ka', name: 'ქართული' }, // Georgian
// { code: 'lv', name: 'Latviešu' }, // Latvian
// { code: 'lt', name: 'Lietuvių' }, // Lithuanian
@@ -71,11 +72,11 @@ export const languages: Language[] = [
{ code: 'ja', name: '日本語' }, // Japanese
{ code: 'nb', name: 'Norsk' }, // Norwegian Bokmål
// { code: 'nn', name: 'Norsk Nynorsk' }, // Norwegian Nynorsk
// { code: 'pl', name: 'Polski' }, // Polish
{ code: 'pl', name: 'Polski' }, // Polish
{ code: 'pt', name: 'Português' }, // Portuguese
// { code: 'pt-BR', name: 'Português (Brazil)' }, // Portuguese (Brazil)
// { code: 'ro', name: 'Română' }, // Romanian
// { code: 'ru', name: 'Русский' }, // Russian
{ code: 'ru', name: 'Русский' }, // Russian
// { code: 'sk', name: 'Slovenčina' }, // Slovak
{ code: 'sl', name: 'Slovenščina' }, // Slovenian
// { code: 'sr', name: 'Српски / srpski' }, // Serbian

View File

@@ -21,6 +21,8 @@ import { WebsocketService } from './services/websocket.service';
import { AddressLabelsComponent } from './components/address-labels/address-labels.component';
import { MempoolBlocksComponent } from './components/mempool-blocks/mempool-blocks.component';
import { MasterPageComponent } from './components/master-page/master-page.component';
import { BisqMasterPageComponent } from './components/bisq-master-page/bisq-master-page.component';
import { LiquidMasterPageComponent } from './components/liquid-master-page/liquid-master-page.component';
import { AboutComponent } from './components/about/about.component';
import { TelevisionComponent } from './components/television/television.component';
import { StatisticsComponent } from './components/statistics/statistics.component';
@@ -31,7 +33,7 @@ import { FooterComponent } from './components/footer/footer.component';
import { AudioService } from './services/audio.service';
import { MempoolBlockComponent } from './components/mempool-block/mempool-block.component';
import { FeeDistributionGraphComponent } from './components/fee-distribution-graph/fee-distribution-graph.component';
import { TimespanComponent } from './components/timespan/timespan.component';
import { TimeSpanComponent } from './components/time-span/time-span.component';
import { SeoService } from './services/seo.service';
import { MempoolGraphComponent } from './components/mempool-graph/mempool-graph.component';
import { AssetComponent } from './components/asset/asset.component';
@@ -43,18 +45,24 @@ import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { FeesBoxComponent } from './components/fees-box/fees-box.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome';
import { faAngleDown, faAngleUp, faBolt, faChartArea, faCogs, faCubes, faDatabase, faExchangeAlt, faInfoCircle,
faLink, faList, faSearch, faTachometerAlt, faThList, faTint, faTv } from '@fortawesome/free-solid-svg-icons';
import { faAngleDown, faAngleUp, faAngleRight, faAngleLeft, faBolt, faChartArea, faCogs, faCubes, faDatabase, faExchangeAlt, faInfoCircle,
faLink, faList, faSearch, faCaretUp, faCaretDown, faTachometerAlt, faThList, faTint, faTv, faAngleDoubleDown, faSortUp, faAngleDoubleUp, faChevronDown, faFileAlt, faRedoAlt, faArrowAltCircleRight, faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons';
import { ApiDocsComponent } from './components/api-docs/api-docs.component';
import { CodeTemplateComponent } from './components/api-docs/code-template.component';
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component';
import { TrademarkPolicyComponent } from './components/trademark-policy/trademark-policy.component';
import { StorageService } from './services/storage.service';
import { HttpCacheInterceptor } from './services/http-cache.interceptor';
import { SponsorComponent } from './components/sponsor/sponsor.component';
@NgModule({
declarations: [
AppComponent,
AboutComponent,
MasterPageComponent,
BisqMasterPageComponent,
LiquidMasterPageComponent,
TelevisionComponent,
BlockchainComponent,
StartComponent,
@@ -67,7 +75,7 @@ import { HttpCacheInterceptor } from './services/http-cache.interceptor';
AmountComponent,
LatestBlocksComponent,
SearchFormComponent,
TimespanComponent,
TimeSpanComponent,
AddressLabelsComponent,
MempoolBlocksComponent,
ChartistComponent,
@@ -82,7 +90,11 @@ import { HttpCacheInterceptor } from './services/http-cache.interceptor';
FeesBoxComponent,
DashboardComponent,
ApiDocsComponent,
CodeTemplateComponent,
TermsOfServiceComponent,
PrivacyPolicyComponent,
TrademarkPolicyComponent,
SponsorComponent,
],
imports: [
BrowserModule.withServerTransition({ appId: 'serverApp' }),
@@ -125,5 +137,17 @@ export class AppModule {
library.addIcons(faAngleDown);
library.addIcons(faAngleUp);
library.addIcons(faExchangeAlt);
library.addIcons(faAngleDoubleUp);
library.addIcons(faAngleDoubleDown);
library.addIcons(faChevronDown);
library.addIcons(faFileAlt);
library.addIcons(faRedoAlt);
library.addIcons(faArrowAltCircleRight);
library.addIcons(faExternalLinkAlt);
library.addIcons(faSortUp);
library.addIcons(faCaretUp);
library.addIcons(faCaretDown);
library.addIcons(faAngleRight);
library.addIcons(faAngleLeft);
}
}

View File

@@ -20,15 +20,13 @@
<th i18n="Asset ticker header">Ticker</th>
<th class="d-none d-md-block" i18n="Asset Issuer Domain header">Issuer domain</th>
<th i18n="Asset ID header">Asset ID</th>
<th class="d-none d-lg-block" i18n="Asset issuance transaction header">Issuance TX</th>
</thead>
<tbody>
<tr *ngFor="let asset of filteredAssets; trackBy: trackByAsset">
<td class="td-name">{{ asset.name }}</td>
<td class="td-name"><a [routerLink]="['/asset/' | relativeUrl, asset.asset_id]">{{ asset.name }}</a></td>
<td>{{ asset.ticker }}</td>
<td class="d-none d-md-block"><a *ngIf="asset.entity" target="_blank" href="{{ 'http://' + asset.entity.domain }}">{{ asset.entity.domain }}</a></td>
<td class="d-none d-md-block">{{ asset.entity && asset.entity.domain }}</td>
<td><a [routerLink]="['/asset/' | relativeUrl, asset.asset_id]">{{ asset.asset_id | shortenString : 13 }}</a> <app-clipboard class="d-none d-sm-inline-block" [text]="asset.asset_id"></app-clipboard></td>
<td class="d-none d-lg-block"><ng-template [ngIf]="asset.issuance_txin"><a [routerLink]="['/tx/' | relativeUrl, asset.issuance_txin.txid]">{{ asset.issuance_txin.txid | shortenString : 13 }}</a> <app-clipboard class="d-none d-sm-inline-block" [text]="asset.issuance_txin.txid"></app-clipboard></ng-template></td>
</tr>
</tbody>
</table>
@@ -47,15 +45,13 @@
<th i18n="Asset ticker header">Ticker</th>
<th i18n="Asset Issuer Domain header">Issuer domain</th>
<th i18n="Asset ID header">Asset ID</th>
<th i18n="Asset issuance transaction header">Issuance TX</th>
</thead>
<tbody>
<tr *ngFor="let dummy of [0,0,0]">
<tr *ngFor="let dummy of [0,0,0,0,0,0,0,0,0,0]">
<td><span class="skeleton-loader"></span></td>
<td><span class="skeleton-loader"></span></td>
<td class="d-none d-md-block"><span class="skeleton-loader"></span></td>
<td><span class="skeleton-loader"></span></td>
<td class="d-none d-lg-block"><span class="skeleton-loader"></span></td>
</tr>
</tbody>
</table>

View File

@@ -107,7 +107,7 @@ export class AssetsComponent implements OnInit {
const start = (this.page - 1) * this.itemsPerPage;
if (searchText.length ) {
const filteredAssets = this.assetsCache.filter((asset) => asset.name.toLowerCase().indexOf(searchText.toLowerCase()) > -1
|| asset.ticker.toLowerCase().indexOf(searchText.toLowerCase()) > -1);
|| (asset.ticker || '').toLowerCase().indexOf(searchText.toLowerCase()) > -1);
this.assets = filteredAssets;
return filteredAssets.slice(start, this.itemsPerPage + start);
} else {

View File

@@ -1,10 +1,12 @@
<div class="container-xl">
<h1 style="float: left;" i18n="shared.address">Address</h1>
<a [routerLink]="['/address/' | relativeUrl, addressString]" style="line-height: 56px; margin-left: 10px;">
<span class="d-inline d-lg-none">{{ addressString | shortenString : 24 }}</span>
<span class="d-none d-lg-inline">{{ addressString }}</span>
</a>
<app-clipboard [text]="addressString"></app-clipboard>
<h1 i18n="shared.address">Address</h1>
<span class="address-link">
<a [routerLink]="['/address/' | relativeUrl, addressString]">
<span class="d-inline d-lg-none">{{ addressString | shortenString : 24 }}</span>
<span class="d-none d-lg-inline">{{ addressString }}</span>
</a>
<app-clipboard [text]="addressString"></app-clipboard>
</span>
<br>
<div class="clearfix"></div>
@@ -13,26 +15,26 @@
<div class="box">
<div class="row">
<div class="col">
<div class="col-md">
<table class="table table-borderless table-striped">
<tbody>
<tr>
<td i18n="address.total-received">Total received</td>
<td>{{ totalReceived / 100 | number: '1.2-2' }} BSQ</td>
<td>{{ totalReceived / 100 | number: '1.2-2' }} <span class="symbol">BSQ</span></td>
</tr>
<tr>
<td i18n="address.total-sent">Total sent</td>
<td>{{ totalSent / 100 | number: '1.2-2' }} BSQ</td>
<td>{{ totalSent / 100 | number: '1.2-2' }} <span class="symbol">BSQ</span></td>
</tr>
<tr>
<td i18n="address.balance">Balance</td>
<td>{{ (totalReceived - totalSent) / 100 | number: '1.2-2' }} BSQ (<app-bsq-amount [bsq]="totalReceived - totalSent" [forceFiat]="true" [green]="true"></app-bsq-amount>)</td>
<td>{{ (totalReceived - totalSent) / 100 | number: '1.2-2' }} <span class="symbol">BSQ</span> <span class="fiat"><app-bsq-amount [bsq]="totalReceived - totalSent" [forceFiat]="true" [green]="true"></app-bsq-amount></span></td>
</tr>
</tbody>
</table>
</div>
<div class="w-100 d-block d-md-none"></div>
<div class="col qrcode-col">
<div class="col-md qrcode-col">
<div class="qr-wrapper">
<app-qrcode [data]="addressString"></app-qrcode>
</div>

Some files were not shown because too many files have changed in this diff Show More