{"id":13566268,"url":"https://github.com/hoodrunio/explorer-backend","last_synced_at":"2025-04-03T23:31:29.106Z","repository":{"id":212741916,"uuid":"561896248","full_name":"hoodrunio/explorer-backend","owner":"hoodrunio","description":"Backend app for Cosmos ecosystem explorer.","archived":false,"fork":false,"pushed_at":"2024-12-01T00:27:06.000Z","size":1653,"stargazers_count":5,"open_issues_count":26,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-12-01T01:22:58.596Z","etag":null,"topics":["blockchain-explorer","cosmos","grpc","restful-api","rust"],"latest_commit_sha":null,"homepage":"https://backend.testnet.run/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoodrunio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-11-04T18:35:46.000Z","updated_at":"2024-03-19T15:06:27.000Z","dependencies_parsed_at":"2023-12-16T01:02:56.428Z","dependency_job_id":null,"html_url":"https://github.com/hoodrunio/explorer-backend","commit_stats":null,"previous_names":["hoodrunio/explorer-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoodrunio%2Fexplorer-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoodrunio%2Fexplorer-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoodrunio%2Fexplorer-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoodrunio%2Fexplorer-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoodrunio","download_url":"https://codeload.github.com/hoodrunio/explorer-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247097923,"owners_count":20883125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain-explorer","cosmos","grpc","restful-api","rust"],"created_at":"2024-08-01T13:02:05.803Z","updated_at":"2025-04-03T23:31:26.860Z","avatar_url":"https://github.com/hoodrunio.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# Explorer Backend\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"/\"\u003e\u003cimg src=\"https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fthumb%2Fd%2Fd7%2FDesktop_computer_clipart_-_Yellow_theme.svg%2F640px-Desktop_computer_clipart_-_Yellow_theme.svg.png\" alt=\"Logo\" height=220\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nThis repo only serves as an API for the UI and has no D. connection with it.\n\nThe UI repo can be found [here.](https://github.com/testnetrunn/explorer-ui-v2)\n\n\n**Explorer backend is an app:**\n- Deals with blockchain nodes.\n- Supports our database implementation.\n- Provides REST \u0026 websocket API.\n\n\n# To-do\n- EVM TX support - decode ethabi func/specs. (✅)\n- Smart contract verification (Solidity only) for Evmos. (✅: UI dependent works still in development.)\n- Axelar EVM-poll/heartbeats features. (✅)\n- **Database** implementation to store important stuff. (✅)\n- **WebSocket** interface to provide multiple events to subscribe dynamic data. (✅)\n- **gRPC** implementation. (gRPC infra instead of REST.) - Under development. (🚧)\n- Support Kyve Pools and protocol layer features. - Under development. (🚧)\n\n# Sub-modules\n\n[Protocol-buffers](https://github.com/testnetrunn/protos)\n\n# Usage\n\u003e If you don't have Rust installed, follow the instructions at [rust-lang.org](https://www.rust-lang.org/tools/install).\n\n- Clone the repository \n```\ngit clone https://github.com/testnetrunn/explorer-backend.git\ncd explorer-backend\n```\n\n- Install MongoDB\n\u003e Original resources can be found [here](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu).\n\n```\nwget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -\necho \"deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse\" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list\nsudo apt-get update\nsudo apt-get install -y mongodb-org\nsudo systemctl start mongod\n```\n\n- Install sub-modules\n```bash\n\ncd $HOME/explorer-backend\ngit submodule init\ngit submodule update\n```\n- Run the project by typing this in terminal\n```\ncargo run --release\n```\n- Go to [`src/routes/`](https://github.com/testnetrunn/explorer-backend/tree/main/src/routes) folder, and pick any of the files inside.\n- Each function represents a different path.\n- Test by visiting paths with a browser.\n\nFor production, you might consider proxy. \nHere is an example for nginx:\n\n```\nserver {\n    listen 80;\n    listen 443;\n\n    server_name example.com;\n    location / {\n        proxy_read_timeout 86400s;\n        proxy_send_timeout 86400s;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection upgrade;\n        proxy_redirect                      off;\n        proxy_set_header Host               $host;\n        proxy_set_header X-Real-IP          $remote_addr;\n        proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto  $scheme;\n      proxy_pass      http://127.0.0.1:8080;\n       }\n    location /socket {\n        proxy_read_timeout 86400s;\n        proxy_send_timeout 86400s;\n        rewrite  ^/socket/(.*) /$1 break;\n        proxy_connect_timeout 175s;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"Upgrade\";\n        proxy_set_header Host $host;\n        proxy_pass http://127.0.0.1:8081;\n    }\n}\n```\n\n# Development\n\n\n\n\n## Support a new chain.\n\nOpen [`Chains.yaml`](https://github.com/testnetrunn/explorer-backend/blob/main/Chains.yml) file, and provide the required info below in the end of the file:\n- Name\n- Logo\n- RPC URL\n- REST API URL\n- Web Socket URL\n\u003e All other info is optional, and some of them are generated automatically.\n\nFor example: \n```yaml\naxelar:\n  name: axelar\n  logo: https://assets.coingecko.com/coins/images/24489/large/tsYr25vB_400x400.jpg\n  rpc_url: https://rpc.cosmos.directory/axelar\n  rest_url: https://axelar-api.polkachu.com\n  wss_url: wss://axelar-rpc.chainode.tech/websocket\n```\n\n\n\n\n## Support a new endpoint.\n\nGo to [`src/routes`](https://github.com/testnetrunn/explorer-backend/tree/main/src/routes), and find or create a new file for the category associated with the new endpoint to be supported.\n\n\u003e Don't forget to import important stuff.\n\nCreate a new function representing the endpoint like below:\n```rs\n#[get(\"{chain}/example\")]\npub async fn example(path: Path\u003cString\u003e, chains: Data\u003cState\u003e) -\u003e Result\u003cimpl Responder, TNRAppError\u003e {\n    let chain = path.into_inner();\n\n    let chain = extract_chain(\u0026chain, chains)?;\n    let data = chain.get_example().await?;,\n    Ok(TNRAppSuccessResponse::new(data))\n}\n```\n `{chain}` means a path variable, and its type is defined at `Path\u003cString\u003e`.\n\n If there is also another variable, we define its type as `Path\u003c(String, OtherVarType)\u003e`.\n \n \u003e You have to create a fetch method for `Chain` struct before creating the endpoint.\n \n ## Create a new method.\n \nGo to [`src/fetch`](https://github.com/testnetrunn/explorer-backend/tree/main/src/fetch), and find or create a new file for the category associated with the new method to be created.\n Define a new method inside `impl` block like below:\n ```rs\n impl Chain {\n     •••\n     \n     pub async fn get_signing_info(\u0026self, cons_addr: \u0026str) -\u003e Result\u003cOutRestResponse\u003cInternalSlashingSigningInfoItem\u003e, String\u003e {\n        let path = format!(\"/cosmos/slashing/v1beta1/signing_infos/{cons_addr}\");\n\n        let resp = self.rest_api_request::\u003cSigningInfoResp\u003e(\u0026path, \u0026[]).await?;\n\n        let signing_info = resp.val_signing_info.try_into()?;\n\n        OutRestResponse::new(signing_info, 0)\n    }\n \n }\n ```\n \n \u003e If the method is not chain agnostic, you use a logic like `if self.inner.name == \"evmos\"` there.\n\n# Fetching proto\n```\nbuf export buf.build/cosmos/cosmos-sdk --output proto\nbuf export buf.build/cosmos/ibc --output proto\nbuf export buf.build/evmos/evmos --output proto\nbuf export buf.build/osmosis-labs/osmosis --output proto\n# complicated not published to buf registry\nbuf export buf.build/umee-network/umee --output proto\n# complicated not publish and non conforming directory structure\nbuf export buf.build/Gravity-Bridge/Gravity-Bridge --output proto \n```\n\nlastly export cosmos-sdk to override purposes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoodrunio%2Fexplorer-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoodrunio%2Fexplorer-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoodrunio%2Fexplorer-backend/lists"}