├── .github └── workflows │ ├── lint.backend.yml │ ├── lint.crawlers.yml │ ├── lint.db.yml │ ├── lint.frontend.yml │ ├── locust.yml │ ├── release.clients.python.yml │ ├── release.mooncrawl.yml │ ├── release.moonstreamapi.yml │ ├── release.moonstreamdb.yml │ ├── release.moonstreamdbv3.yml │ ├── release.types.python.yml │ └── test.clients.python.yml ├── .gitignore ├── LICENSE ├── README.md ├── clients └── python │ ├── .gitignore │ ├── .isort.cfg │ ├── README.md │ ├── moonstream │ ├── __init__.py │ ├── aws │ │ ├── __init__.py │ │ └── bucket.py │ ├── client.py │ ├── data.py │ ├── exceptions.py │ ├── settings.py │ ├── test_client.py │ └── version.py │ ├── mypy.ini │ ├── sample.env │ └── setup.py ├── crawlers ├── .gitignore ├── deploy │ ├── amoy-historical-crawl-events.service │ ├── amoy-historical-crawl-events.timer │ ├── amoy-historical-crawl-transactions.service │ ├── amoy-historical-crawl-transactions.timer │ ├── amoy-missing.service │ ├── amoy-missing.timer │ ├── amoy-moonworm-crawler.service │ ├── amoy-synchronize.service │ ├── arbitrum-nova-missing.service │ ├── arbitrum-nova-missing.timer │ ├── arbitrum-nova-moonworm-crawler.service │ ├── arbitrum-nova-synchronize.service │ ├── arbitrum-one-historical-crawl-events.service │ ├── arbitrum-one-historical-crawl-events.timer │ ├── arbitrum-one-historical-crawl-transactions.service │ ├── arbitrum-one-historical-crawl-transactions.timer │ ├── arbitrum-one-missing.service │ ├── arbitrum-one-missing.timer │ ├── arbitrum-one-moonworm-crawler.service │ ├── arbitrum-one-state.service │ ├── arbitrum-one-state.timer │ ├── arbitrum-one-synchronize.service │ ├── arbitrum-sepolia-missing.service │ ├── arbitrum-sepolia-missing.timer │ ├── arbitrum-sepolia-moonworm-crawler.service │ ├── arbitrum-sepolia-state.service │ ├── arbitrum-sepolia-state.timer │ ├── arbitrum-sepolia-synchronize.service │ ├── avalanche-fuji-missing.service │ ├── avalanche-fuji-missing.timer │ ├── avalanche-fuji-moonworm-crawler.service │ ├── avalanche-fuji-synchronize.service │ ├── avalanche-missing.service │ ├── avalanche-missing.timer │ ├── avalanche-moonworm-crawler.service │ ├── avalanche-synchronize.service │ ├── blast-missing.service │ ├── blast-missing.timer │ ├── blast-moonworm-crawler.service │ ├── blast-sepolia-missing.service │ ├── blast-sepolia-missing.timer │ ├── blast-sepolia-moonworm-crawler.service │ ├── blast-sepolia-synchronize.service │ ├── blast-synchronize.service │ ├── deploy-basic.bash │ ├── deploy-historical.bash │ ├── deploy-monitoring.bash │ ├── deploy-moonworm-cu.bash │ ├── deploy-moonworm.bash │ ├── deploy-state.bash │ ├── deploy.bash │ ├── ethereum-historical-crawl-events.service │ ├── ethereum-historical-crawl-events.timer │ ├── ethereum-historical-crawl-transactions.service │ ├── ethereum-historical-crawl-transactions.timer │ ├── ethereum-metadata.service │ ├── ethereum-metadata.timer │ ├── ethereum-missing.service │ ├── ethereum-missing.timer │ ├── ethereum-moonworm-crawler.service │ ├── ethereum-orange-dao-reports-tokenonomics.service │ ├── ethereum-orange-dao-reports-tokenonomics.timer │ ├── ethereum-state-clean.service │ ├── ethereum-state-clean.timer │ ├── ethereum-state.service │ ├── ethereum-state.timer │ ├── ethereum-synchronize.service │ ├── game7-metadata copy.timer │ ├── game7-metadata.service │ ├── game7-metadata.timer │ ├── game7-state.service │ ├── game7-state.timer │ ├── game7-testnet-metadata.service │ ├── game7-testnet-metadata.timer │ ├── game7-testnet-state.service │ ├── game7-testnet-state.timer │ ├── leaderboards-worker.service │ ├── leaderboards-worker.timer │ ├── mantle-historical-crawl-events.service │ ├── mantle-historical-crawl-events.timer │ ├── mantle-historical-crawl-transactions.service │ ├── mantle-historical-crawl-transactions.timer │ ├── mantle-missing.service │ ├── mantle-missing.timer │ ├── mantle-moonworm-crawler.service │ ├── mantle-sepolia-historical-crawl-events.service │ ├── mantle-sepolia-historical-crawl-events.timer │ ├── mantle-sepolia-historical-crawl-transactions.service │ ├── mantle-sepolia-historical-crawl-transactions.timer │ ├── mantle-sepolia-missing.service │ ├── mantle-sepolia-missing.timer │ ├── mantle-sepolia-moonworm-crawler.service │ ├── mantle-sepolia-synchronize.service │ ├── mantle-synchronize.service │ ├── monitoring-crawlers-config.json │ ├── monitoring-crawlers.service │ ├── mooncrawl.service │ ├── polygon-cu-nft-dashboard.service │ ├── polygon-cu-nft-dashboard.timer │ ├── polygon-historical-crawl-events.service │ ├── polygon-historical-crawl-events.timer │ ├── polygon-historical-crawl-transactions.service │ ├── polygon-historical-crawl-transactions.timer │ ├── polygon-metadata.service │ ├── polygon-metadata.timer │ ├── polygon-missing.service │ ├── polygon-missing.timer │ ├── polygon-moonworm-crawler.service │ ├── polygon-state-clean.service │ ├── polygon-state-clean.timer │ ├── polygon-state.service │ ├── polygon-state.timer │ ├── polygon-synchronize.service │ ├── proofofplay-apex-historical-crawl-events.service │ ├── proofofplay-apex-historical-crawl-events.timer │ ├── proofofplay-apex-historical-crawl-transactions.service │ ├── proofofplay-apex-historical-crawl-transactions.timer │ ├── proofofplay-apex-missing.service │ ├── proofofplay-apex-missing.timer │ ├── proofofplay-apex-moonworm-crawler.service │ ├── proofofplay-apex-synchronize.service │ ├── sepolia-state.service │ ├── sepolia-state.timer │ ├── xai-historical-crawl-events.service │ ├── xai-historical-crawl-events.timer │ ├── xai-historical-crawl-transactions.service │ ├── xai-historical-crawl-transactions.timer │ ├── xai-metadata.service │ ├── xai-metadata.timer │ ├── xai-missing.service │ ├── xai-missing.timer │ ├── xai-moonworm-crawler.service │ ├── xai-sepolia-historical-crawl-events.service │ ├── xai-sepolia-historical-crawl-events.timer │ ├── xai-sepolia-historical-crawl-transactions.service │ ├── xai-sepolia-historical-crawl-transactions.timer │ ├── xai-sepolia-metadata.service │ ├── xai-sepolia-metadata.timer │ ├── xai-sepolia-missing.service │ ├── xai-sepolia-missing.timer │ ├── xai-sepolia-moonworm-crawler.service │ ├── xai-sepolia-state-clean.service │ ├── xai-sepolia-state-clean.timer │ ├── xai-sepolia-state.service │ ├── xai-sepolia-state.timer │ ├── xai-sepolia-synchronize.service │ ├── xai-state-clean.service │ ├── xai-state-clean.timer │ ├── xai-state.service │ ├── xai-state.timer │ ├── xai-synchronize.service │ ├── xdai-historical-crawl-events.service │ ├── xdai-historical-crawl-events.timer │ ├── xdai-historical-crawl-transactions.service │ ├── xdai-historical-crawl-transactions.timer │ ├── xdai-missing.service │ ├── xdai-missing.timer │ ├── xdai-moonworm-crawler.service │ ├── xdai-synchronize.service │ ├── zksync-era-historical-crawl-events.service │ ├── zksync-era-historical-crawl-events.timer │ ├── zksync-era-historical-crawl-transactions.service │ ├── zksync-era-historical-crawl-transactions.timer │ ├── zksync-era-missing.service │ ├── zksync-era-missing.timer │ ├── zksync-era-moonworm-crawler.service │ ├── zksync-era-sepolia-historical-crawl-events.service │ ├── zksync-era-sepolia-historical-crawl-events.timer │ ├── zksync-era-sepolia-historical-crawl-transactions.service │ ├── zksync-era-sepolia-historical-crawl-transactions.timer │ ├── zksync-era-sepolia-missing.service │ ├── zksync-era-sepolia-missing.timer │ ├── zksync-era-sepolia-moonworm-crawler.service │ ├── zksync-era-sepolia-synchronize.service │ ├── zksync-era-state-clean.service │ ├── zksync-era-state-clean.timer │ ├── zksync-era-state.service │ ├── zksync-era-state.timer │ └── zksync-era-synchronize.service ├── ldb │ ├── cmd │ │ ├── actions.go │ │ ├── cli.go │ │ ├── connections.go │ │ ├── data.go │ │ └── reporter.go │ ├── configs │ │ └── settings.go │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── sample.env ├── mooncrawl │ ├── .gitignore │ ├── .isort.cfg │ ├── README.md │ ├── dev.sh │ ├── mooncrawl │ │ ├── __init__.py │ │ ├── actions.py │ │ ├── api.py │ │ ├── blockchain.py │ │ ├── contract │ │ │ ├── __init__.py │ │ │ ├── cli.py │ │ │ ├── deployment_crawler.py │ │ │ └── test_deployment_crawler.py │ │ ├── crawler.py │ │ ├── data.py │ │ ├── db.py │ │ ├── esd.py │ │ ├── etherscan.py │ │ ├── generic_crawler │ │ │ ├── __init__.py │ │ │ ├── abis │ │ │ │ ├── erc20.json │ │ │ │ └── erc721.json │ │ │ ├── base.py │ │ │ └── cli.py │ │ ├── identity.py │ │ ├── leaderboards_generator │ │ │ ├── __init__.py │ │ │ ├── cli.py │ │ │ └── utils.py │ │ ├── metadata_crawler │ │ │ ├── Readme.md │ │ │ ├── __init__.py │ │ │ ├── cli.py │ │ │ └── db.py │ │ ├── middleware.py │ │ ├── moonworm_crawler │ │ │ ├── __init__.py │ │ │ ├── cli.py │ │ │ ├── continuous_crawler.py │ │ │ ├── crawler.py │ │ │ ├── db.py │ │ │ ├── event_crawler.py │ │ │ ├── function_call_crawler.py │ │ │ └── historical_crawler.py │ │ ├── publish.py │ │ ├── reporter.py │ │ ├── reports_crawler │ │ │ ├── __init__.py │ │ │ ├── cli.py │ │ │ └── queries.py │ │ ├── settings.py │ │ ├── state_crawler │ │ │ ├── Multicall2_abi.json │ │ │ ├── Multicall2_interface.py │ │ │ ├── __init__.py │ │ │ ├── cli.py │ │ │ ├── db.py │ │ │ ├── jobs │ │ │ │ ├── ethereum-jobs.json │ │ │ │ ├── mumbai-jobs.json │ │ │ │ ├── polygon-jobs.json │ │ │ │ └── zksync-era-jobs.json │ │ │ └── web3_util.py │ │ ├── stats_worker │ │ │ ├── __init__.py │ │ │ ├── dashboard.py │ │ │ ├── queries.py │ │ │ └── test_queries.py │ │ ├── test_cli.py │ │ └── version.py │ ├── mypy.ini │ ├── sample.env │ └── setup.py └── txpool │ ├── .gitignore │ ├── cmd │ ├── data.go │ └── txpool.go │ ├── configs │ └── settings.go │ ├── dev.sh │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── sample.env ├── datasets └── nfts │ ├── .gitignore │ ├── README.md │ ├── nfts │ ├── __init__.py │ ├── cli.py │ ├── data.py │ ├── dataset.py │ ├── datastore.py │ ├── derive.py │ ├── enrich.py │ └── materialize.py │ ├── notebooks │ ├── .gitignore │ ├── nft_ownership.ipynb │ └── transfers_count.ipynb │ ├── papers │ ├── ethereum-nfts.pdf │ └── ethereum-nfts.tex │ ├── sample.env │ └── setup.py ├── docker-compose.yml ├── docs └── architecture.md ├── engineapi ├── .gitignore ├── .isort.cfg ├── README.md ├── alembic.sample.ini ├── alembic.sh ├── alembic │ ├── README │ ├── env.py │ ├── script.py.mako │ └── versions │ │ ├── 040f2dfde5a5_request_id_decimal_column.py │ │ ├── 04e9f9125c90_initial.py │ │ ├── 3f2ec6253b7e_unique_constraints_contract_metadata.py │ │ ├── 6b45cfe1799c_add_leaderboard_table_add_.py │ │ ├── 6d07739cb13e_live_at_for_metatx.py │ │ ├── 7191eb70e99e_tx_hash_for_call_requests.py │ │ ├── 71e888082a6d_leaderboard_metadata.py │ │ ├── 782ac8fe23c8_add_resource_id_column.py │ │ ├── 784c8ec69ca7_add_score_index.py │ │ ├── 815ae0983ef1_add_raw_amount_column.py │ │ ├── a9060d0527e3_chain_id_is_big_int.py │ │ ├── b4257b10daaf_call_request_types_and_metatx_holders.py │ │ ├── cc80e886e153_added_leaderboard_versions_table_and_.py │ │ ├── d1be5f227664_registered_contract_and_call_requests.py │ │ ├── dedd8a7d0624_fix_unique_constract_on_registered_.py │ │ └── f0e8022dc814_added_column_for_signatures.py ├── client │ ├── __init__.py │ ├── leaderboards.py │ └── sample-score.json ├── deploy │ ├── deploy.bash │ ├── engine-origins-sync.service │ ├── engine-origins-sync.timer │ └── engine.service ├── dev.sh ├── engineapi │ ├── MANIFEST.in │ ├── __init__.py │ ├── abi.py │ ├── actions.py │ ├── api.py │ ├── auth.py │ ├── cli.py │ ├── contracts │ │ ├── Dropper_abi.json │ │ ├── Dropper_interface.py │ │ ├── ERC20_abi.json │ │ ├── ERC20_interface.py │ │ ├── Terminus_abi.json │ │ ├── Terminus_interface.py │ │ ├── __init__.py │ │ └── web3_util.py │ ├── contracts_actions.py │ ├── data.py │ ├── db.py │ ├── middleware.py │ ├── models.py │ ├── rc.py │ ├── routes │ │ ├── __init__.py │ │ ├── admin.py │ │ ├── configs.py │ │ ├── dropper.py │ │ ├── leaderboard.py │ │ ├── metatx.py │ │ └── play.py │ ├── scripts │ │ ├── __init__.py │ │ ├── fill_raw_amount.py │ │ └── metatx_resources.py │ ├── settings.py │ ├── signatures.py │ ├── test_auth.py │ ├── test_middleware.py │ ├── version.py │ └── version.txt ├── mypy.ini ├── requirements.txt ├── sample.env └── setup.py ├── moonstreamapi ├── .dockerignore ├── .gitignore ├── .isort.cfg ├── Dockerfile ├── README.md ├── configs │ ├── docker_generate_env.bash │ ├── docker_wait.sh │ └── sample.env ├── deploy │ ├── deploy.bash │ ├── moonstream.service │ └── parameters.py ├── dev.sh ├── moonstreamapi │ ├── __init__.py │ ├── abi_decoder.py │ ├── actions.py │ ├── admin │ │ ├── __init__.py │ │ ├── cli.py │ │ ├── migrations │ │ │ ├── 1_add_abi_backet_and_s3_path.json │ │ │ ├── __init__.py │ │ │ ├── add_selectors.py │ │ │ ├── checksum_address.py │ │ │ ├── generate_entity_subscriptions.py │ │ │ └── update_dashboard_subscription_key.py │ │ ├── moonworm_tasks.py │ │ ├── queries.py │ │ ├── subscription_types.py │ │ ├── subscriptions.py │ │ └── usage.py │ ├── api.py │ ├── data.py │ ├── middleware.py │ ├── providers │ │ ├── __init__.py │ │ ├── bugout.py │ │ ├── moonworm_provider.py │ │ └── transactions.py │ ├── py.typed │ ├── reporter.py │ ├── routes │ │ ├── __init__.py │ │ ├── address_info.py │ │ ├── dashboards.py │ │ ├── queries.py │ │ ├── streams.py │ │ ├── subscriptions.py │ │ ├── txinfo.py │ │ ├── users.py │ │ └── whales.py │ ├── selectors_storage.py │ ├── settings.py │ ├── stream_boundaries.py │ ├── stream_queries.py │ ├── test_actions_abi_validations.py │ ├── test_stream_boundaries.py │ ├── test_stream_queries.py │ ├── text_actions.py │ ├── version.py │ └── web3_provider.py ├── mypy.ini ├── requirements.txt ├── scripts │ ├── txinfo_ethereum_blockchain.bash │ └── txinfo_ethereum_blockchain_request.json └── setup.py ├── moonstreamdb-v3 ├── .gitignore ├── .isort.cfg ├── MANIFEST.in ├── README.md ├── alembic.ini ├── alembic.sample.ini ├── alembic.sh ├── alembic_indexes.sample.ini ├── moonstreamdbv3 │ ├── __init__.py │ ├── alembic │ │ ├── README │ │ ├── __init__.py │ │ ├── env.py │ │ ├── script.py.mako │ │ └── versions │ │ │ ├── 090c247f8618_seer_raw_index.py │ │ │ ├── 1d53afc1eff4_add_b3.py │ │ │ ├── 211646463e9f_immutable_zkevm_with_it_s_sepolia_.py │ │ │ ├── 2e90b758090c_bytea_address_in_labels.py │ │ │ ├── 994e614b5500_tables_initial_generation.py │ │ │ ├── 9ca39b11e12a_game7_orbit_and_mantle_blockchain_models.py │ │ │ ├── __init__.py │ │ │ ├── bebe640146b6_add_raw_transactions.py │ │ │ ├── c79044e047fe_declarative_indexes.py │ │ │ ├── d2ceff33be47_tx_call_and_event_unique_indexes.py │ │ │ ├── d816689b786a_add_game7_mainnet_labels.py │ │ │ ├── dae735afc98f_remove_not_null_constrains.py │ │ │ ├── db9559f9566c_add_game7_testnet.py │ │ │ ├── e6d3c285e7cc_add_ronin_chain.py │ │ │ ├── e9e1b43f49e1_amoy_blast_and_apex_blockchains.py │ │ │ └── e9f640a2b45b_arbitrum_one_blockchain.py │ ├── alembic_indexes │ │ ├── README │ │ ├── __init__.py │ │ ├── env.py │ │ ├── script.py.mako │ │ └── versions │ │ │ ├── 0ea24314c181_init_v3_index.py │ │ │ ├── 25b339f55f8f_add_b3.py │ │ │ ├── 27086791044c_add_topic_3.py │ │ │ ├── 48d2562504d1_add_indexed_at_logs_and_transactions.py │ │ │ ├── 5ce23893771f_add_deployed_by_column.py │ │ │ ├── 6807bdf6f417_add_deploy_block.py │ │ │ ├── 82ff1541f4b4_add_contracts_tables.py │ │ │ ├── 8610f3c98043_add_ronin_chain.py │ │ │ ├── __init__.py │ │ │ ├── a1ead76c0470_add_sepolia.py │ │ │ ├── a4ef4f9031e4_game7_orbit_arbitrum_xai_and_mantle_.py │ │ │ ├── b89a8affe2c3_add_game7_testnet.py │ │ │ ├── c1bc596631f9_add_game7_mainnet_indexes.py │ │ │ ├── e02c90ea67bb_logs_address_selector_index.py │ │ │ ├── f19652e59bc5_immutable_zkevm_with_it_s_sepolia_.py │ │ │ └── f2c6aa92e5d2_add_v3_subscription.py │ ├── blockchain.py │ ├── db.py │ ├── models.py │ ├── models_indexes.py │ ├── version.py │ └── version.txt ├── scm │ ├── pkg │ │ └── blockchain-S0K5PY7LHKC4TFXZ │ │ │ ├── default.nix │ │ │ └── upgrade.sql │ └── scm.nix └── setup.py ├── moonstreamdb ├── .dockerignore ├── .gitignore ├── .isort.cfg ├── Dockerfile ├── README.md ├── alembic.sh ├── alembic │ ├── README │ ├── env.py │ ├── script.py.mako │ └── versions │ │ ├── 0071b7b26b7b_arbitrum_one.py │ │ ├── 0b46c8e17bf2_fields_for_eip_1559.py │ │ ├── 0f8ee1ebb45f_zksync_era_mainnet_model.py │ │ ├── 11233cf42d62_mumbai_model.py │ │ ├── 181c5800cb1b_blast_blockchain.py │ │ ├── 21cced47077c_inital_migration.py │ │ ├── 2391c3cc5050_arbitrum_nova_blockchain_support.py │ │ ├── 240476c67b9f_drop_ethereum_addresses_and_address_id.py │ │ ├── 26000a6bff7d_xai_sepolia_blockchain_support.py │ │ ├── 295ce155c811_fix_avalanche.py │ │ ├── 2fa541f6f6fc_xdai_model.py │ │ ├── 3d55105b0603_drop_pending_tx_table.py │ │ ├── 40871a7807f6_labels_for_addresses.py │ │ ├── 42ca451a9c33_fix_indexes.py │ │ ├── 571f33ad7587_ethereum_smart_contracts.py │ │ ├── 595ccb96f7cf_mantle_with_sepolia_blockchains.py │ │ ├── 5f5b8f19570f_added_index_for_address_type_and_name_.py │ │ ├── 6f7c8d64d49a_zksync_address_label_data_name_index.py │ │ ├── 72f1ad512b2e_support_labels_on_transactions.py │ │ ├── a1d9fab5f904_proofofplay_apex_blockchain.py │ │ ├── a95cbab56a0b_avalanche_and_zksync_era_sepolia_.py │ │ ├── a99b97acc39e_xai_blockchain_support.py │ │ ├── b38b75b11247_arbitrum_sepolia_blockchain_support.py │ │ ├── c413d5265f76_add_wyrm_chain.py │ │ ├── c8eaa4ff9d76_amoy_blockchain.py │ │ ├── d6ed4b1b43d5_drop_foreign_key_constraint_on_tx_hash_.py │ │ ├── e4a796c0407d_zksync_era_model.py │ │ ├── ea8185bd24c7_unique_const_for_addr.py │ │ ├── ecb7817db377_add_opensea_state_table_and_add_index_.py │ │ ├── f1e8cf50a3ff_add_log_index_block_number_timestamp_.py │ │ └── f991fc7493c8_polygon_models.py ├── configs │ ├── alembic.sample.ini │ ├── docker_generate_env.bash │ └── sample.env ├── deploy │ ├── deploy.bash │ └── moonstreamdb.service ├── migrate.sh ├── moonstreamdb │ ├── __init__.py │ ├── blockchain.py │ ├── cli.py │ ├── db.py │ ├── models.py │ ├── networks.py │ ├── subscriptions.py │ └── version.py ├── mypy.ini ├── scm.nix ├── scripts │ └── f1e8cf50a3ff_add_log_index_block_number_timestamp_test.py ├── server │ ├── cmd │ │ ├── data.go │ │ ├── db.go │ │ ├── middlewares.go │ │ ├── routes.go │ │ └── server.go │ ├── configs │ │ └── settings.go │ ├── dev.sh │ ├── go.mod │ ├── go.sum │ ├── main.go │ └── sample.env ├── setup.py └── sync_conf.yml ├── nodebalancer ├── .gitignore ├── README.md ├── cmd │ └── nodebalancer │ │ ├── access_cache_test.go │ │ ├── balancer.go │ │ ├── balances.go │ │ ├── blockchain.go │ │ ├── cli.go │ │ ├── clients.go │ │ ├── clients_test.go │ │ ├── configs.go │ │ ├── main.go │ │ ├── middleware.go │ │ ├── multicall3.go │ │ ├── routes.go │ │ ├── server.go │ │ └── version.go ├── configs │ ├── config.sample.json │ └── contractsConfig.sample.json ├── deploy │ ├── deploy.bash │ └── nodebalancer.service ├── dev.sh ├── go.mod ├── go.sum ├── migrations │ ├── migrations.py │ └── requirements.txt └── sample.env ├── nodes ├── .gitignore ├── deploy │ ├── ethereum │ │ ├── deploy.bash │ │ ├── geth.service │ │ ├── lighthousebeacon.service │ │ └── node-status.service │ ├── polygon │ │ ├── bor.service │ │ ├── deploy.bash │ │ ├── node-status.service │ │ └── variables.env │ └── xdai │ │ ├── deploy.bash │ │ ├── node-status.service │ │ └── xdai.service ├── sample.env └── server │ ├── cmd │ ├── data.go │ ├── middlewares.go │ ├── routes.go │ └── server.go │ ├── configs │ └── settings.go │ ├── dev.sh │ ├── go.mod │ ├── main.go │ └── sample.env ├── probes ├── .gitignore ├── README.md ├── cmd │ └── probes │ │ ├── cli.go │ │ ├── configs.go │ │ ├── db.go │ │ ├── main.go │ │ └── service.go ├── deploy │ ├── configs │ │ └── engine-clean-call-requests.json │ ├── deploy.bash │ └── probes.service ├── dev.sh ├── go.mod ├── go.sum ├── pkg │ ├── data.go │ ├── engine │ │ └── engine.go │ └── version.go └── sample.env ├── robots ├── .gitignore ├── README.md ├── cmd │ └── robots │ │ ├── airdrop.go │ │ ├── cli.go │ │ ├── configs.go │ │ ├── entity.go │ │ ├── main.go │ │ ├── networks.go │ │ ├── signer.go │ │ ├── terminus.go │ │ └── version.go ├── deploy │ ├── deploy.bash │ └── robots-airdrop.service ├── dev.sh ├── go.mod ├── go.sum ├── pkg │ └── terminus │ │ └── terminus.go └── sample.env └── types └── python ├── .gitignore ├── .isort.cfg ├── MANIFEST.in ├── README.md ├── moonstreamtypes ├── __init__.py ├── blockchain.py ├── networks.py ├── subscriptions.py ├── version.py └── version.txt ├── mypy.ini └── setup.py /.github/workflows/lint.backend.yml: -------------------------------------------------------------------------------- 1 | name: Lint Moonstream backend 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "main" 7 | paths: 8 | - "backend/**" 9 | - "!backend/deploy/**" 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: "3.8" 20 | - name: Upgrade pip and setuptools 21 | run: pip install --upgrade pip setuptools 22 | - name: Install test requirements 23 | working-directory: ./backend 24 | run: pip install -e .[dev] 25 | - name: Mypy type check 26 | working-directory: ./backend 27 | run: mypy moonstreamapi/ 28 | - name: Black syntax check 29 | working-directory: ./backend 30 | run: black --check moonstreamapi/ 31 | -------------------------------------------------------------------------------- /.github/workflows/lint.crawlers.yml: -------------------------------------------------------------------------------- 1 | name: Lint Moonstream crawlers 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "main" 7 | paths: 8 | - "crawlers/**" 9 | - "!crawlers/deploy/**" 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: "3.8" 20 | - name: Upgrade pip and setuptools 21 | run: pip install --upgrade pip setuptools 22 | - name: Install test requirements 23 | working-directory: ./crawlers/mooncrawl 24 | run: pip install -e .[dev] 25 | - name: Mypy type check 26 | working-directory: ./crawlers/mooncrawl 27 | run: mypy mooncrawl/ 28 | - name: Black syntax check 29 | working-directory: ./crawlers/mooncrawl 30 | run: black --check mooncrawl/ 31 | -------------------------------------------------------------------------------- /.github/workflows/lint.db.yml: -------------------------------------------------------------------------------- 1 | name: Lint Moonstream db 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "main" 7 | paths: 8 | - "db/**" 9 | - "!db/deploy/**" 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up python 17 | uses: actions/setup-python@v2 18 | with: 19 | python-version: "3.8" 20 | - name: Upgrade pip and setuptools 21 | run: pip install --upgrade pip setuptools 22 | - name: Install test requirements 23 | working-directory: ./db 24 | run: pip install -e .[dev] 25 | - name: Mypy type check 26 | working-directory: ./db 27 | run: mypy moonstreamdb/ 28 | - name: Black syntax check 29 | working-directory: ./db 30 | run: black --check moonstreamdb/ 31 | -------------------------------------------------------------------------------- /.github/workflows/lint.frontend.yml: -------------------------------------------------------------------------------- 1 | name: Build Moonstream frontend 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "main" 7 | paths: 8 | - "frontend/**" 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Set up node.js 16 | uses: actions/setup-node@v1 17 | with: 18 | node-version: "14.17.4" 19 | - name: Check build 20 | working-directory: ./frontend 21 | run: | 22 | yarn 23 | yarn build 24 | -------------------------------------------------------------------------------- /.github/workflows/locust.yml: -------------------------------------------------------------------------------- 1 | name: Locust summary 2 | 3 | on: [pull_request_target] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: PR head repo 10 | id: head_repo_name 11 | run: | 12 | HEAD_REPO_NAME=$(jq -r '.pull_request.head.repo.full_name' "$GITHUB_EVENT_PATH") 13 | echo "PR head repo: $HEAD_REPO_NAME" 14 | echo "::set-output name=repo::$HEAD_REPO_NAME" 15 | - name: Checkout git repo 16 | uses: actions/checkout@v2 17 | with: 18 | repository: ${{ steps.head_repo_name.outputs.repo }} 19 | fetch-depth: 0 20 | - name: Install python 21 | uses: actions/setup-python@v2 22 | with: 23 | python-version: "3.8" 24 | - name: Install dependencies 25 | run: | 26 | python -m pip install --upgrade pip setuptools 27 | pip install bugout-locust 28 | - name: Generate and send Locust summary 29 | env: 30 | BUGOUT_SECRET: ${{ secrets.BUGOUT_SECRET }} 31 | run: | 32 | locust.github publish 33 | -------------------------------------------------------------------------------- /.github/workflows/release.clients.python.yml: -------------------------------------------------------------------------------- 1 | name: Publish Moonstream Python client library 2 | 3 | on: 4 | push: 5 | tags: 6 | - "clients/python/v*" 7 | 8 | defaults: 9 | run: 10 | working-directory: clients/python 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: "3.9" 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e .[distribute] 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: "__token__" 27 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONSTREAM }} 28 | run: | 29 | python -m build 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/release.mooncrawl.yml: -------------------------------------------------------------------------------- 1 | name: Release mooncrawl package 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'mooncrawl/v*' 7 | 8 | defaults: 9 | run: 10 | working-directory: crawlers/mooncrawl 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: '3.8' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e .[distribute] 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: "__token__" 27 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONCRAWL }} 28 | run: | 29 | python -m build 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/release.moonstreamapi.yml: -------------------------------------------------------------------------------- 1 | name: Release moonstreamapi package 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'moonstreamapi/v*' 7 | 8 | defaults: 9 | run: 10 | working-directory: moonstreamapi 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: '3.8' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e .[distribute] 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: "__token__" 27 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONSTREAMAPI }} 28 | run: | 29 | python -m build 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/release.moonstreamdb.yml: -------------------------------------------------------------------------------- 1 | name: Release moonstreamdb package 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'moonstreamdb/v*' 7 | 8 | defaults: 9 | run: 10 | working-directory: moonstreamdb 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: '3.8' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e .[distribute] 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: "__token__" 27 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONSTREAMDB }} 28 | run: | 29 | python -m build 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/release.moonstreamdbv3.yml: -------------------------------------------------------------------------------- 1 | name: Release moonstreamdbv3 package 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'moonstreamdbv3/v*' 7 | 8 | defaults: 9 | run: 10 | working-directory: moonstreamdb-v3 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: '3.8' 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e .[distribute] 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: "__token__" 27 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONSTREAMDBV3 }} 28 | run: | 29 | python -m build 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/release.types.python.yml: -------------------------------------------------------------------------------- 1 | name: Publish Moonstream Python types library 2 | 3 | on: 4 | push: 5 | tags: 6 | - "types/python/v*" 7 | 8 | defaults: 9 | run: 10 | working-directory: types/python 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: actions/setup-python@v4 18 | with: 19 | python-version: "3.9" 20 | - name: Install dependencies 21 | run: | 22 | python -m pip install --upgrade pip 23 | pip install -e .[distribute] 24 | - name: Build and publish 25 | env: 26 | TWINE_USERNAME: "__token__" 27 | TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN_MOONSTREAM_TYPES }} 28 | run: | 29 | python -m build 30 | twine upload dist/* 31 | -------------------------------------------------------------------------------- /.github/workflows/test.clients.python.yml: -------------------------------------------------------------------------------- 1 | name: Linting and tests for the Moonstream Python client library 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "main" 7 | paths: 8 | - "clients/python/**" 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Set up python 16 | uses: actions/setup-python@v2 17 | with: 18 | python-version: "3.9" 19 | - name: Install test requirements 20 | working-directory: ./clients/python 21 | run: pip install -e .[dev] 22 | - name: Mypy type check 23 | working-directory: ./clients/python 24 | run: mypy moonstream/ 25 | - name: Black syntax check 26 | working-directory: ./clients/python 27 | run: black --check moonstream/ 28 | - name: Unit tests 29 | working-directory: ./clients/python 30 | run: python -m unittest discover -v 31 | - name: Check that versions are synchronized 32 | working-directory: ./clients/python 33 | run: | 34 | MOONSTREAM_CLIENT_VERSION=$(python -c "from moonstream.client import MOONSTREAM_CLIENT_VERSION; print(MOONSTREAM_CLIENT_VERSION)") 35 | SETUP_PY_VERSION=$(python setup.py --version) 36 | echo "Client version: $MOONSTREAM_CLIENT_VERSION" 37 | echo "setup.py version: $SETUP_PY_VERSION" 38 | test "$MOONSTREAM_CLIENT_VERSION" = "$SETUP_PY_VERSION" 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .secrets/ 2 | .idea/ 3 | .vscode/ 4 | .DS_Store 5 | .aider* 6 | -------------------------------------------------------------------------------- /clients/python/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /clients/python/moonstream/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/clients/python/moonstream/__init__.py -------------------------------------------------------------------------------- /clients/python/moonstream/aws/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/clients/python/moonstream/aws/__init__.py -------------------------------------------------------------------------------- /clients/python/moonstream/aws/bucket.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict 2 | 3 | import boto3 4 | 5 | 6 | def upload_to_aws_s3_bucket( 7 | data: str, 8 | bucket: str, 9 | key: str, 10 | metadata: Dict[str, Any] = {}, 11 | ) -> str: 12 | """ 13 | Push data to AWS S3 bucket and return URL to object. 14 | """ 15 | s3 = boto3.client("s3") 16 | s3.put_object( 17 | Body=data, 18 | Bucket=bucket, 19 | Key=key, 20 | ContentType="application/json", 21 | Metadata=metadata, 22 | ) 23 | 24 | return f"{bucket}/{key}" 25 | -------------------------------------------------------------------------------- /clients/python/moonstream/data.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | from dataclasses import dataclass 3 | from datetime import datetime 4 | from enum import Enum 5 | from typing import Any, Dict, List, Optional 6 | 7 | 8 | @dataclass(frozen=True) 9 | class APISpec: 10 | url: str 11 | endpoints: Dict[str, str] 12 | 13 | 14 | class AuthType(Enum): 15 | bearer = "Bearer" 16 | web3 = "Web3" 17 | 18 | 19 | class Method(Enum): 20 | DELETE = "delete" 21 | GET = "get" 22 | POST = "post" 23 | PUT = "put" 24 | 25 | 26 | class OutputType(Enum): 27 | CSV = "csv" 28 | JSON = "json" 29 | 30 | 31 | @dataclass(frozen=True) 32 | class MoonstreamQuery: 33 | id: uuid.UUID 34 | name: str 35 | journal_url: Optional[str] = None 36 | query: Optional[str] = None 37 | tags: Optional[List[str]] = None 38 | user: Optional[str] = None 39 | user_id: Optional[uuid.UUID] = None 40 | query_type: Optional[str] = None 41 | created_at: Optional[datetime] = None 42 | updated_at: Optional[datetime] = None 43 | 44 | 45 | @dataclass(frozen=True) 46 | class MoonstreamQueries: 47 | queries: List[MoonstreamQuery] 48 | 49 | 50 | @dataclass(frozen=True) 51 | class MoonstreamQueryResultUrl: 52 | url: str 53 | -------------------------------------------------------------------------------- /clients/python/moonstream/exceptions.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Optional 2 | 3 | 4 | class MoonstreamResponseException(Exception): 5 | """ 6 | Raised when Moonstream server response with error. 7 | """ 8 | 9 | def __init__( 10 | self, 11 | message, 12 | status_code: int, 13 | detail: Optional[Any] = None, 14 | ) -> None: 15 | super().__init__(message) 16 | self.status_code = status_code 17 | if detail is not None: 18 | self.detail = detail 19 | 20 | 21 | class MoonstreamUnexpectedResponse(Exception): 22 | """ 23 | Raised when Moonstream server response is unexpected (e.g. unparseable). 24 | """ 25 | -------------------------------------------------------------------------------- /clients/python/moonstream/settings.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | MOONSTREAM_API_URL = os.environ.get("MOONSTREAM_API_URL", "https://api.moonstream.to") 4 | 5 | MOONSTREAM_REQUEST_TIMEOUT = 10 6 | MOONSTREAM_REQUEST_TIMEOUT_RAW = os.environ.get("MOONSTREAM_REQUEST_TIMEOUT") 7 | try: 8 | if MOONSTREAM_REQUEST_TIMEOUT_RAW is not None: 9 | MOONSTREAM_REQUEST_TIMEOUT = int(MOONSTREAM_REQUEST_TIMEOUT_RAW) 10 | except: 11 | raise Exception( 12 | f"Could not parse MOONSTREAM_REQUEST_TIMEOUT environment variable as int: {MOONSTREAM_REQUEST_TIMEOUT_RAW}" 13 | ) 14 | -------------------------------------------------------------------------------- /clients/python/moonstream/version.py: -------------------------------------------------------------------------------- 1 | MOONSTREAM_CLIENT_VERSION = "0.1.2" 2 | -------------------------------------------------------------------------------- /clients/python/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | 3 | [mypy-boto3.*] 4 | ignore_missing_imports = True -------------------------------------------------------------------------------- /clients/python/sample.env: -------------------------------------------------------------------------------- 1 | # Tests variables 2 | export MOONSTREAM_API_URL="https://api.moonstream.to" 3 | export MOONSTREAM_ACCESS_TOKEN="" 4 | -------------------------------------------------------------------------------- /clients/python/setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import find_packages, setup 2 | 3 | from moonstream.version import MOONSTREAM_CLIENT_VERSION 4 | 5 | long_description = "" 6 | with open("README.md") as ifp: 7 | long_description = ifp.read() 8 | 9 | setup( 10 | name="moonstream", 11 | version=MOONSTREAM_CLIENT_VERSION, 12 | packages=find_packages(), 13 | package_data={"moonstream": ["py.typed"]}, 14 | install_requires=["requests", "pydantic", "dataclasses; python_version=='3.6'"], 15 | extras_require={ 16 | "aws": ["boto3"], 17 | "dev": [ 18 | "black", 19 | "mypy", 20 | "isort", 21 | "wheel", 22 | "types-requests", 23 | "types-dataclasses", 24 | ], 25 | "distribute": ["build", "twine"], 26 | }, 27 | description="Moonstream: Open source blockchain analytics", 28 | long_description=long_description, 29 | long_description_content_type="text/markdown", 30 | author="Moonstream", 31 | author_email="engineering@moonstream.to", 32 | classifiers=[ 33 | "Development Status :: 3 - Alpha", 34 | "Programming Language :: Python", 35 | "License :: OSI Approved :: Apache Software License", 36 | "Topic :: Software Development :: Libraries", 37 | ], 38 | url="https://github.com/bugout-dev/moonstream", 39 | ) 40 | -------------------------------------------------------------------------------- /crawlers/deploy/amoy-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Amoy historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type amoy --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=amoy-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/amoy-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on Amoy 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/amoy-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Amoy historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type amoy --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=amoy-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/amoy-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on Amoy 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/amoy-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Amoy database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain amoy -n 10 | CPUWeight=50 11 | SyslogIdentifier=amoy-missing -------------------------------------------------------------------------------- /crawlers/deploy/amoy-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Amoy database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/amoy-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Amoy moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b amoy --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=amoy-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/amoy-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Amoy block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain amoy -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=amoy-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-nova-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Arbitrum Nova database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain arbitrum_nova -n 10 | CPUWeight=50 11 | SyslogIdentifier=arbitrum-nova-missing -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-nova-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Arbitrum Nova database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-nova-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum Nova moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b arbitrum_nova --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=arbitrum-nova-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-nova-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum Nova block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain arbitrum_nova -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=arbitrum-nova-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum One historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type arbitrum_one --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=arbitrum-one-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on arbitrum one 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum One historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type arbitrum_one --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=arbitrum-one-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on proofofplay apex 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Arbitrum One database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain arbitrum_one -n 10 | CPUWeight=50 11 | SyslogIdentifier=arbitrum-one-missing -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Arbitrum One database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum One moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b arbitrum_one --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=arbitrum-one-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Arbitrum one state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain arbitrum_one 10 | CPUWeight=60 11 | SyslogIdentifier=arbitrum-one-state -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Arbitrum one state crawler each 5m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-one-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum One block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain arbitrum_one -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=arbitrum-one-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-sepolia-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Arbitrum Sepolia database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain arbitrum_sepolia -n 10 | CPUWeight=50 11 | SyslogIdentifier=arbitrum-sepolia-missing -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-sepolia-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Arbitrum Sepolia database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-sepolia-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum Sepolia moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b arbitrum_sepolia --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=arbitrum-sepolia-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-sepolia-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Arbitrum Sepolia state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain arbitrum_sepolia 10 | CPUWeight=60 11 | SyslogIdentifier=arbitrum-sepolia-state -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-sepolia-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Arbitrum Sepolia state crawler each 5m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/arbitrum-sepolia-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Arbitrum Sepolia block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain arbitrum_sepolia -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=arbitrum-sepolia-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-fuji-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Avalanche Fuji database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain avalanche_fuji -n 10 | CPUWeight=50 11 | SyslogIdentifier=avalanche-fuji-missing -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-fuji-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Avalanche Fuji database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-fuji-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Avalanche Fuji moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b avalanche_fuji --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=avalanche-fuji-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-fuji-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Avalanche Fuji block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain avalanche_fuji -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=avalanche-fuji-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Avalanche database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain avalanche -n 10 | CPUWeight=50 11 | SyslogIdentifier=avalanche-missing -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Avalanche database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Avalanche moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b avalanche --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=avalanche-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/avalanche-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Avalanche block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain avalanche -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=avalanche-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/blast-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Blast database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain blast -n 10 | CPUWeight=50 11 | SyslogIdentifier=blast-missing -------------------------------------------------------------------------------- /crawlers/deploy/blast-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Blast database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/blast-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Blast moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b blast --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=blast-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/blast-sepolia-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Blast Sepolia database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain blast_sepolia -n 10 | CPUWeight=50 11 | SyslogIdentifier=blast-sepolia-missing -------------------------------------------------------------------------------- /crawlers/deploy/blast-sepolia-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Blast Sepolia database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/blast-sepolia-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Blast Sepolia moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b blast_sepolia --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=blast-sepolia-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/blast-sepolia-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Blast Sepolia block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain blast_sepolia -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=blast-sepolia-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/blast-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Blast block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain blast -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=blast-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type ethereum --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=ethereum-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on ethereum 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type ethereum --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=ethereum-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on ethereum 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-metadata.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute metadata crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain ethereum 10 | CPUWeight=60 11 | SyslogIdentifier=ethereum-metadata -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-metadata.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Ethereum metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=60m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Ethereum database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain ethereum -n 10 | CPUWeight=50 11 | SyslogIdentifier=ethereum-missing 12 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Ethereum database 3 | 4 | [Timer] 5 | OnBootSec=40s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b ethereum 13 | CPUWeight=70 14 | SyslogIdentifier=ethereum-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-orange-dao-reports-tokenonomics.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs custom crawler for orange dao tokenonomics 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.reports_crawler.cli orangedao --moonstream-token "${MOONSTREAM_ORANGE_DAO_QUERIES_DATA_ACCESS_TOKEN}" run_tokenomics_orange_dao 10 | CPUWeight=60 11 | SyslogIdentifier=ethereum-orange-dao-reports-tokenonomics -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-orange-dao-reports-tokenonomics.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs custom crawler for CU tokenonomics 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-state-clean.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state clean labels crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli clean-state-labels --blockchain ethereum -N 10000 10 | CPUWeight=60 11 | SyslogIdentifier=ethereum-state-clean -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-state-clean.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Ethereum state clean labels crawler each 25m 3 | 4 | [Timer] 5 | OnBootSec=50s 6 | OnUnitActiveSec=25m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain ethereum --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/ethereum-jobs.json 10 | CPUWeight=60 11 | SyslogIdentifier=ethereum-state -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Ethereum state crawler each 5m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/ethereum-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain ethereum -c 6 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=ethereum-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/game7-metadata copy.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=60m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/game7-metadata.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute metadata crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain game7 10 | CPUWeight=60 11 | SyslogIdentifier=game7-metadata 12 | -------------------------------------------------------------------------------- /crawlers/deploy/game7-metadata.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=60m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/game7-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain game7 10 | CPUWeight=60 11 | SyslogIdentifier=game7-state -------------------------------------------------------------------------------- /crawlers/deploy/game7-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 state crawler each 5m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/game7-testnet-metadata.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute metadata crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain game7_testnet 10 | CPUWeight=60 11 | SyslogIdentifier=game7-testnet-metadata 12 | -------------------------------------------------------------------------------- /crawlers/deploy/game7-testnet-metadata.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 testnet metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=60m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/game7-testnet-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 testnet state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain game7_testnet 10 | CPUWeight=60 11 | SyslogIdentifier=game7-testnet-state -------------------------------------------------------------------------------- /crawlers/deploy/game7-testnet-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Game7 testnet state crawler each 5m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/leaderboards-worker.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs leaderboards generator worker 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.leaderboards_generator.cli leaderboards-generate --query-api-access-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" 10 | CPUWeight=60 11 | SyslogIdentifier=leaderboards-worker -------------------------------------------------------------------------------- /crawlers/deploy/leaderboards-worker.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs leaderboard update script every 10 minutes 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle historical events crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type mantle --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=mantle-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on Mantle blockchain 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle historical transactions crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type mantle --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=mantle-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on mantle blockchain 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Mantle database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain mantle -n 10 | CPUWeight=50 11 | SyslogIdentifier=mantle-missing -------------------------------------------------------------------------------- /crawlers/deploy/mantle-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Mantle database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b mantle --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=mantle-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle sepolia historical events crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type mantle_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=mantle-sepolia-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on Mantle sepolia blockchain 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle sepolia historical transactions crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type mantle-sepolia --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=mantle-sepolia-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on mantle-sepolia blockchain 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Mantle sepolia database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain mantle-sepolia -n 10 | CPUWeight=50 11 | SyslogIdentifier=mantle-sepolia-missing -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Mantle sepolia database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle sepolia moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b mantle-sepolia --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=mantle-sepolia-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-sepolia-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle sepolia block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain mantle_sepolia -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=mantle-sepolia-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mantle-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Mantle block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain mantle -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=mantle-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/monitoring-crawlers-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "notification_pagerduty": true, 3 | "notification_telegram": true, 4 | "notification_sendgrid": true, 5 | "notification_humbug": true, 6 | "silent": [] 7 | } -------------------------------------------------------------------------------- /crawlers/deploy/monitoring-crawlers.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Monitor crawlers systemd state 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/ 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/monitoring.env 12 | ExecStart=/home/ubuntu/monitoring -plugin systemd -host "${AWS_LOCAL_IPV4}" -port 7171 -healthcheck -server -threshold 3 -config /home/ubuntu/.monitoring/monitoring-crawlers-config.json -service ethereum-moonworm-crawler.service -service amoy-moonworm-crawler.service -service polygon-moonworm-crawler.service -service zksync-era-moonworm-crawler.service -service zksync-era-sepolia-moonworm-crawler.service -service arbitrum-nova-moonworm-crawler.service -service arbitrum-sepolia-moonworm-crawler.service -service xai-moonworm-crawler.service -service xai-sepolia-moonworm-crawler.service -service avalanche-moonworm-crawler.service -service avalanche-fuji-moonworm-crawler.service -service blast-moonworm-crawler.service -service blast-sepolia-moonworm-crawler.service -service proofofplay-apex-moonworm-crawler.service -service arbitrum-one-moonworm-crawler.service 13 | CPUWeight=90 14 | SyslogIdentifier=monitoring-crawlers 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/mooncrawl.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Moonstream crawlers HTTP API server 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/uvicorn --host "${AWS_LOCAL_IPV4}" --port "${MOONSTREAM_CRAWLERS_SERVER_PORT}" --workers 4 mooncrawl.api:app 13 | SyslogIdentifier=mooncrawl 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-cu-nft-dashboard.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Generate data for nft dashboard for cu community 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.reports_crawler.cli cu-reports --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" generate-nft-dashboard 10 | CPUWeight=60 11 | SyslogIdentifier=polygon-cu-nft-dashboard -------------------------------------------------------------------------------- /crawlers/deploy/polygon-cu-nft-dashboard.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Generate data for nft dashboard for cu community 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Polygon historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type polygon --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=polygon-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/polygon-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on polygon 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Polygon historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type polygon --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=polygon-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/polygon-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on polygon 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-metadata.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute metadata crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain polygon 10 | CPUWeight=60 11 | SyslogIdentifier=polygon-metadata -------------------------------------------------------------------------------- /crawlers/deploy/polygon-metadata.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Polygon metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=60m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Polygon database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain polygon -n 10 | CPUWeight=50 11 | SyslogIdentifier=polygon-missing -------------------------------------------------------------------------------- /crawlers/deploy/polygon-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Polygon database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Polygon moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b polygon --confirmations 50 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=polygon-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/polygon-state-clean.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state clean labels crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli clean-state-labels --blockchain polygon -N 10000 10 | CPUWeight=60 11 | SyslogIdentifier=polygon-state-clean -------------------------------------------------------------------------------- /crawlers/deploy/polygon-state-clean.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Polygon state clean labels crawler each 25m 3 | 4 | [Timer] 5 | OnBootSec=50s 6 | OnUnitActiveSec=25m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain polygon --infura --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/polygon-jobs.json 10 | CPUWeight=60 11 | SyslogIdentifier=polygon-state -------------------------------------------------------------------------------- /crawlers/deploy/polygon-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Polygon state crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/polygon-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Polygon block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain polygon --confirmations 40 --jobs 2 13 | CPUWeight=90 14 | SyslogIdentifier=polygon-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ProofOfPlay historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type proofofplay_apex --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=proofofplay-apex-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on proofofplay apex 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ProofOfPlay historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type proofofplay_apex --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=proofofplay-apex-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on proofofplay apex 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at ProofOfPlay database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain proofofplay_apex -n 10 | CPUWeight=50 11 | SyslogIdentifier=proofofplay-apex-missing -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at ProofOfPlay database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ProofOfPlay Apex moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b proofofplay_apex --confirmations 50 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=proofofplay-apex-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/proofofplay-apex-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ProofOfPlay Apex block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain proofofplay_apex --confirmations 40 --jobs 2 13 | CPUWeight=90 14 | SyslogIdentifier=proofofplay-apex-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/sepolia-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Sepolia state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain sepolia 10 | CPUWeight=60 11 | SyslogIdentifier=sepolia-state -------------------------------------------------------------------------------- /crawlers/deploy/sepolia-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Sepolia state crawler each 5m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type xai --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=xai-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on xai 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type xai --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=xai-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on xai 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-metadata.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute metadata crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain xai 10 | CPUWeight=60 11 | SyslogIdentifier=xai-metadata -------------------------------------------------------------------------------- /crawlers/deploy/xai-metadata.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Xai metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Xai database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain xai -n 10 | CPUWeight=50 11 | SyslogIdentifier=xai-missing -------------------------------------------------------------------------------- /crawlers/deploy/xai-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Xai database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b xai --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=xai-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai sepolia historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type xai_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=xai-sepolia-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on xai sepolia 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai sepolia historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type xai_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=xai-sepolia-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on xai sepolia 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-metadata.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute metadata crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.metadata_crawler.cli crawl --blockchain xai_sepolia 10 | CPUWeight=60 11 | SyslogIdentifier=xai-sepolia-metadata -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-metadata.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Xai sepolia metadata crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=20s 6 | OnUnitActiveSec=60m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Xai sepolia database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain xai_sepolia -n 10 | CPUWeight=50 11 | SyslogIdentifier=xai-sepolia-missing -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at Xai sepolia database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai sepolia moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b xai_sepolia --confirmations 10 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=xai-sepolia-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-state-clean.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state clean labels crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli clean-state-labels --blockchain xai -N 10000 10 | CPUWeight=60 11 | SyslogIdentifier=xai-sepolia-state-clean -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-state-clean.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Xai sepolia state clean labels crawler each 25m 3 | 4 | [Timer] 5 | OnBootSec=50s 6 | OnUnitActiveSec=25m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain xai_sepolia 10 | CPUWeight=60 11 | SyslogIdentifier=sepolia-state -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Xai sepolia state crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-sepolia-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai sepolia block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain xai_sepolia -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=xai-sepolia-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xai-state-clean.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state clean labels crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli clean-state-labels --blockchain xai -N 10000 10 | CPUWeight=60 11 | SyslogIdentifier=xai-state-clean -------------------------------------------------------------------------------- /crawlers/deploy/xai-state-clean.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Xai state clean labels crawler each 25m 3 | 4 | [Timer] 5 | OnBootSec=50s 6 | OnUnitActiveSec=25m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain xai 10 | CPUWeight=60 11 | SyslogIdentifier=xai-state -------------------------------------------------------------------------------- /crawlers/deploy/xai-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Xai state crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xai-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Xai block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain xai -c 10 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=xai-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xdai-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=XDai historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type xdai --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=xdai-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xdai-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on xdai 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xdai-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=XDai historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type xdai --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=xdai-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xdai-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on xdai 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/xdai-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at XDai database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain xdai -n 10 | CPUWeight=50 11 | SyslogIdentifier=xdai-missing -------------------------------------------------------------------------------- /crawlers/deploy/xdai-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at XDai database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target -------------------------------------------------------------------------------- /crawlers/deploy/xdai-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=XDai moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b xdai 13 | CPUWeight=70 14 | SyslogIdentifier=xdai-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/xdai-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=XDai block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain xdai -c 60 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=xdai-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type zksync_era --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=zksync-era-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on ZkSync Era 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type zksync_era --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=zksync-era-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on ZkSync Era 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at ZkSync Era database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain zksync_era -n 10 | CPUWeight=50 11 | SyslogIdentifier=zksync-era-missing -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at ZkSync Era database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b zksync_era --confirmations 20 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=zksync-era-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-historical-crawl-events.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era Sepolia historical crawler events 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type zksync_era_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-events 13 | CPUWeight=70 14 | SyslogIdentifier=zksync-era-sepolia-historical-crawl-events 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-historical-crawl-events.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs events historical crawler on ZkSync Era Sepolia 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-historical-crawl-transactions.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era Sepolia historical crawler transactions 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli historical-crawl --blockchain-type zksync_era_sepolia --find-deployed-blocks --end 0 --tasks-journal --only-functions 13 | CPUWeight=70 14 | SyslogIdentifier=zksync-era-sepolia-historical-crawl-transactions 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-historical-crawl-transactions.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Runs transactions historical crawler on ZkSync Era Sepolia 3 | 4 | [Timer] 5 | OnBootSec=60s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-missing.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at ZkSync Era Sepolia database 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks missing --blockchain zksync_era_sepolia -n 10 | CPUWeight=50 11 | SyslogIdentifier=zksync-era-sepolia-missing -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-missing.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Fill missing blocks at ZkSync Era Sepolia database 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=15m 7 | 8 | [Install] 9 | WantedBy=timers.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-moonworm-crawler.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era Sepolia moonworm crawler 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.moonworm_crawler.cli crawl -b zksync_era_sepolia --confirmations 20 --min-blocks-batch 20 13 | CPUWeight=70 14 | SyslogIdentifier=zksync-era-sepolia-moonworm-crawler 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-sepolia-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain zksync_era_sepolia -c 20 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=zksync-era-sepolia-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-state-clean.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state clean labels crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli clean-state-labels --blockchain zksync_era -N 10000 10 | CPUWeight=60 11 | SyslogIdentifier=zksync-era-state-clean -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-state-clean.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Zksync Era state clean labels crawler each 25m 3 | 4 | [Timer] 5 | OnBootSec=50s 6 | OnUnitActiveSec=25m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-state.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute state crawler 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 8 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 9 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.state_crawler.cli crawl-jobs --moonstream-token "${MOONSTREAM_PUBLIC_QUERIES_DATA_ACCESS_TOKEN}" --blockchain zksync_era --jobs-file /home/ubuntu/moonstream/crawlers/mooncrawl/mooncrawl/state_crawler/jobs/zksync-era-jobs.json 10 | CPUWeight=60 11 | SyslogIdentifier=zksync-era-state -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-state.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Execute Zksync Era state crawler each 10m 3 | 4 | [Timer] 5 | OnBootSec=15s 6 | OnUnitActiveSec=10m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /crawlers/deploy/zksync-era-synchronize.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ZkSync Era block with transactions synchronizer 3 | StartLimitIntervalSec=300 4 | StartLimitBurst=3 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=15s 10 | WorkingDirectory=/home/ubuntu/moonstream/crawlers/mooncrawl 11 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 12 | ExecStart=/home/ubuntu/moonstream-env/bin/python -m mooncrawl.crawler blocks synchronize --blockchain zksync_era -c 20 -j 2 13 | CPUWeight=90 14 | SyslogIdentifier=zksync-era-synchronize 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /crawlers/ldb/cmd/reporter.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | 7 | "github.com/bugout-dev/humbug/go/pkg" 8 | "github.com/bugout-dev/moonstream/crawlers/ldb/configs" 9 | ) 10 | 11 | var ( 12 | humbugReporter *HumbugReporter 13 | ) 14 | 15 | // Generate humbug client 16 | func setHumbugClient(sessionID string) error { 17 | consent := humbug.CreateHumbugConsent(humbug.True) 18 | reporter, err := humbug.CreateHumbugReporter(consent, configs.HUMBUG_LDB_CLIENT_ID, sessionID, configs.HUMBUG_LDB_TOKEN) 19 | if err != nil { 20 | return fmt.Errorf("Unable to generate humbug reporter: %v", err) 21 | } 22 | humbugReporter.Reporter = reporter 23 | 24 | return nil 25 | } 26 | 27 | // Publish report with verified blocks to entry 28 | func (r *HumbugReporter) submitReport(start, end uint64, prefix string) error { 29 | content, err := json.Marshal(corruptBlocks) 30 | if err != nil { 31 | return fmt.Errorf("Unable to marshal to json: %v", err) 32 | } 33 | 34 | report := humbug.Report{ 35 | Title: fmt.Sprintf("%sLDB verifier %d-%d", prefix, start, end), 36 | Content: string(content), 37 | Tags: []string{ 38 | fmt.Sprintf("start:%d", start), 39 | fmt.Sprintf("end:%d", end), 40 | }, 41 | } 42 | r.Reporter.Publish(report) 43 | fmt.Printf("%sLDB report for range %d-%d published\n", prefix, start, end) 44 | 45 | return nil 46 | } 47 | -------------------------------------------------------------------------------- /crawlers/ldb/configs/settings.go: -------------------------------------------------------------------------------- 1 | package configs 2 | 3 | import ( 4 | "os" 5 | "time" 6 | ) 7 | 8 | // Database configs 9 | var MOONSTREAM_DB_MAX_IDLE_CONNS int = 30 10 | var MOONSTREAM_DB_CONN_MAX_LIFETIME = 30 * time.Minute 11 | var MOONSTREAM_DB_URI = os.Getenv("MOONSTREAM_DB_URI") 12 | 13 | // Humber configs 14 | var HUMBUG_LDB_CLIENT_ID = os.Getenv("HUMBUG_LDB_CLIENT_ID") 15 | var HUMBUG_LDB_TOKEN = os.Getenv("HUMBUG_LDB_TOKEN") 16 | -------------------------------------------------------------------------------- /crawlers/ldb/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/bugout-dev/moonstream/crawlers/ldb/cmd" 5 | ) 6 | 7 | func main() { 8 | cmd.LDBCLI() 9 | } 10 | -------------------------------------------------------------------------------- /crawlers/ldb/sample.env: -------------------------------------------------------------------------------- 1 | export MOONSTREAM_DB_URI="postgresql://:@:/" 2 | export HUMBUG_LDB_CLIENT_ID="" 3 | export HUMBUG_LDB_TOKEN="" 4 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/.gitignore: -------------------------------------------------------------------------------- 1 | .venv/ 2 | .mooncrawl/ 3 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /crawlers/mooncrawl/README.md: -------------------------------------------------------------------------------- 1 | # Moonstream Crawlers 2 | 3 | ## Installation 4 | 5 | (Use Python 3) 6 | 7 | ```bash 8 | pip install -e . 9 | ``` 10 | 11 | ### Database access and environment variables 12 | 13 | Make sure that the `MOONSTREAM_DB_URI` environment variable is set as a Postgres connection string. 14 | 15 | For a sample, view [`sample.env`](./sample.env). 16 | 17 | ## Crawlers 18 | 19 | ### Ethereum Signature Database 20 | 21 | This crawler retrieves Ethereum function signatures from the Ethereum Signature Database at 22 | [https://www.4byte.directory](https://www.4byte.directory). 23 | 24 | #### Crawling ESD function signatures 25 | 26 | ```bash 27 | python -m mooncrawl.esd --interval 0.3 functions 28 | ``` 29 | 30 | #### Crawling ESD event signatures 31 | 32 | ```bash 33 | python -m mooncrawl.esd --interval 0.3 events 34 | ``` 35 | 36 | ### Ethereum contract registrar 37 | 38 | This crawler scans new transactions for smart contract deployments and retrieves their deployment 39 | addresses from transaction receipts. 40 | 41 | To run this crawler: 42 | 43 | ```bash 44 | python -m mooncrawl.cli ethcrawler contracts update 45 | ``` 46 | 47 | Output is JSON list of pairs `[..., (, ), ...]`, so you can pipe to `jq`: 48 | 49 | ```bash 50 | python -m mooncrawl.cli ethcrawler contracts update | jq . 51 | ``` 52 | 53 | You can also specify an output file: 54 | 55 | ```bash 56 | python -m mooncrawl.cli ethcrawler contracts update -o new_contracts.json 57 | ``` 58 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Expects access to Python environment with the requirements for this project installed. 4 | set -e 5 | 6 | MOONSTREAM_HOST="${MOONSTREAM_HOST:-0.0.0.0}" 7 | MOONSTREAM_PORT="${MOONSTREAM_PORT:-7491}" 8 | 9 | uvicorn --port "$MOONSTREAM_PORT" --host "$MOONSTREAM_HOST" mooncrawl.api:app --reload 10 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | from .reporter import reporter 3 | from .version import MOONCRAWL_VERSION 4 | 5 | # Reporting 6 | reporter.tags.append(f"version:{MOONCRAWL_VERSION}") 7 | reporter.system_report(publish=True) 8 | reporter.setup_excepthook(publish=True) 9 | except: 10 | # Pass it to be able import MOONCRAWL_VERSION in setup.py with pip 11 | pass 12 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/contract/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/contract/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/generic_crawler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/generic_crawler/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/leaderboards_generator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/leaderboards_generator/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/metadata_crawler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/metadata_crawler/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/middleware.py: -------------------------------------------------------------------------------- 1 | import logging 2 | from typing import Any, Dict, Optional 3 | 4 | from fastapi import HTTPException 5 | 6 | from .reporter import reporter 7 | 8 | logger = logging.getLogger(__name__) 9 | 10 | 11 | class MoonstreamHTTPException(HTTPException): 12 | """ 13 | Extended HTTPException to handle 500 Internal server errors 14 | and send crash reports. 15 | """ 16 | 17 | def __init__( 18 | self, 19 | status_code: int, 20 | detail: Any = None, 21 | headers: Optional[Dict[str, Any]] = None, 22 | internal_error: Optional[Exception] = None, 23 | ): 24 | super().__init__(status_code, detail, headers) 25 | if internal_error is not None: 26 | reporter.error_report(internal_error) 27 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/moonworm_crawler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/moonworm_crawler/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/publish.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from datetime import datetime 4 | from typing import Any, Dict, List, Optional 5 | 6 | import requests 7 | 8 | 9 | def publish_json( 10 | crawl_type: str, 11 | humbug_token: str, 12 | title: str, 13 | content: Dict[str, Any], 14 | tags: Optional[List[str]] = None, 15 | wait: bool = True, 16 | created_at: Optional[str] = None, 17 | ) -> None: 18 | spire_api_url = os.environ.get( 19 | "MOONSTREAM_SPIRE_API_URL", "https://spire.bugout.dev" 20 | ).rstrip("/") 21 | report_url = f"{spire_api_url}/humbug/reports" 22 | 23 | if tags is None: 24 | tags = [] 25 | 26 | tags.append(f"crawl_type:{crawl_type}") 27 | 28 | headers = { 29 | "Authorization": f"Bearer {humbug_token}", 30 | } 31 | request_body = { 32 | "title": title, 33 | "content": json.dumps(content), 34 | "tags": tags, 35 | } 36 | if created_at is not None: 37 | request_body["created_at"] = created_at 38 | 39 | query_parameters = {"sync": wait} 40 | 41 | response = requests.post( 42 | report_url, headers=headers, json=request_body, params=query_parameters 43 | ) 44 | 45 | response.raise_for_status() 46 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/reporter.py: -------------------------------------------------------------------------------- 1 | import os 2 | import uuid 3 | 4 | from humbug.consent import HumbugConsent 5 | from humbug.report import HumbugReporter 6 | 7 | from .settings import HUMBUG_REPORTER_CRAWLERS_TOKEN 8 | 9 | session_id = str(uuid.uuid4()) 10 | client_id = "moonstream-crawlers" 11 | 12 | spire_url = os.environ.get("MOONSTREAM_SPIRE_API_URL") 13 | 14 | reporter = HumbugReporter( 15 | name="moonstream-crawlers", 16 | consent=HumbugConsent(True), 17 | client_id=client_id, 18 | session_id=session_id, 19 | bugout_token=HUMBUG_REPORTER_CRAWLERS_TOKEN, 20 | tags=[], 21 | url=spire_url, 22 | ) 23 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/reports_crawler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/reports_crawler/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/state_crawler/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/state_crawler/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/stats_worker/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/crawlers/mooncrawl/mooncrawl/stats_worker/__init__.py -------------------------------------------------------------------------------- /crawlers/mooncrawl/mooncrawl/version.py: -------------------------------------------------------------------------------- 1 | """ 2 | Moonstream crawlers version. 3 | """ 4 | 5 | MOONCRAWL_VERSION = "0.5.4" 6 | -------------------------------------------------------------------------------- /crawlers/mooncrawl/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | 3 | [mypy-sqlalchemy.*] 4 | ignore_missing_imports = True 5 | 6 | [mypy-moonstreamdb.*] 7 | ignore_missing_imports = True 8 | 9 | [mypy-pyevmasm.*] 10 | ignore_missing_imports = True 11 | 12 | [mypy-tqdm.*] 13 | ignore_missing_imports = True 14 | 15 | [mypy-moonworm.*] 16 | ignore_missing_imports = True 17 | -------------------------------------------------------------------------------- /crawlers/txpool/.gitignore: -------------------------------------------------------------------------------- 1 | .secrets/ 2 | -------------------------------------------------------------------------------- /crawlers/txpool/cmd/data.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "github.com/ethereum/go-ethereum/common" 5 | "github.com/ethereum/go-ethereum/common/hexutil" 6 | ) 7 | 8 | type Transaction struct { 9 | Type hexutil.Uint64 `json:"type"` 10 | 11 | // Common transaction fields: 12 | Nonce *hexutil.Uint64 `json:"nonce"` 13 | GasPrice *hexutil.Big `json:"gasPrice"` 14 | MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` 15 | MaxFeePerGas *hexutil.Big `json:"maxFeePerGas"` 16 | Gas *hexutil.Uint64 `json:"gas"` 17 | Value *hexutil.Big `json:"value"` 18 | Data *hexutil.Bytes `json:"input"` 19 | V *hexutil.Big `json:"v"` 20 | R *hexutil.Big `json:"r"` 21 | S *hexutil.Big `json:"s"` 22 | To *common.Address `json:"to"` 23 | 24 | // Access list transaction fields: 25 | ChainID *hexutil.Big `json:"chainId,omitempty"` 26 | // AccessList *AccessList `json:"accessList,omitempty"` 27 | 28 | // Only used for encoding: 29 | Hash common.Hash `json:"hash"` 30 | } 31 | 32 | type PendingTransaction struct { 33 | From string `json:"from"` 34 | Nonce uint64 `json:"nonce"` 35 | Transaction *Transaction `json:"transaction"` 36 | } 37 | 38 | type PendingTransactions struct { 39 | Transactions PendingTransaction `json:"transactions"` 40 | } 41 | -------------------------------------------------------------------------------- /crawlers/txpool/configs/settings.go: -------------------------------------------------------------------------------- 1 | package settings 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "strings" 7 | ) 8 | 9 | // Internal crash journal to collect errors 10 | var HUMBUG_REPORTER_CRAWLERS_TOKEN = os.Getenv("HUMBUG_REPORTER_CRAWLERS_TOKEN") 11 | 12 | var HUMBUG_TXPOOL_CLIENT_ID = os.Getenv("HUMBUG_TXPOOL_CLIENT_ID") 13 | var HUMBUG_TXPOOL_TOKEN = os.Getenv("HUMBUG_TXPOOL_TOKEN") 14 | 15 | // Geth connection URL 16 | func GetIpcPath(blockchain string) string { 17 | MOONSTREAM_WEB3_PROVIDER_URI := os.Getenv(fmt.Sprintf("MOONSTREAM_%s_WEB3_PROVIDER_URI", strings.ToUpper(blockchain))) 18 | return MOONSTREAM_WEB3_PROVIDER_URI 19 | } 20 | -------------------------------------------------------------------------------- /crawlers/txpool/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Colpile application and run with provided arguments 4 | set -e 5 | 6 | PROGRAM_NAME="txpool" 7 | 8 | go build -o "$PROGRAM_NAME" . 9 | 10 | ./"$PROGRAM_NAME" "$@" 11 | -------------------------------------------------------------------------------- /crawlers/txpool/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bugout-dev/moonstream/crawlers/txpool 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/bugout-dev/humbug/go v0.0.0-20210824160906-6b6096c4091e 7 | github.com/ethereum/go-ethereum v1.10.7 8 | github.com/google/uuid v1.3.0 9 | ) 10 | -------------------------------------------------------------------------------- /crawlers/txpool/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/bugout-dev/moonstream/crawlers/txpool/cmd" 5 | ) 6 | 7 | func main() { 8 | cmd.InitTxPool() 9 | } 10 | -------------------------------------------------------------------------------- /crawlers/txpool/sample.env: -------------------------------------------------------------------------------- 1 | export HUMBUG_TXPOOL_CLIENT_ID="" 2 | export HUMBUG_TXPOOL_TOKEN="" 3 | export HUMBUG_REPORTER_CRAWLERS_TOKEN="" 4 | 5 | # Nodes environment variables 6 | export MOONSTREAM_ETHEREUM_WEB3_PROVIDER_URI="https://" 7 | export MOONSTREAM_POLYGON_WEB3_PROVIDER_URI="https://" 8 | # Moonstream nodebalancer 9 | export NB_CONTROLLER_ACCESS_ID="" 10 | -------------------------------------------------------------------------------- /datasets/nfts/README.md: -------------------------------------------------------------------------------- 1 | # The Moonstream NFTs dataset 2 | 3 | This directory contains all the code needed to construct the Moonstream NFTs dataset. These scripts 4 | may require access to: 5 | 1. The Moonstream database 6 | 2. Moonstream Bugout data stores 7 | 3. A web3 provider 8 | -------------------------------------------------------------------------------- /datasets/nfts/nfts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/datasets/nfts/nfts/__init__.py -------------------------------------------------------------------------------- /datasets/nfts/nfts/enrich.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import sqlite3 3 | from typing import Any, cast, Iterator, List, Optional, Set 4 | import json 5 | 6 | from tqdm import tqdm 7 | import requests 8 | 9 | from .data import BlockBounds 10 | -------------------------------------------------------------------------------- /datasets/nfts/notebooks/.gitignore: -------------------------------------------------------------------------------- 1 | img/ 2 | -------------------------------------------------------------------------------- /datasets/nfts/papers/ethereum-nfts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/datasets/nfts/papers/ethereum-nfts.pdf -------------------------------------------------------------------------------- /datasets/nfts/sample.env: -------------------------------------------------------------------------------- 1 | export MOONSTREAM_DB_URI="" 2 | export MOONSTREAM_WEB3_PROVIDER="" 3 | -------------------------------------------------------------------------------- /engineapi/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /engineapi/README.md: -------------------------------------------------------------------------------- 1 | ## `client` 2 | 3 | This repository contains a lightweight Python client for the Engine API. 4 | 5 | To use, for example, with Leaderboard API: 6 | 7 | ```bash 8 | python -m client.leaderboards -h 9 | ``` 10 | -------------------------------------------------------------------------------- /engineapi/alembic.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | PYTHONPATH=".:$PYTHONPATH" alembic "$@" 4 | -------------------------------------------------------------------------------- /engineapi/alembic/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /engineapi/alembic/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | ${imports if imports else ""} 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = ${repr(up_revision)} 14 | down_revision = ${repr(down_revision)} 15 | branch_labels = ${repr(branch_labels)} 16 | depends_on = ${repr(depends_on)} 17 | 18 | 19 | def upgrade(): 20 | ${upgrades if upgrades else "pass"} 21 | 22 | 23 | def downgrade(): 24 | ${downgrades if downgrades else "pass"} 25 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/6d07739cb13e_live_at_for_metatx.py: -------------------------------------------------------------------------------- 1 | """Live at for metatx 2 | 3 | Revision ID: 6d07739cb13e 4 | Revises: 71e888082a6d 5 | Create Date: 2023-12-06 14:33:04.814144 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '6d07739cb13e' 14 | down_revision = '71e888082a6d' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('call_requests', sa.Column('live_at', sa.DateTime(timezone=True), nullable=True)) 22 | # ### end Alembic commands ### 23 | 24 | 25 | def downgrade(): 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column('call_requests', 'live_at') 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/7191eb70e99e_tx_hash_for_call_requests.py: -------------------------------------------------------------------------------- 1 | """Tx hash for call requests 2 | 3 | Revision ID: 7191eb70e99e 4 | Revises: 6d07739cb13e 5 | Create Date: 2023-10-04 11:23:12.516797 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '7191eb70e99e' 14 | down_revision = '6d07739cb13e' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('call_requests', sa.Column('tx_hash', sa.VARCHAR(length=256), nullable=True)) 22 | op.create_unique_constraint(op.f('uq_call_requests_tx_hash'), 'call_requests', ['tx_hash']) 23 | # ### end Alembic commands ### 24 | 25 | 26 | def downgrade(): 27 | # ### commands auto generated by Alembic - please adjust! ### 28 | op.drop_constraint(op.f('uq_call_requests_tx_hash'), 'call_requests', type_='unique') 29 | op.drop_column('call_requests', 'tx_hash') 30 | # ### end Alembic commands ### 31 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/782ac8fe23c8_add_resource_id_column.py: -------------------------------------------------------------------------------- 1 | """add resource_id column 2 | 3 | Revision ID: 782ac8fe23c8 4 | Revises: 815ae0983ef1 5 | Create Date: 2022-11-10 13:47:49.486491 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | from sqlalchemy.dialects import postgresql 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = "782ac8fe23c8" 14 | down_revision = "815ae0983ef1" 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column( 22 | "leaderboards", 23 | sa.Column("resource_id", postgresql.UUID(as_uuid=True), nullable=True), 24 | ) 25 | op.create_index( 26 | op.f("ix_leaderboards_resource_id"), 27 | "leaderboards", 28 | ["resource_id"], 29 | unique=False, 30 | ) 31 | # ### end Alembic commands ### 32 | 33 | 34 | def downgrade(): 35 | # ### commands auto generated by Alembic - please adjust! ### 36 | op.drop_index(op.f("ix_leaderboards_resource_id"), table_name="leaderboards") 37 | op.drop_column("leaderboards", "resource_id") 38 | # ### end Alembic commands ### 39 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/784c8ec69ca7_add_score_index.py: -------------------------------------------------------------------------------- 1 | """Add score index 2 | 3 | Revision ID: 784c8ec69ca7 4 | Revises: a9060d0527e3 5 | Create Date: 2024-06-12 18:34:40.978811 6 | 7 | """ 8 | 9 | from alembic import op 10 | import sqlalchemy as sa 11 | 12 | 13 | # revision identifiers, used by Alembic. 14 | revision = "784c8ec69ca7" 15 | down_revision = "a9060d0527e3" 16 | branch_labels = None 17 | depends_on = None 18 | 19 | 20 | def upgrade(): 21 | # ### commands auto generated by Alembic - please adjust! ### 22 | op.create_index( 23 | "ix_leaderboard_scores_leaderboard_id_version_score", 24 | "leaderboard_scores", 25 | ["leaderboard_id", "leaderboard_version_number", "score"], 26 | unique=False, 27 | ) 28 | # ### end Alembic commands ### 29 | 30 | 31 | def downgrade(): 32 | # ### commands auto generated by Alembic - please adjust! ### 33 | op.drop_index( 34 | "ix_leaderboard_scores_leaderboard_id_version_score", 35 | table_name="leaderboard_scores", 36 | ) 37 | # ### end Alembic commands ### 38 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/815ae0983ef1_add_raw_amount_column.py: -------------------------------------------------------------------------------- 1 | """Add raw_amount column 2 | 3 | Revision ID: 815ae0983ef1 4 | Revises: f0e8022dc814 5 | Create Date: 2022-06-08 12:39:35.846110 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | # revision identifiers, used by Alembic. 12 | revision = "815ae0983ef1" 13 | down_revision = "f0e8022dc814" 14 | branch_labels = None 15 | depends_on = None 16 | 17 | 18 | def upgrade(): 19 | # ### commands auto generated by Alembic - please adjust! ### 20 | op.add_column( 21 | "dropper_claimants", sa.Column("raw_amount", sa.String(), nullable=True) 22 | ) 23 | 24 | 25 | def downgrade(): 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | op.drop_column("dropper_claimants", "raw_amount") 28 | # ### end Alembic commands ### 29 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/a9060d0527e3_chain_id_is_big_int.py: -------------------------------------------------------------------------------- 1 | """Chain ID is big int 2 | 3 | Revision ID: a9060d0527e3 4 | Revises: 7191eb70e99e 5 | Create Date: 2024-06-03 07:32:28.111259 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'a9060d0527e3' 14 | down_revision = '7191eb70e99e' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.alter_column('blockchains', 'chain_id', 22 | existing_type=sa.INTEGER(), 23 | type_=sa.BigInteger(), 24 | existing_nullable=False) 25 | # ### end Alembic commands ### 26 | 27 | 28 | def downgrade(): 29 | # ### commands auto generated by Alembic - please adjust! ### 30 | op.alter_column('blockchains', 'chain_id', 31 | existing_type=sa.BigInteger(), 32 | type_=sa.INTEGER(), 33 | existing_nullable=False) 34 | # ### end Alembic commands ### 35 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/dedd8a7d0624_fix_unique_constract_on_registered_.py: -------------------------------------------------------------------------------- 1 | """Fix unique constract on registered_contracts to include moonstream_user_id 2 | 3 | Revision ID: dedd8a7d0624 4 | Revises: d1be5f227664 5 | Create Date: 2023-05-02 15:52:36.654980 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = "dedd8a7d0624" 14 | down_revision = "d1be5f227664" 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.drop_constraint( 22 | "uq_registered_contracts_blockchain", "registered_contracts", type_="unique" 23 | ) 24 | op.create_unique_constraint( 25 | op.f("uq_registered_contracts_blockchain"), 26 | "registered_contracts", 27 | ["blockchain", "moonstream_user_id", "address", "contract_type"], 28 | ) 29 | # ### end Alembic commands ### 30 | 31 | 32 | def downgrade(): 33 | # ### commands auto generated by Alembic - please adjust! ### 34 | op.drop_constraint( 35 | op.f("uq_registered_contracts_blockchain"), 36 | "registered_contracts", 37 | type_="unique", 38 | ) 39 | op.create_unique_constraint( 40 | "uq_registered_contracts_blockchain", 41 | "registered_contracts", 42 | ["blockchain", "address", "contract_type"], 43 | ) 44 | # ### end Alembic commands ### 45 | -------------------------------------------------------------------------------- /engineapi/alembic/versions/f0e8022dc814_added_column_for_signatures.py: -------------------------------------------------------------------------------- 1 | """Added column for signatures 2 | 3 | Revision ID: f0e8022dc814 4 | Revises: 6b45cfe1799c 5 | Create Date: 2022-05-24 14:19:19.022226 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = "f0e8022dc814" 14 | down_revision = "6b45cfe1799c" 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column( 22 | "dropper_claimants", sa.Column("signature", sa.String(), nullable=True) 23 | ) 24 | op.create_index( 25 | op.f("ix_dropper_claimants_signature"), 26 | "dropper_claimants", 27 | ["signature"], 28 | unique=False, 29 | ) 30 | # ### end Alembic commands ### 31 | 32 | 33 | def downgrade(): 34 | # ### commands auto generated by Alembic - please adjust! ### 35 | op.drop_index( 36 | op.f("ix_dropper_claimants_signature"), table_name="dropper_claimants" 37 | ) 38 | op.drop_column("dropper_claimants", "signature") 39 | # ### end Alembic commands ### 40 | -------------------------------------------------------------------------------- /engineapi/client/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/engineapi/client/__init__.py -------------------------------------------------------------------------------- /engineapi/client/sample-score.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "0x0000000000000000000000000000000000000000", 4 | "score": 19, 5 | "points_data": { 6 | "secondary_score_1": 7, 7 | "secondary_score_2": 29 8 | } 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /engineapi/deploy/engine-origins-sync.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Synchronize CORS origins for server 3 | After=network.target 4 | 5 | [Service] 6 | Type=oneshot 7 | ExecStart=/usr/bin/curl http://127.0.0.1:7191/configs/origins/sync 8 | CPUWeight=50 9 | SyslogIdentifier=engine-origins-sync 10 | -------------------------------------------------------------------------------- /engineapi/deploy/engine-origins-sync.timer: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Synchronize CORS origins for server 3 | 4 | [Timer] 5 | OnBootSec=120s 6 | OnUnitActiveSec=5m 7 | 8 | [Install] 9 | WantedBy=timers.target 10 | -------------------------------------------------------------------------------- /engineapi/deploy/engine.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Engine API service 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/api/engineapi 9 | EnvironmentFile=/home/ubuntu/engineapi-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/engineapi-env/bin/uvicorn --proxy-headers --forwarded-allow-ips='127.0.0.1' --host 127.0.0.1 --port 7191 --workers 8 engineapi.api:app 13 | SyslogIdentifier=engine 14 | 15 | [Install] 16 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /engineapi/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Expects access to Python environment with the requirements 4 | # for this project installed. 5 | set -e 6 | 7 | ENGINE_HOST="${ENGINE_HOST:-127.0.0.1}" 8 | ENGINE_PORT="${ENGINE_PORT:-7191}" 9 | ENGINE_WORKERS="${ENGINE_WORKERS:-1}" 10 | 11 | uvicorn --port "$ENGINE_PORT" --host "$ENGINE_HOST" --workers "$ENGINE_WORKERS" engineapi.api:app 12 | -------------------------------------------------------------------------------- /engineapi/engineapi/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include engineapi/version.txt -------------------------------------------------------------------------------- /engineapi/engineapi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/engineapi/engineapi/__init__.py -------------------------------------------------------------------------------- /engineapi/engineapi/contracts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/engineapi/engineapi/contracts/__init__.py -------------------------------------------------------------------------------- /engineapi/engineapi/rc.py: -------------------------------------------------------------------------------- 1 | from contextlib import asynccontextmanager 2 | 3 | from redis import ConnectionPool, Redis 4 | from redis import asyncio as aioredis 5 | 6 | from .settings import ENGINE_REDIS_PASSWORD, ENGINE_REDIS_URL 7 | 8 | REDIS_CONFIG_CORS_KEY = "configs:cors:engineapi" 9 | 10 | 11 | def create_redis_client() -> Redis: 12 | rc_pool = ConnectionPool.from_url( 13 | url=f"redis://:{ENGINE_REDIS_PASSWORD}@{ENGINE_REDIS_URL}", 14 | max_connections=10, 15 | decode_responses=True, 16 | socket_timeout=0.5, 17 | ) 18 | return Redis(connection_pool=rc_pool) 19 | 20 | 21 | rc_client = create_redis_client() 22 | 23 | 24 | def create_async_redis_client() -> Redis: 25 | rc_pool_async: ConnectionPool = aioredis.ConnectionPool.from_url( 26 | url=f"redis://:{ENGINE_REDIS_PASSWORD}@{ENGINE_REDIS_URL}", 27 | max_connections=10, 28 | decode_responses=True, 29 | socket_timeout=0.5, 30 | ) 31 | 32 | return aioredis.Redis(connection_pool=rc_pool_async) 33 | 34 | 35 | rc_client_async = create_async_redis_client() 36 | 37 | 38 | @asynccontextmanager 39 | async def yield_rc_async_session(): 40 | try: 41 | yield rc_client_async 42 | finally: 43 | await rc_client_async.close() 44 | -------------------------------------------------------------------------------- /engineapi/engineapi/routes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/engineapi/engineapi/routes/__init__.py -------------------------------------------------------------------------------- /engineapi/engineapi/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/engineapi/engineapi/scripts/__init__.py -------------------------------------------------------------------------------- /engineapi/engineapi/version.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | VERSION = "UNKNOWN" 4 | 5 | try: 6 | PATH = os.path.abspath(os.path.dirname(__file__)) 7 | VERSION_FILE = os.path.join(PATH, "version.txt") 8 | with open(VERSION_FILE) as ifp: 9 | VERSION = ifp.read().strip() 10 | except: 11 | pass 12 | -------------------------------------------------------------------------------- /engineapi/engineapi/version.txt: -------------------------------------------------------------------------------- 1 | 0.0.13 2 | -------------------------------------------------------------------------------- /engineapi/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | 3 | [mypy-eth_keys.*] 4 | ignore_missing_imports = True 5 | -------------------------------------------------------------------------------- /engineapi/requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.8.4 2 | aiosignal==1.3.1 3 | anyio==3.7.0 4 | async-timeout==4.0.2 5 | attrs==23.1.0 6 | base58==2.1.1 7 | bitarray==2.7.6 8 | boto3==1.27.0 9 | botocore==1.30.0 10 | bugout==0.2.17 11 | certifi==2023.5.7 12 | charset-normalizer==3.1.0 13 | click==8.1.3 14 | cytoolz==0.12.1 15 | dataclassy==0.11.1 16 | eip712==0.1.0 17 | eth-abi==2.2.0 18 | eth-account==0.5.9 19 | eth-hash==0.5.2 20 | eth-keyfile==0.5.1 21 | eth-keys==0.3.4 22 | eth-rlp==0.2.1 23 | eth-typing==2.3.0 24 | eth-utils==1.9.5 25 | exceptiongroup==1.1.2 26 | fastapi==0.99.1 27 | frozenlist==1.3.3 28 | greenlet==2.0.2 29 | h11==0.14.0 30 | hexbytes==0.2.3 31 | idna==3.4 32 | ipfshttpclient==0.8.0a2 33 | jmespath==1.0.1 34 | jsonschema==4.17.3 35 | lru-dict==1.2.0 36 | multiaddr==0.0.9 37 | multidict==6.0.4 38 | netaddr==0.8.0 39 | parsimonious==0.8.1 40 | protobuf==3.19.5 41 | psycopg2-binary==2.9.6 42 | pycryptodome==3.18.0 43 | pydantic==1.10.10 44 | pyrsistent==0.19.3 45 | python-dateutil==2.8.2 46 | python-multipart==0.0.6 47 | redis==4.6.0 48 | requests==2.31.0 49 | rlp==2.0.1 50 | s3transfer==0.6.1 51 | six==1.16.0 52 | sniffio==1.3.0 53 | SQLAlchemy==2.0.17 54 | starlette==0.27.0 55 | tabulate==0.9.0 56 | toolz==0.12.0 57 | tqdm==4.65.0 58 | typing_extensions==4.7.1 59 | urllib3==1.26.16 60 | uvicorn==0.22.0 61 | varint==1.0.2 62 | web3==5.31.4 63 | websockets==9.1 64 | yarl==1.9.2 65 | -------------------------------------------------------------------------------- /moonstreamapi/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /moonstreamapi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim-buster 2 | 3 | # Update packages and 4 | # prepare alembic for docker compose setup 5 | RUN apt-get update && \ 6 | apt-get install -y libpq-dev gcc curl && \ 7 | rm -rf /var/lib/apt/lists/* && \ 8 | pip3 install --no-cache-dir --upgrade pip setuptools && \ 9 | pip3 install --no-cache-dir psycopg2-binary alembic 10 | 11 | WORKDIR /usr/src/moonstreamapi 12 | 13 | COPY . /usr/src/moonstreamapi 14 | 15 | # Install Moonstream API package 16 | RUN pip3 install --no-cache-dir -e . 17 | 18 | EXPOSE 7481 19 | 20 | ENTRYPOINT ["./dev.sh"] -------------------------------------------------------------------------------- /moonstreamapi/configs/docker_wait.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | HOST="$1" 6 | shift 7 | 8 | until curl --request GET --url "http://$HOST/ping"; do 9 | >&2 echo "$HOST is unavailable, sleeping" 10 | sleep 1 11 | done 12 | 13 | >&2 echo "$HOST is up" 14 | -------------------------------------------------------------------------------- /moonstreamapi/deploy/moonstream.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=moonstreamapi-service 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/api/moonstreamapi 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/moonstream-env/bin/uvicorn --proxy-headers --forwarded-allow-ips='127.0.0.1' --host 127.0.0.1 --port 7481 --workers 8 moonstreamapi.api:app 13 | SyslogIdentifier=moonstream 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /moonstreamapi/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Sets up Moonstream API server 4 | # Expects access to Python environment with the requirements 5 | # for this project installed. 6 | set -e 7 | 8 | MOONSTREAMAPI_HOST="${MOONSTREAMAPI_HOST:-127.0.0.1}" 9 | MOONSTREAMAPI_PORT="${MOONSTREAMAPI_PORT:-7481}" 10 | MOONSTREAMAPI_APP_DIR="${MOONSTREAMAPI_APP_DIR:-$PWD}" 11 | MOONSTREAMAPI_ASGI_APP="${MOONSTREAMAPI_ASGI_APP:-moonstreamapi.api:app}" 12 | MOONSTREAMAPI_UVICORN_WORKERS="${MOONSTREAMAPI_UVICORN_WORKERS:-2}" 13 | 14 | uvicorn --reload \ 15 | --port "$MOONSTREAMAPI_PORT" \ 16 | --host "$MOONSTREAMAPI_HOST" \ 17 | --app-dir "$MOONSTREAMAPI_APP_DIR" \ 18 | --workers "$MOONSTREAMAPI_UVICORN_WORKERS" \ 19 | "$MOONSTREAMAPI_ASGI_APP" -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | from .reporter import reporter 3 | from .version import MOONSTREAMAPI_VERSION 4 | 5 | # Reporting 6 | reporter.tags.append(f"version:{MOONSTREAMAPI_VERSION}") 7 | reporter.system_report(publish=True) 8 | reporter.setup_excepthook(publish=True) 9 | except: 10 | # Pass it to be able import MOONSTREAMAPI_VERSION in setup.py with pip 11 | pass 12 | -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/admin/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Administrative utilities for operating a Moonstream API deployment. 3 | """ 4 | -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/admin/migrations/1_add_abi_backet_and_s3_path.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "20211108", 3 | "match": { 4 | "type": "subscription" 5 | }, 6 | "description": "Add abi to subscription as flag if subscription has abi of contract. Add bucket and s3_path for get abi from S3.", 7 | "upgrade": { 8 | "update": { 9 | "abi": null, 10 | "bucket": null, 11 | "s3_path": null, 12 | "resources_version": 1 13 | }, 14 | "drop_keys": [] 15 | }, 16 | "downgrade": { 17 | "update": {}, 18 | "drop_keys": [ 19 | "abi", 20 | "bucket", 21 | "s3_path", 22 | "resources_version" 23 | ] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/admin/migrations/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamapi/moonstreamapi/admin/migrations/__init__.py -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamapi/moonstreamapi/py.typed -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/reporter.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | 3 | from humbug.consent import HumbugConsent 4 | from humbug.report import HumbugReporter 5 | 6 | from .settings import HUMBUG_REPORTER_BACKEND_TOKEN 7 | 8 | session_id = str(uuid.uuid4()) 9 | client_id = "moonstream-backend" 10 | 11 | reporter = HumbugReporter( 12 | name="moonstreamapi", 13 | consent=HumbugConsent(True), 14 | client_id=client_id, 15 | session_id=session_id, 16 | bugout_token=HUMBUG_REPORTER_BACKEND_TOKEN, 17 | tags=[], 18 | ) 19 | -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/routes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamapi/moonstreamapi/routes/__init__.py -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/text_actions.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from . import actions 4 | 5 | 6 | class TestActions(unittest.TestCase): 7 | def test_name_normalization(self): 8 | names = [ 9 | ["test", "test"], 10 | ["test_Name", "test_Name"], 11 | ["%20UNION", "20UNION"], 12 | ["UNION ALL", "UNION_ALL"], 13 | ["$_REQUEST", "REQUEST"], 14 | ["id=1", "id_1"], 15 | ["Lo" * 30, "Lo" * 25], 16 | ] 17 | for name in names: 18 | query_name = actions.name_normalization(name[0]) 19 | self.assertEqual(query_name, name[1]) 20 | -------------------------------------------------------------------------------- /moonstreamapi/moonstreamapi/version.py: -------------------------------------------------------------------------------- 1 | """ 2 | Moonstream library and API version. 3 | """ 4 | 5 | MOONSTREAMAPI_VERSION = "0.4.12" 6 | -------------------------------------------------------------------------------- /moonstreamapi/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | 3 | [mypy-sqlalchemy.*] 4 | ignore_missing_imports = True 5 | 6 | [mypy-moonstreamdb.*] 7 | ignore_missing_imports = True 8 | 9 | [mypy-pyevmasm.*] 10 | ignore_missing_imports = True 11 | 12 | [mypy-requests.*] 13 | ignore_missing_imports = True 14 | 15 | [mypy-dateutil.*] 16 | ignore_missing_imports = True 17 | -------------------------------------------------------------------------------- /moonstreamdb-v3/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /moonstreamdb-v3/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include moonstreamdbv3/version.txt -------------------------------------------------------------------------------- /moonstreamdb-v3/README.md: -------------------------------------------------------------------------------- 1 | # moonstreamdb-v3 2 | -------------------------------------------------------------------------------- /moonstreamdb-v3/alembic.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | PYTHONPATH=".:$PYTHONPATH" alembic "$@" 4 | -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb-v3/moonstreamdbv3/__init__.py -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb-v3/moonstreamdbv3/alembic/__init__.py -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from typing import Sequence, Union 9 | 10 | from alembic import op 11 | import sqlalchemy as sa 12 | ${imports if imports else ""} 13 | 14 | # revision identifiers, used by Alembic. 15 | revision: str = ${repr(up_revision)} 16 | down_revision: Union[str, None] = ${repr(down_revision)} 17 | branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)} 18 | depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} 19 | 20 | 21 | def upgrade() -> None: 22 | ${upgrades if upgrades else "pass"} 23 | 24 | 25 | def downgrade() -> None: 26 | ${downgrades if downgrades else "pass"} 27 | -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic/versions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb-v3/moonstreamdbv3/alembic/versions/__init__.py -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic_indexes/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic_indexes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/__init__.py -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic_indexes/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from typing import Sequence, Union 9 | 10 | from alembic import op 11 | import sqlalchemy as sa 12 | ${imports if imports else ""} 13 | 14 | # revision identifiers, used by Alembic. 15 | revision: str = ${repr(up_revision)} 16 | down_revision: Union[str, None] = ${repr(down_revision)} 17 | branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)} 18 | depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} 19 | 20 | 21 | def upgrade() -> None: 22 | ${upgrades if upgrades else "pass"} 23 | 24 | 25 | def downgrade() -> None: 26 | ${downgrades if downgrades else "pass"} 27 | -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/6807bdf6f417_add_deploy_block.py: -------------------------------------------------------------------------------- 1 | """Add deploy block 2 | 3 | Revision ID: 6807bdf6f417 4 | Revises: 48d2562504d1 5 | Create Date: 2024-08-23 16:51:47.147758 6 | 7 | """ 8 | 9 | from typing import Sequence, Union 10 | 11 | from alembic import op 12 | import sqlalchemy as sa 13 | 14 | 15 | # revision identifiers, used by Alembic. 16 | revision: str = "6807bdf6f417" 17 | down_revision: Union[str, None] = "25b339f55f8f" 18 | branch_labels: Union[str, Sequence[str], None] = None 19 | depends_on: Union[str, Sequence[str], None] = None 20 | 21 | 22 | def upgrade() -> None: 23 | # ### commands auto generated by Alembic - please adjust! ### 24 | op.add_column( 25 | "abi_jobs", 26 | sa.Column("deployment_block_number", sa.BigInteger(), nullable=True), 27 | ) 28 | # ### end Alembic commands ### 29 | 30 | 31 | def downgrade() -> None: 32 | # ### commands auto generated by Alembic - please adjust! ### 33 | op.drop_column("abi_jobs", "deployment_block_number") 34 | # ### end Alembic commands ### 35 | -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb-v3/moonstreamdbv3/alembic_indexes/versions/__init__.py -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/version.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | VERSION = "UNKNOWN" 4 | 5 | try: 6 | PATH = os.path.abspath(os.path.dirname(__file__)) 7 | VERSION_FILE = os.path.join(PATH, "version.txt") 8 | with open(VERSION_FILE) as ifp: 9 | VERSION = ifp.read().strip() 10 | except: 11 | pass 12 | -------------------------------------------------------------------------------- /moonstreamdb-v3/moonstreamdbv3/version.txt: -------------------------------------------------------------------------------- 1 | 0.1.6 2 | -------------------------------------------------------------------------------- /moonstreamdb-v3/scm/pkg/blockchain-S0K5PY7LHKC4TFXZ/default.nix: -------------------------------------------------------------------------------- 1 | stdargs @ { scm, ... }: 2 | 3 | scm.schema { 4 | guid = "S0K5PY7LHKC4TFXZ"; 5 | name = "blockchain"; 6 | upgrade_sql = ./upgrade.sql; 7 | dependencies = [ 8 | 9 | ]; 10 | } -------------------------------------------------------------------------------- /moonstreamdb-v3/scm/pkg/blockchain-S0K5PY7LHKC4TFXZ/upgrade.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb-v3/scm/pkg/blockchain-S0K5PY7LHKC4TFXZ/upgrade.sql -------------------------------------------------------------------------------- /moonstreamdb-v3/scm/scm.nix: -------------------------------------------------------------------------------- 1 | with builtins; 2 | let 3 | scm_repos = [ 4 | (getEnv "SCM_GIT") 5 | (fetchGit { 6 | url = "git@gitlab.com:deltaex/schematic.git"; 7 | rev = "ba5d7b40255e5da9a74e666dd88e309dae40fbd2"; 8 | }) 9 | ]; 10 | scm_repo = head (filter (x: x != "") scm_repos); 11 | scm = (import scm_repo { 12 | verbose = true; 13 | repos = [ 14 | "." 15 | (getEnv "MDP_GIT") 16 | (fetchGit { 17 | url = "git@github.com:moonstream-to/api.git"; 18 | rev = "e27476ac5327d5494d2db16bb9bf781f9fc14e41"; 19 | }) 20 | ] ++ scm_repos; 21 | }); 22 | in rec { 23 | schematic = scm.shell.overrideAttrs ( oldAttrs : { 24 | shellHook = oldAttrs.shellHook + '' 25 | [ -n "$ENV" -a "$ENV" != "dev" ] 26 | source /home/moonstream/moonstream-db-v3-indexes-secrets/pg.env 27 | ''; 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /moonstreamdb/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /moonstreamdb/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8-slim-buster 2 | 3 | # Update packages and 4 | # prepare alembic for docker compose setup 5 | RUN apt-get update && \ 6 | apt-get install -y libpq-dev gcc && \ 7 | rm -rf /var/lib/apt/lists/* && \ 8 | pip3 install --no-cache-dir --upgrade pip setuptools && \ 9 | pip3 install --no-cache-dir psycopg2-binary alembic 10 | 11 | WORKDIR /usr/src/moonstreamdb 12 | 13 | COPY . /usr/src/moonstreamdb 14 | 15 | # Install Moonstream DB package 16 | RUN pip3 install --no-cache-dir -e . 17 | 18 | ENTRYPOINT ["./migrate.sh"] -------------------------------------------------------------------------------- /moonstreamdb/README.md: -------------------------------------------------------------------------------- 1 | # moonstream db 2 | 3 | ### Setting up moonstreamdb 4 | 5 | Copy `sample.env` to a new file and set the environment variables to appropriate values. This new file 6 | should be sourced every time you want to access the database with the `moonstreamdb` application or any 7 | dependents. 8 | 9 | To be able to run migrations, copy [`alembic.sample.ini`](./alembic.sample.ini) to a separate file 10 | (e.g. `./secrets/alembic.dev.ini`) and modify the `sqlalchemy.url` setting in the new file to point 11 | at your database. 12 | 13 | Make sure your database is at the latest alembic migration: 14 | 15 | ```bash 16 | alembic -c ./secrets/alembic.dev.ini upgrade head 17 | ``` 18 | 19 | ### Adding a new table to database 20 | 21 | Add SQLAlchemy model in [`moonstreamdb/models.py`](./moonstreamdb/models.py) 22 | 23 | Import new model and add tablename to whitelist in [`alembic/env.py`](.alembic/env.py) 24 | 25 | Create a migration: 26 | 27 | ```bash 28 | alembic -c revision -m "" --autogenerate 29 | ``` 30 | 31 | Always check the autogenerated file to make sure that it isn't performing any actions that you don't want it to. 32 | A good policy is to delete any operations that don't touch the tables that you created. 33 | 34 | Then run the migration: 35 | 36 | ```bash 37 | alembic -c upgrade head 38 | ``` 39 | -------------------------------------------------------------------------------- /moonstreamdb/alembic.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | PYTHONPATH=".:$PYTHONPATH" alembic "$@" 4 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /moonstreamdb/alembic/script.py.mako: -------------------------------------------------------------------------------- 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | ${imports if imports else ""} 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = ${repr(up_revision)} 14 | down_revision = ${repr(down_revision)} 15 | branch_labels = ${repr(branch_labels)} 16 | depends_on = ${repr(depends_on)} 17 | 18 | 19 | def upgrade(): 20 | ${upgrades if upgrades else "pass"} 21 | 22 | 23 | def downgrade(): 24 | ${downgrades if downgrades else "pass"} 25 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/versions/0b46c8e17bf2_fields_for_eip_1559.py: -------------------------------------------------------------------------------- 1 | """fields-for-eip-1559 2 | 3 | Revision ID: 0b46c8e17bf2 4 | Revises: 240476c67b9f 5 | Create Date: 2021-10-26 09:52:17.367528 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | from sqlalchemy.dialects import postgresql 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '0b46c8e17bf2' 14 | down_revision = '240476c67b9f' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.add_column('ethereum_blocks', sa.Column('base_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True)) 22 | op.add_column('ethereum_transactions', sa.Column('max_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True)) 23 | op.add_column('ethereum_transactions', sa.Column('max_priority_fee_per_gas', sa.Numeric(precision=78, scale=0), nullable=True)) 24 | op.add_column('ethereum_transactions', sa.Column('transaction_type', sa.Integer(), nullable=True)) 25 | # ### end Alembic commands ### 26 | 27 | 28 | def downgrade(): 29 | # ### commands auto generated by Alembic - please adjust! ### 30 | op.drop_column('ethereum_transactions', 'transaction_type') 31 | op.drop_column('ethereum_transactions', 'max_priority_fee_per_gas') 32 | op.drop_column('ethereum_transactions', 'max_fee_per_gas') 33 | op.drop_column('ethereum_blocks', 'base_fee_per_gas') 34 | # ### end Alembic commands ### 35 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/versions/295ce155c811_fix_avalanche.py: -------------------------------------------------------------------------------- 1 | """Fix avalanche 2 | 3 | Revision ID: 295ce155c811 4 | Revises: 26000a6bff7d 5 | Create Date: 2024-04-01 09:20:46.381074 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = '295ce155c811' 14 | down_revision = '26000a6bff7d' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.drop_column('avalanche_blocks', 'block_extra_data') 22 | op.drop_column('avalanche_fuji_blocks', 'block_extra_data') 23 | op.add_column('avalanche_blocks', sa.Column('block_extra_data', sa.Text(), nullable=True)) 24 | op.add_column('avalanche_fuji_blocks', sa.Column('block_extra_data', sa.Text(), nullable=True)) 25 | # ### end Alembic commands ### 26 | 27 | 28 | def downgrade(): 29 | # ### commands auto generated by Alembic - please adjust! ### 30 | op.drop_column('avalanche_blocks', 'block_extra_data') 31 | op.drop_column('avalanche_fuji_blocks', 'block_extra_data') 32 | op.add_column('avalanche_blocks', sa.Column('block_extra_data', sa.VARCHAR(length=256), nullable=True)) 33 | op.add_column('avalanche_fuji_blocks', sa.Column('block_extra_data', sa.VARCHAR(length=256), nullable=True)) 34 | # ### end Alembic commands ### 35 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/versions/5f5b8f19570f_added_index_for_address_type_and_name_.py: -------------------------------------------------------------------------------- 1 | """Added index for address type and name of event 2 | 3 | Revision ID: 5f5b8f19570f 4 | Revises: f991fc7493c8 5 | Create Date: 2022-05-04 11:32:42.309322 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = "5f5b8f19570f" 14 | down_revision = "f991fc7493c8" 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | op.execute( 21 | """ 22 | CREATE INDEX ix_polygon_labels_address_label_label_data_type_and_name ON polygon_labels USING BTREE (address,label,(label_data->>'type'),(label_data->>'name')); 23 | """ 24 | ) 25 | 26 | 27 | def downgrade(): 28 | op.execute( 29 | """ 30 | DROP INDEX ix_polygon_labels_address_label_label_data_type_and_name; 31 | """ 32 | ) 33 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/versions/6f7c8d64d49a_zksync_address_label_data_name_index.py: -------------------------------------------------------------------------------- 1 | """zksync address label_data name index 2 | 3 | Revision ID: 6f7c8d64d49a 4 | Revises: a1d9fab5f904 5 | Create Date: 2024-04-29 15:26:43.880238 6 | 7 | """ 8 | 9 | from alembic import op 10 | import sqlalchemy as sa 11 | 12 | 13 | # revision identifiers, used by Alembic. 14 | revision = "6f7c8d64d49a" 15 | down_revision = "a1d9fab5f904" 16 | branch_labels = None 17 | depends_on = None 18 | 19 | 20 | def upgrade(): 21 | # ### commands auto generated by Alembic - please adjust! ### 22 | op.create_index( 23 | "ix_zksync_era_labels_address_label_data_name", 24 | "zksync_era_labels", 25 | ["address", sa.text("(label_data ->> 'name')")], 26 | unique=False, 27 | postgresql_using="btree", 28 | ) 29 | # ### end Alembic commands ### 30 | 31 | 32 | def downgrade(): 33 | # ### commands auto generated by Alembic - please adjust! ### 34 | op.drop_index( 35 | "ix_zksync_era_labels_address_label_data_name", 36 | table_name="zksync_era_labels", 37 | postgresql_using="btree", 38 | ) 39 | # ### end Alembic commands ### 40 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/versions/d6ed4b1b43d5_drop_foreign_key_constraint_on_tx_hash_.py: -------------------------------------------------------------------------------- 1 | """Drop foreign key constraint on tx hash on ethereum_labels table 2 | 3 | Revision ID: d6ed4b1b43d5 4 | Revises: 72f1ad512b2e 5 | Create Date: 2021-09-23 21:02:46.577682 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = "d6ed4b1b43d5" 14 | down_revision = "72f1ad512b2e" 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.drop_constraint( 22 | "fk_ethereum_labels_transaction_hash_ethereum_transactions", 23 | "ethereum_labels", 24 | type_="foreignkey", 25 | ) 26 | # ### end Alembic commands ### 27 | 28 | 29 | def downgrade(): 30 | # ### commands auto generated by Alembic - please adjust! ### 31 | op.create_foreign_key( 32 | "fk_ethereum_labels_transaction_hash_ethereum_transactions", 33 | "ethereum_labels", 34 | "ethereum_transactions", 35 | ["transaction_hash"], 36 | ["hash"], 37 | ondelete="CASCADE", 38 | ) 39 | # ### end Alembic commands ### 40 | -------------------------------------------------------------------------------- /moonstreamdb/alembic/versions/ea8185bd24c7_unique_const_for_addr.py: -------------------------------------------------------------------------------- 1 | """Unique const for addr 2 | 3 | Revision ID: ea8185bd24c7 4 | Revises: 40871a7807f6 5 | Create Date: 2021-08-18 09:41:00.512462 6 | 7 | """ 8 | from alembic import op 9 | import sqlalchemy as sa 10 | 11 | 12 | # revision identifiers, used by Alembic. 13 | revision = 'ea8185bd24c7' 14 | down_revision = '40871a7807f6' 15 | branch_labels = None 16 | depends_on = None 17 | 18 | 19 | def upgrade(): 20 | # ### commands auto generated by Alembic - please adjust! ### 21 | op.drop_index('ix_ethereum_addresses_address', table_name='ethereum_addresses') 22 | op.create_index(op.f('ix_ethereum_addresses_address'), 'ethereum_addresses', ['address'], unique=True) 23 | op.create_unique_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', ['id']) 24 | # ### end Alembic commands ### 25 | 26 | 27 | def downgrade(): 28 | # ### commands auto generated by Alembic - please adjust! ### 29 | op.drop_constraint(op.f('uq_ethereum_labels_id'), 'ethereum_labels', type_='unique') 30 | op.drop_index(op.f('ix_ethereum_addresses_address'), table_name='ethereum_addresses') 31 | op.create_index('ix_ethereum_addresses_address', 'ethereum_addresses', ['address'], unique=False) 32 | # ### end Alembic commands ### 33 | -------------------------------------------------------------------------------- /moonstreamdb/configs/sample.env: -------------------------------------------------------------------------------- 1 | # Required environment variables to work with database CLI 2 | export MOONSTREAM_DB_URI="postgresql://:@:/" 3 | export MOONSTREAM_DB_URI_READ_ONLY="postgresql://:@:/" 4 | export MOONSTREAM_POOL_SIZE=0 5 | -------------------------------------------------------------------------------- /moonstreamdb/deploy/moonstreamdb.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Moonstream DB status service 3 | After=network.target 4 | 5 | [Service] 6 | User=ubuntu 7 | Group=www-data 8 | WorkingDirectory=/home/ubuntu/moonstream/moonstreamdb/server 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | ExecStart=/home/ubuntu/moonstream/moonstreamdb/server/moonstreamdb -host 127.0.0.1 -port "${MOONSTREAM_DB_SERVER_PORT}" 11 | SyslogIdentifier=moonstreamdb 12 | 13 | [Install] 14 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /moonstreamdb/migrate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Sets up Brood server for docker compose: 4 | # 1. Running alembic migrations to head (using config file specified 5 | # by the ALEMBIC_CONFIG environment variable) 6 | # 2. Running dev.sh (from the directory from which this script was called) 7 | 8 | set -e 9 | 10 | if [ -z "$ALEMBIC_CONFIG" ] 11 | then 12 | echo "Please explicitly set the ALEMBIC_CONFIG environment variable to point to an alembic configuration file" 13 | exit 1 14 | fi 15 | 16 | ALEMBIC_CONFIG="$ALEMBIC_CONFIG" sh alembic.sh upgrade head 17 | -------------------------------------------------------------------------------- /moonstreamdb/moonstreamdb/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/moonstreamdb/moonstreamdb/__init__.py -------------------------------------------------------------------------------- /moonstreamdb/moonstreamdb/version.py: -------------------------------------------------------------------------------- 1 | """ 2 | Moonstream database version. 3 | """ 4 | 5 | MOONSTREAMDB_VERSION = "0.4.6" 6 | -------------------------------------------------------------------------------- /moonstreamdb/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | 3 | [mypy-sqlalchemy.*] 4 | ignore_missing_imports = True 5 | 6 | [mypy-moonstreamdb.*] 7 | ignore_missing_imports = True 8 | 9 | [mypy-pyevmasm.*] 10 | ignore_missing_imports = True 11 | -------------------------------------------------------------------------------- /moonstreamdb/scm.nix: -------------------------------------------------------------------------------- 1 | with builtins; 2 | let 3 | scm_repos = [ 4 | (getEnv "SCM_GIT") 5 | (fetchGit { 6 | url = "git@gitlab.com:deltaex/schematic.git"; 7 | rev = "ba5d7b40255e5da9a74e666dd88e309dae40fbd2"; 8 | }) 9 | ]; 10 | scm_repo = head (filter (x: x != "") scm_repos); 11 | scm = (import scm_repo { 12 | verbose = true; 13 | repos = [ 14 | "." 15 | (getEnv "MDP_GIT") 16 | (fetchGit { 17 | url = "git@scm.mixrank.com:mixrank/mdp.git"; 18 | rev = "309e04f3f646847af3b7c084b01cfd72e1db92c8"; 19 | }) 20 | ] ++ scm_repos; 21 | }); 22 | in rec { 23 | schematic = scm.shell.overrideAttrs ( oldAttrs : { 24 | shellHook = oldAttrs.shellHook + '' 25 | [ -n "$ENV" -a "$ENV" != "dev" ] && export BUGSNAG=2b987ca13cd93a4931bb746aace204fb 26 | source /home/moonstream/moonstream-secrets/pg.env 27 | ''; 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /moonstreamdb/server/cmd/data.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | type PingResponse struct { 4 | Status string `json:"status"` 5 | } 6 | 7 | type BlockLatestResponse struct { 8 | EthereumBlockLatest uint64 `json:"ethereum_block_latest"` 9 | PolygonBlockLatest uint64 `json:"polygon_block_latest"` 10 | PolygonBlockLatestLabelsMoonwormAlpha uint64 `json:"polygon_block_latest_label_moonworm_alpha"` 11 | } 12 | -------------------------------------------------------------------------------- /moonstreamdb/server/cmd/db.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "database/sql" 5 | "log" 6 | 7 | _ "github.com/lib/pq" 8 | 9 | settings "github.com/bugout-dev/moonstream/db/server/configs" 10 | ) 11 | 12 | func InitDB() *sql.DB { 13 | db, err := sql.Open("postgres", settings.MOONSTREAM_DB_URI_READ_ONLY) 14 | if err != nil { 15 | // DSN parse error or another initialization error 16 | log.Fatal(err) 17 | } 18 | 19 | // Set the maximum number of concurrently idle connections, 20 | // by default sql.DB allows a maximum of 2 idle connections. 21 | db.SetMaxIdleConns(settings.MOONSTREAM_DB_MAX_IDLE_CONNS) 22 | 23 | // Set the maximum lifetime of a connection. 24 | // Longer lifetime increase memory usage. 25 | db.SetConnMaxLifetime(settings.MOONSTREAM_DB_CONN_MAX_LIFETIME) 26 | 27 | return db 28 | } 29 | -------------------------------------------------------------------------------- /moonstreamdb/server/cmd/server.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "database/sql" 5 | "flag" 6 | "log" 7 | "net/http" 8 | "time" 9 | ) 10 | 11 | type extendedServer struct { 12 | db *sql.DB 13 | } 14 | 15 | func InitServer() { 16 | var listeningAddr string 17 | var listeningPort string 18 | flag.StringVar(&listeningAddr, "host", "127.0.0.1", "Server listening address") 19 | flag.StringVar(&listeningPort, "port", "8080", "Server listening port") 20 | flag.Parse() 21 | 22 | db := InitDB() 23 | defer db.Close() 24 | 25 | es := extendedServer{db: db} 26 | 27 | serverMux := http.NewServeMux() 28 | serverMux.HandleFunc("/ping", pingRoute) 29 | serverMux.HandleFunc("/block/latest", es.blocksLatestRoute) 30 | 31 | // Set middlewares from bottom to top 32 | serverHandler := corsMiddleware(serverMux) 33 | serverHandler = logsMiddleware(serverHandler) 34 | serverHandler = panicMiddleware(serverHandler) 35 | 36 | server := http.Server{ 37 | Addr: listeningAddr + ":" + listeningPort, 38 | Handler: serverHandler, 39 | ReadTimeout: 10 * time.Second, 40 | WriteTimeout: 10 * time.Second, 41 | } 42 | 43 | log.Printf("Starting server at %s:%s\n", listeningAddr, listeningPort) 44 | server.ListenAndServe() 45 | } 46 | -------------------------------------------------------------------------------- /moonstreamdb/server/configs/settings.go: -------------------------------------------------------------------------------- 1 | package settings 2 | 3 | import ( 4 | "os" 5 | "time" 6 | ) 7 | 8 | // Database configs 9 | var MOONSTREAM_DB_MAX_IDLE_CONNS int = 30 10 | var MOONSTREAM_DB_CONN_MAX_LIFETIME = 30 * time.Minute 11 | var MOONSTREAM_DB_URI_READ_ONLY = os.Getenv("MOONSTREAM_DB_URI_READ_ONLY") 12 | 13 | // CORS 14 | var MOONSTREAM_CORS_ALLOWED_ORIGINS = os.Getenv("MOONSTREAM_CORS_ALLOWED_ORIGINS") 15 | -------------------------------------------------------------------------------- /moonstreamdb/server/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Compile application and run with provided arguments 4 | set -e 5 | 6 | PROGRAM_NAME="moonstreamdb" 7 | 8 | go build -o "$PROGRAM_NAME" . 9 | 10 | ./"$PROGRAM_NAME" "$@" 11 | -------------------------------------------------------------------------------- /moonstreamdb/server/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bugout-dev/moonstream/db/server 2 | 3 | go 1.17 4 | 5 | require github.com/lib/pq v1.10.2 6 | -------------------------------------------------------------------------------- /moonstreamdb/server/go.sum: -------------------------------------------------------------------------------- 1 | github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= 2 | github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= 3 | -------------------------------------------------------------------------------- /moonstreamdb/server/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/bugout-dev/moonstream/db/server/cmd" 5 | ) 6 | 7 | func main() { 8 | cmd.InitServer() 9 | } 10 | -------------------------------------------------------------------------------- /moonstreamdb/server/sample.env: -------------------------------------------------------------------------------- 1 | export MOONSTREAM_DB_URI_READ_ONLY="postgresql://:@:/" 2 | export MOONSTREAM_CORS_ALLOWED_ORIGINS="http://localhost:3000,https://moonstream.to,https://www.moonstream.to,https://alpha.moonstream.to" 3 | -------------------------------------------------------------------------------- /moonstreamdb/sync_conf.yml: -------------------------------------------------------------------------------- 1 | - namespace: public 2 | tablename: alembic_exploration_version 3 | included: false 4 | - namespace: public 5 | tablename: esd_event_signatures 6 | - namespace: public 7 | tablename: esd_function_signatures 8 | - namespace: public 9 | tablename: ethereum_blocks 10 | - namespace: public 11 | tablename: ethereum_labels 12 | - namespace: public 13 | tablename: ethereum_labels_v1 14 | included: false 15 | - namespace: public 16 | tablename: ethereum_transactions 17 | - namespace: public 18 | tablename: opensea_crawler_state 19 | - namespace: public 20 | tablename: polygon_blocks 21 | - namespace: public 22 | tablename: polygon_labels 23 | - namespace: public 24 | tablename: polygon_transactions 25 | - namespace: public 26 | tablename: xdai_blocks 27 | - namespace: public 28 | tablename: xdai_transactions 29 | - namespace: public 30 | tablename: xdai_labels 31 | 32 | -------------------------------------------------------------------------------- /nodebalancer/cmd/nodebalancer/access_cache_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "testing" 5 | "time" 6 | ) 7 | 8 | func accessCacheSetupSuit(t *testing.T) func(t *testing.T) { 9 | t.Log("Setup suit") 10 | 11 | CreateAccessCache() 12 | 13 | return func(t *testing.T) { 14 | t.Log("Teardown suit") 15 | } 16 | } 17 | 18 | func TestAddAccessToCache(t *testing.T) { 19 | teardownSuit := accessCacheSetupSuit(t) 20 | defer teardownSuit(t) 21 | 22 | tsNow := time.Now().Unix() 23 | 24 | var cases = []struct { 25 | prop ClientAccess 26 | expected bool 27 | }{ 28 | { 29 | prop: ClientAccess{ClientResourceData: ClientResourceData{AccessID: "7378e2b2-b6ac-4738-bf34-fe39aa0d19e9"}}, 30 | expected: true, 31 | }, 32 | { 33 | prop: ClientAccess{ClientResourceData: ClientResourceData{AccessID: "000000000000000000000000000000000000"}}, 34 | expected: false, 35 | }, 36 | { 37 | prop: ClientAccess{ClientResourceData: ClientResourceData{Name: "name-1"}}, 38 | expected: false, 39 | }, 40 | } 41 | for _, c := range cases { 42 | accessId := c.prop.ClientResourceData.AccessID 43 | accessCache.AddAccessToCache(c.prop, tsNow) 44 | if accessCache.isAccessIdInCache(accessId) != c.expected { 45 | t.Logf("Access %s not found in access cache", accessId) 46 | t.Fatal() 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /nodebalancer/cmd/nodebalancer/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "os" 6 | ) 7 | 8 | func main() { 9 | app := NodebalancerAppCli() 10 | if err := app.Run(os.Args); err != nil { 11 | log.Fatal(err) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /nodebalancer/cmd/nodebalancer/version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var NB_VERSION = "0.2.9" 4 | -------------------------------------------------------------------------------- /nodebalancer/configs/config.sample.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "blockchain": "ethereum", 4 | "endpoint": "https://mainnet.infura.io", 5 | "tags": [ 6 | "external", 7 | "sample" 8 | ] 9 | }, 10 | { 11 | "blockchain": "polygon", 12 | "endpoint": "https://polygon-mainnet.infura.io", 13 | "tags": [ 14 | "external", 15 | "sample" 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /nodebalancer/configs/contractsConfig.sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "ethereum": { 3 | "multicall3": "0xcA11bde05977b3631167028862bE2a173976CA11", 4 | "native_token": "ETH", 5 | "tokens": { 6 | "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 7 | "DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F", 8 | "USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", 9 | "USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7" 10 | } 11 | }, 12 | "polygon": { 13 | "multicall3": "0xcA11bde05977b3631167028862bE2a173976CA11", 14 | "native_token": "MATIC", 15 | "tokens": { 16 | "WMATIC": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", 17 | "USDC": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", 18 | "DAI": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", 19 | "WETH": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", 20 | "USDT": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /nodebalancer/deploy/nodebalancer.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Load balancer for blockchain nodes 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/api/nodebalancer 9 | EnvironmentFile=/home/ubuntu/nodebalancer-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/api/nodebalancer/nodebalancer server \ 13 | --host "${AWS_LOCAL_IPV4}" \ 14 | --port 8544 \ 15 | --healthcheck \ 16 | --config /home/ubuntu/.nodebalancer/config.json \ 17 | --contracts-config /home/ubuntu/nodebalancer-secrets/contractsConfig.json 18 | SyslogIdentifier=nodebalancer 19 | 20 | [Install] 21 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /nodebalancer/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Compile application and run with provided arguments 4 | set -e 5 | 6 | PROGRAM_NAME="nodebalancer" 7 | 8 | go build -o "$PROGRAM_NAME" cmd/nodebalancer/*.go 9 | 10 | ./"$PROGRAM_NAME" "$@" 11 | -------------------------------------------------------------------------------- /nodebalancer/migrations/requirements.txt: -------------------------------------------------------------------------------- 1 | black==23.3.0 2 | bugout==0.2.7 3 | certifi==2023.5.7 4 | charset-normalizer==3.1.0 5 | click==8.1.3 6 | idna==3.4 7 | isort==5.12.0 8 | mypy==1.3.0 9 | mypy-extensions==1.0.0 10 | packaging==23.1 11 | pathspec==0.11.1 12 | pkg_resources==0.0.0 13 | platformdirs==3.5.1 14 | pydantic==1.10.7 15 | requests==2.30.0 16 | tomli==2.0.1 17 | typing_extensions==4.5.0 18 | urllib3==2.0.2 19 | -------------------------------------------------------------------------------- /nodebalancer/sample.env: -------------------------------------------------------------------------------- 1 | # Required environment variables for load balancer 2 | export BUGOUT_BROOD_URL="https://auth.bugout.dev" 3 | export NB_BUGOUT_TIMEOUT_SECONDS=15 4 | export MOONSTREAM_APPLICATION_ID="" 5 | export MOONSTREAM_CORS_ALLOWED_ORIGINS="http://localhost:3000,https://moonstream.to,https://portal.moonstream.to" 6 | export NB_CONTROLLER_USER_ID="" 7 | export NB_CONTROLLER_TOKEN="" 8 | export NB_CONTROLLER_ACCESS_ID="" 9 | export NB_CACHE_CLEANING_INTERVAL=10 10 | export NB_CACHE_ACCESS_ID_LIFETIME=120 11 | export NB_CACHE_ACCESS_ID_SESSION_LIFETIME=900 12 | 13 | # Error humbug reporter 14 | export HUMBUG_REPORTER_NODE_BALANCER_TOKEN="" 15 | -------------------------------------------------------------------------------- /nodes/deploy/ethereum/geth.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum node Geth client 3 | StartLimitIntervalSec=500 4 | StartLimitBurst=5 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=10s 10 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 11 | ExecStart=/usr/bin/geth --syncmode snap --cache 4096 --datadir /mnt/disks/nodes/ethereum --txpool.globalslots 153600 --txpool.globalqueue 3072 --http --http.api eth,web3,txpool --http.addr "${AWS_LOCAL_IPV4}" --http.port 8545 --http.vhosts "*" --authrpc.jwtsecret /home/ubuntu/moonstream-secrets/jwt.hex 12 | Type=simple 13 | User=ubuntu 14 | ExecStop=/bin/kill -s SIGINT -$MAINPID 15 | TimeoutStopSec=180 16 | SyslogIdentifier=geth 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /nodes/deploy/ethereum/lighthousebeacon.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Ethereum node Lighthouse client 3 | StartLimitIntervalSec=500 4 | StartLimitBurst=5 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=10s 10 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 11 | ExecStart=/home/ubuntu/lighthouse --network mainnet beacon_node --http --execution-endpoint http://localhost:8551 --execution-jwt /home/ubuntu/moonstream-secrets/jwt.hex --datadir /mnt/disks/nodes/ethereum/.lighthouse 12 | Type=simple 13 | User=ubuntu 14 | ExecStop=/bin/kill -s SIGINT -$MAINPID 15 | TimeoutStopSec=180 16 | SyslogIdentifier=lighthouse 17 | 18 | [Install] 19 | WantedBy=multi-user.target 20 | -------------------------------------------------------------------------------- /nodes/deploy/ethereum/node-status.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Moonstream node status server 3 | After=network.target 4 | 5 | [Service] 6 | User=ubuntu 7 | Group=www-data 8 | WorkingDirectory=/home/ubuntu/moonstream/nodes/server 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | ExecStart=/home/ubuntu/moonstream/nodes/server/nodestatus \ 11 | -blockchain ethereum \ 12 | -host "${AWS_LOCAL_IPV4}" \ 13 | -port "${MOONSTREAM_NODES_SERVER_PORT}" 14 | SyslogIdentifier=node-status 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /nodes/deploy/polygon/bor.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=bor 3 | StartLimitIntervalSec=500 4 | StartLimitBurst=5 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=5s 10 | WorkingDirectory=/home/ubuntu/node 11 | EnvironmentFile=/etc/matic/metadata 12 | EnvironmentFile=/home/ubuntu/node/variables.env 13 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 14 | ExecStart=/home/ubuntu/go/bin/bor --datadir "${MOUNT_DATA_DIR}/.bor/data" \ 15 | --port 30303 \ 16 | --http --http.addr "${AWS_LOCAL_IPV4}" \ 17 | --http.vhosts '*' \ 18 | --http.corsdomain '*' \ 19 | --http.port 8545 \ 20 | --ipcpath "${MOUNT_DATA_DIR}/.bor/data/bor.ipc" \ 21 | --http.api 'eth,net,web3,txpool,bor' \ 22 | --syncmode 'full' \ 23 | --networkid '137' \ 24 | --miner.gasprice '30000000000' \ 25 | --miner.gaslimit '20000000' \ 26 | --miner.gastarget '20000000' \ 27 | --txpool.nolocals \ 28 | --txpool.accountslots 16 \ 29 | --txpool.globalslots 131072 \ 30 | --txpool.accountqueue 64 \ 31 | --txpool.globalqueue 131072 \ 32 | --txpool.lifetime '1h30m0s' \ 33 | --maxpeers 200 \ 34 | --metrics \ 35 | --pprof --pprof.port 7071 --pprof.addr '0.0.0.0' \ 36 | --bootnodes "${BOR_BOOTNODES}" 37 | Type=simple 38 | User=ubuntu 39 | ExecStop=/bin/kill -s SIGINT -$MAINPID 40 | TimeoutStopSec=180 41 | SyslogIdentifier=bor 42 | 43 | [Install] 44 | WantedBy=multi-user.target 45 | -------------------------------------------------------------------------------- /nodes/deploy/polygon/node-status.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Moonstream node status server 3 | After=network.target 4 | 5 | [Service] 6 | User=ubuntu 7 | Group=www-data 8 | WorkingDirectory=/home/ubuntu/moonstream/nodes/server 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | ExecStart=/home/ubuntu/moonstream/nodes/server/nodestatus \ 11 | -blockchain polygon \ 12 | -host "${AWS_LOCAL_IPV4}" \ 13 | -port "${MOONSTREAM_NODES_SERVER_PORT}" 14 | SyslogIdentifier=node-status 15 | 16 | [Install] 17 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /nodes/deploy/polygon/variables.env: -------------------------------------------------------------------------------- 1 | MOUNT_DATA_DIR="/mnt/disks/nodes/polygon" 2 | SEEDS_LINE='seeds = "f4f605d60b8ffaaf15240564e58a81103510631c@159.203.9.164:26656,4fb1bc820088764a564d4f66bba1963d47d82329@44.232.55.71:26656"' 3 | BOR_BOOTNODES="enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303,enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303" 4 | -------------------------------------------------------------------------------- /nodes/deploy/xdai/node-status.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Moonstream node status server 3 | After=network.target 4 | 5 | [Service] 6 | User=ubuntu 7 | Group=www-data 8 | WorkingDirectory=/home/ubuntu/moonstream/nodes/server 9 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 10 | ExecStart=/home/ubuntu/moonstream/nodes/server/nodestatus \ 11 | -blockchain xdai \ 12 | -host "${AWS_LOCAL_IPV4}" \ 13 | -port "${MOONSTREAM_NODES_SERVER_PORT}" 14 | SyslogIdentifier=node-status 15 | 16 | [Install] 17 | WantedBy=multi-user.target 18 | -------------------------------------------------------------------------------- /nodes/deploy/xdai/xdai.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Gnosis node nethermind client 3 | StartLimitIntervalSec=500 4 | StartLimitBurst=5 5 | After=network.target 6 | 7 | [Service] 8 | Restart=on-failure 9 | RestartSec=5s 10 | EnvironmentFile=/home/ubuntu/moonstream-secrets/app.env 11 | ExecStart=/usr/bin/nethermind \ 12 | --config /usr/share/nethermind/configs/xdai.cfg \ 13 | --datadir /mnt/disks/nodes/xdai \ 14 | --JsonRpc.Enabled true \ 15 | --JsonRpc.EnabledModules Eth,Web3,TxPool \ 16 | --JsonRpc.Host "${AWS_LOCAL_IPV4}" \ 17 | --JsonRpc.Port 8545 18 | Type=simple 19 | User=ubuntu 20 | ExecStop=/bin/kill -s SIGINT -$MAINPID 21 | TimeoutStopSec=180 22 | SyslogIdentifier=xdai 23 | 24 | [Install] 25 | WantedBy=multi-user.target 26 | -------------------------------------------------------------------------------- /nodes/sample.env: -------------------------------------------------------------------------------- 1 | export MOONSTREAM_NODE_ETHEREUM_IPC_ADDR="" 2 | export MOONSTREAM_NODE_ETHEREUM_IPC_PORT="" 3 | export MOONSTREAM_NODE_ETHEREUM_LISTENING_PORT="" 4 | -------------------------------------------------------------------------------- /nodes/server/cmd/data.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | type PingResponse struct { 4 | Status string `json:"status"` 5 | } 6 | 7 | type GethResponse struct { 8 | Result string `json:"result"` 9 | } 10 | 11 | type PingGethResponse struct { 12 | CurrentBlock uint64 `json:"current_block"` 13 | } 14 | -------------------------------------------------------------------------------- /nodes/server/cmd/server.go: -------------------------------------------------------------------------------- 1 | package cmd 2 | 3 | import ( 4 | "flag" 5 | "log" 6 | "net/http" 7 | "time" 8 | ) 9 | 10 | type extendedServer struct { 11 | blockchain string 12 | } 13 | 14 | func InitServer() { 15 | var listeningAddr string 16 | var listeningPort string 17 | var blockchain string 18 | flag.StringVar(&listeningAddr, "host", "127.0.0.1", "Server listening address") 19 | flag.StringVar(&listeningPort, "port", "8080", "Server listening port") 20 | flag.StringVar(&blockchain, "blockchain", "", "Blockchain to work with (ethereum/polygon/xdai)") 21 | flag.Parse() 22 | 23 | es := extendedServer{blockchain: blockchain} 24 | 25 | serverMux := http.NewServeMux() 26 | serverMux.HandleFunc("/ping", pingRoute) 27 | serverMux.HandleFunc("/status", es.pingGethRoute) 28 | 29 | // Set middlewares from bottom to top 30 | serverHandler := corsMiddleware(serverMux) 31 | serverHandler = logsMiddleware(serverHandler) 32 | serverHandler = panicMiddleware(serverHandler) 33 | 34 | server := http.Server{ 35 | Addr: listeningAddr + ":" + listeningPort, 36 | Handler: serverHandler, 37 | ReadTimeout: 10 * time.Second, 38 | WriteTimeout: 10 * time.Second, 39 | } 40 | 41 | log.Printf("Starting server at %s:%s for blockchain %s\n", listeningAddr, listeningPort, blockchain) 42 | server.ListenAndServe() 43 | } 44 | -------------------------------------------------------------------------------- /nodes/server/configs/settings.go: -------------------------------------------------------------------------------- 1 | package settings 2 | 3 | import ( 4 | "os" 5 | ) 6 | 7 | var LOCAL_IPV4 = os.Getenv("AWS_LOCAL_IPV4") 8 | 9 | // CORS 10 | var MOONSTREAM_CORS_ALLOWED_ORIGINS = os.Getenv("MOONSTREAM_CORS_ALLOWED_ORIGINS") 11 | -------------------------------------------------------------------------------- /nodes/server/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Expects access to Python environment with the requirements for this project installed. 4 | set -e 5 | 6 | MOONSTREAM_CLUSTER_SERVER_HOST="${MOONSTREAM_CLUSTER_SERVER_HOST:-0.0.0.0}" 7 | MOONSTREAM_CLUSTER_SERVER_PORT="${MOONSTREAM_CLUSTER_SERVER_PORT:-8080}" 8 | MOONSTREAM_CLUSTER_BLOCKCHAIN="${MOONSTREAM_CLUSTER_BLOCKCHAIN:-ethereum}" 9 | 10 | go run main.go -host "${MOONSTREAM_CLUSTER_SERVER_HOST}" -port "${MOONSTREAM_CLUSTER_SERVER_PORT}" -blockchain "${MOONSTREAM_CLUSTER_BLOCKCHAIN}" 11 | -------------------------------------------------------------------------------- /nodes/server/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bugout-dev/moonstream/nodes/server 2 | 3 | go 1.17 4 | -------------------------------------------------------------------------------- /nodes/server/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/bugout-dev/moonstream/nodes/server/cmd" 5 | ) 6 | 7 | func main() { 8 | cmd.InitServer() 9 | } 10 | -------------------------------------------------------------------------------- /nodes/server/sample.env: -------------------------------------------------------------------------------- 1 | export AWS_LOCAL_IPV4="" 2 | export MOONSTREAM_CORS_ALLOWED_ORIGINS="http://localhost:3000,https://moonstream.to,https://www.moonstream.to,https://alpha.moonstream.to" 3 | -------------------------------------------------------------------------------- /probes/README.md: -------------------------------------------------------------------------------- 1 | # probes 2 | 3 | Running multiple operations simultaneously under one application. 4 | 5 | Execute one command: 6 | 7 | ```bash 8 | probes engine clean-call-requests --db-uri "${ENGINE_DB_URI}" 9 | ``` 10 | 11 | Run service with configuration: 12 | 13 | ```bash 14 | probes service \ 15 | --config /home/ubuntu/.probes/engine-clean-call-requests.js 16 | ``` 17 | 18 | Config example: 19 | 20 | ```json 21 | { 22 | "application": "engine", 23 | "db_uri": "ENGINE_DB_URI", 24 | "db_timeout": "15s", 25 | "probe": { 26 | "name": "clean-call-requests", 27 | "interval": 10 28 | } 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /probes/cmd/probes/db.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "time" 7 | 8 | "github.com/jackc/pgx/v5/pgxpool" 9 | ) 10 | 11 | func CreateDbPool(ctx context.Context, dbUri string, timeout string) (*pgxpool.Pool, error) { 12 | conf, err := pgxpool.ParseConfig(dbUri) 13 | if err != nil { 14 | return nil, fmt.Errorf("unable to parse database connection string, err: %v", err) 15 | } 16 | ctDuration, err := time.ParseDuration(timeout) 17 | if err != nil { 18 | return nil, fmt.Errorf("unable to parse connect timeout duration, err: %v", err) 19 | } 20 | conf.ConnConfig.ConnectTimeout = ctDuration 21 | 22 | dbPool, err := pgxpool.NewWithConfig(ctx, conf) 23 | if err != nil { 24 | return nil, fmt.Errorf("Unable to establish connection with database, err: %v", err) 25 | } 26 | 27 | return dbPool, nil 28 | } 29 | -------------------------------------------------------------------------------- /probes/cmd/probes/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | ) 7 | 8 | func main() { 9 | command := CreateRootCommand() 10 | err := command.Execute() 11 | if err != nil { 12 | fmt.Println(err.Error()) 13 | os.Exit(1) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /probes/cmd/probes/service.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "context" 5 | "fmt" 6 | "log" 7 | "sync" 8 | "time" 9 | ) 10 | 11 | func RunService(configPaths []string) error { 12 | // Load configuration 13 | configs, err := ReadConfig(configPaths) 14 | if err != nil { 15 | return fmt.Errorf("unable to read config, err: %v", err) 16 | } 17 | 18 | log.Printf("Loaded configurations of %d application probes", len(*configs)) 19 | 20 | var wg sync.WaitGroup 21 | for _, config := range *configs { 22 | wg.Add(1) 23 | go RunWorker(&wg, config) 24 | } 25 | wg.Wait() 26 | 27 | return nil 28 | } 29 | 30 | func RunWorker(wg *sync.WaitGroup, config ApplicationProbeConfig) error { 31 | defer wg.Done() 32 | 33 | ctx := context.Background() 34 | 35 | dbPool, err := CreateDbPool(ctx, config.DbUri, config.DbTimeout) 36 | if err != nil { 37 | log.Printf("[%s] [%s] - unable to establish connection with database, err: %v", config.Application, config.Probe.Name, err) 38 | return err 39 | } 40 | 41 | defer dbPool.Close() 42 | 43 | t := time.NewTicker(time.Duration(config.Probe.Interval) * time.Second) 44 | for { 45 | select { 46 | case <-t.C: 47 | err = config.Probe.ExecFunction(ctx, dbPool) 48 | if err != nil { 49 | log.Printf("[%s] [%s] - an error occurred during execution, err: %v", config.Application, config.Probe.Name, err) 50 | continue 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /probes/deploy/configs/engine-clean-call-requests.json: -------------------------------------------------------------------------------- 1 | { 2 | "application": "engine", 3 | "db_uri": "ENGINE_DB_URI", 4 | "db_timeout": "15s", 5 | "probe": { 6 | "name": "clean-call-requests", 7 | "interval": 10 8 | } 9 | } -------------------------------------------------------------------------------- /probes/deploy/probes.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Run probes service 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/api/probes 9 | EnvironmentFile=/home/ubuntu/probes-secrets/app.env 10 | ExecStart=/home/ubuntu/api/probes/probes service --config /home/ubuntu/.probes/engine-clean-call-requests.json 11 | Restart=on-failure 12 | RestartSec=15s 13 | SyslogIdentifier=probes 14 | 15 | [Install] 16 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /probes/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Compile application and run with provided arguments 4 | set -e 5 | 6 | PROGRAM_NAME="probes_dev" 7 | 8 | go build -o "$PROGRAM_NAME" cmd/probes/*.go 9 | 10 | ./"$PROGRAM_NAME" "$@" 11 | -------------------------------------------------------------------------------- /probes/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/moonstream-to/api/probes 2 | 3 | go 1.19 4 | 5 | require ( 6 | github.com/jackc/pgx/v5 v5.3.1 7 | github.com/spf13/cobra v1.7.0 8 | ) 9 | 10 | require ( 11 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 12 | github.com/jackc/pgpassfile v1.0.0 // indirect 13 | github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect 14 | github.com/jackc/puddle/v2 v2.2.0 // indirect 15 | github.com/spf13/pflag v1.0.5 // indirect 16 | golang.org/x/crypto v0.6.0 // indirect 17 | golang.org/x/sync v0.1.0 // indirect 18 | golang.org/x/text v0.7.0 // indirect 19 | ) 20 | -------------------------------------------------------------------------------- /probes/pkg/data.go: -------------------------------------------------------------------------------- 1 | package probes 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/jackc/pgx/v5/pgxpool" 7 | ) 8 | 9 | type ApplicationProbe struct { 10 | Name string `json:"name"` 11 | Description string 12 | LonDescription string 13 | Interval int `json:"interval"` 14 | 15 | ExecFunction func(context.Context, *pgxpool.Pool) error 16 | } 17 | -------------------------------------------------------------------------------- /probes/pkg/version.go: -------------------------------------------------------------------------------- 1 | package probes 2 | 3 | const VERSION string = "0.0.1" 4 | -------------------------------------------------------------------------------- /probes/sample.env: -------------------------------------------------------------------------------- 1 | export ENGINE_DB_URI="postgresql://:@:/" 2 | -------------------------------------------------------------------------------- /robots/.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.toptal.com/developers/gitignore/api/go,visualstudiocode 2 | # Edit at https://www.toptal.com/developers/gitignore?templates=go,visualstudiocode 3 | 4 | ### Go ### 5 | # If you prefer the allow list template instead of the deny list, see community template: 6 | # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore 7 | # 8 | # Binaries for programs and plugins 9 | *.exe 10 | *.exe~ 11 | *.dll 12 | *.so 13 | *.dylib 14 | 15 | # Test binary, built with `go test -c` 16 | *.test 17 | 18 | # Output of the go coverage tool, specifically when used with LiteIDE 19 | *.out 20 | 21 | # Dependency directories (remove the comment below to include it) 22 | # vendor/ 23 | 24 | # Go workspace file 25 | go.work 26 | 27 | ### VisualStudioCode ### 28 | .vscode/* 29 | !.vscode/settings.json 30 | !.vscode/tasks.json 31 | !.vscode/launch.json 32 | !.vscode/extensions.json 33 | !.vscode/*.code-snippets 34 | 35 | # Local History for Visual Studio Code 36 | .history/ 37 | 38 | # Built Visual Studio Code Extensions 39 | *.vsix 40 | 41 | ### VisualStudioCode Patch ### 42 | # Ignore all local history of files 43 | .history 44 | .ionide 45 | 46 | # End of https://www.toptal.com/developers/gitignore/api/go,visualstudiocode 47 | 48 | # Custom 49 | robots_dev 50 | .secrets/ 51 | dev.env 52 | test.env 53 | prod.env 54 | 55 | abi/ 56 | -------------------------------------------------------------------------------- /robots/README.md: -------------------------------------------------------------------------------- 1 | # robots 2 | 3 | Generate terminus interface: 4 | 5 | ```bash 6 | mkdir -p pkg/terminus 7 | abigen --abi abi/TerminusFacet.json --pkg terminus --out pkg/terminus/terminus.go 8 | ``` 9 | 10 | ## Airdrop preparations 11 | 12 | Prepare Entity collection: 13 | 14 | ```bash 15 | curl "https://api.moonstream.to/entity/collections" \ 16 | --header "Authorization: Bearer ${MOONSTREAM_ACCESS_TOKEN}" \ 17 | --header "Content-Type: application/json" \ 18 | --data '{ 19 | "name": "Test whitelist 1" 20 | }' 21 | ``` 22 | 23 | ### Spire 24 | 25 | Currently, the creation of public entity collections is available only to administrators through `spire` CLI. 26 | 27 | ```bash 28 | export COLLECTION_ID="" 29 | ``` 30 | 31 | List available public autogenerated users: 32 | 33 | ```bash 34 | public-journals users list 35 | ``` 36 | 37 | Create public user, if required: 38 | 39 | ```bash 40 | public-journals users create --name "test-public-user" 41 | ``` 42 | 43 | Make collection public with `--entry-update` or `--entry-create` flags if required: 44 | 45 | ```bash 46 | public-journals journals make --token "${MOONSTREAM_ACCESS_TOKEN}" \ 47 | --journal-id "${COLLECTION_ID}" \ 48 | --public-user-id "${PUBLIC_USER_ID}" 49 | ``` 50 | -------------------------------------------------------------------------------- /robots/cmd/robots/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() { 4 | cli() 5 | } 6 | -------------------------------------------------------------------------------- /robots/cmd/robots/version.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | var ROBOTS_VERSION = "0.0.2" 4 | -------------------------------------------------------------------------------- /robots/deploy/robots-airdrop.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Airdrop robots 3 | After=network.target 4 | StartLimitIntervalSec=300 5 | StartLimitBurst=3 6 | 7 | [Service] 8 | WorkingDirectory=/home/ubuntu/api/robots 9 | EnvironmentFile=/home/ubuntu/robots-secrets/app.env 10 | Restart=on-failure 11 | RestartSec=15s 12 | ExecStart=/home/ubuntu/api/robots/robots airdrop 13 | SyslogIdentifier=robots-airdrop 14 | 15 | [Install] 16 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /robots/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # Compile application and run with provided arguments 4 | set -e 5 | 6 | PROGRAM_NAME="robots_dev" 7 | 8 | go build -o "$PROGRAM_NAME" cmd/robots/*.go 9 | 10 | ./"$PROGRAM_NAME" "$@" 11 | -------------------------------------------------------------------------------- /robots/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/bugout-dev/engine/robots 2 | 3 | go 1.19 4 | 5 | require github.com/ethereum/go-ethereum v1.10.26 6 | 7 | require ( 8 | github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect 9 | github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect 10 | github.com/bugout-dev/humbug/go v0.0.0-20230221171050-e0a1715ec546 // indirect 11 | github.com/deckarep/golang-set v1.8.0 // indirect 12 | github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect 13 | github.com/go-ole/go-ole v1.2.1 // indirect 14 | github.com/go-stack/stack v1.8.0 // indirect 15 | github.com/google/uuid v1.2.0 // indirect 16 | github.com/gorilla/websocket v1.4.2 // indirect 17 | github.com/rjeczalik/notify v0.9.1 // indirect 18 | github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect 19 | github.com/tklauser/go-sysconf v0.3.5 // indirect 20 | github.com/tklauser/numcpus v0.2.2 // indirect 21 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect 22 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect 23 | gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect 24 | ) 25 | -------------------------------------------------------------------------------- /robots/sample.env: -------------------------------------------------------------------------------- 1 | export MOONSTREAM_ENTITY_URL="https://api.moonstream.to/entity" 2 | export MOONSTREAM_POLYGON_WEB3_PROVIDER_URI="" 3 | export MOONSTREAM_MUMBAI_WEB3_PROVIDER_URI="" 4 | export MOONSTREAM_WYRM_WEB3_PROVIDER_URI="" 5 | export ENGINE_NODEBALANCER_ACCESS_ID="" 6 | export ENGINE_ROBOTS_SECRETS_DIR="" 7 | export HUMBUG_REPORTER_ROBOTS_HEARTBEAT_TOKEN="" 8 | 9 | export MOONSTREAM_TERMINUS_DIAMOND_CONTRACT_POLYGON_ADDRESS="" 10 | export MOONSTREAM_TERMINUS_DIAMOND_CONTRACT_MUMBAI_ADDRESS="" 11 | export MOONSTREAM_TERMINUS_DIAMOND_CONTRACT_WYRM_ADDRESS="" 12 | -------------------------------------------------------------------------------- /types/python/.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | profile = black 3 | multi_line_output = 3 -------------------------------------------------------------------------------- /types/python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include moonstreamtypes/version.txt -------------------------------------------------------------------------------- /types/python/README.md: -------------------------------------------------------------------------------- 1 | # moonstream-types 2 | -------------------------------------------------------------------------------- /types/python/moonstreamtypes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/moonstream-to/api/b294998099d6f268347c8a05a434ec2b26dd32a2/types/python/moonstreamtypes/__init__.py -------------------------------------------------------------------------------- /types/python/moonstreamtypes/version.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | VERSION = "UNKNOWN" 4 | 5 | try: 6 | PATH = os.path.abspath(os.path.dirname(__file__)) 7 | VERSION_FILE = os.path.join(PATH, "version.txt") 8 | with open(VERSION_FILE) as ifp: 9 | VERSION = ifp.read().strip() 10 | except: 11 | pass 12 | -------------------------------------------------------------------------------- /types/python/moonstreamtypes/version.txt: -------------------------------------------------------------------------------- 1 | 0.0.11 2 | -------------------------------------------------------------------------------- /types/python/mypy.ini: -------------------------------------------------------------------------------- 1 | [mypy] 2 | 3 | [mypy-moonstreamdb.*] 4 | ignore_missing_imports = True 5 | 6 | [mypy-moonstreamdbv3.*] 7 | ignore_missing_imports = True 8 | --------------------------------------------------------------------------------