{"id":25284318,"url":"https://github.com/elastos/elastos.org.blockchainagent","last_synced_at":"2025-04-06T14:35:56.707Z","repository":{"id":96721157,"uuid":"162218831","full_name":"elastos/Elastos.ORG.BlockchainAgent","owner":"elastos","description":null,"archived":false,"fork":false,"pushed_at":"2020-12-28T14:16:24.000Z","size":81,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-02-12T20:39:05.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elastos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-18T02:31:58.000Z","updated_at":"2020-12-28T14:16:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"5df1fddb-e334-45ff-808a-ac1664b3c1c9","html_url":"https://github.com/elastos/Elastos.ORG.BlockchainAgent","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastos%2FElastos.ORG.BlockchainAgent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastos%2FElastos.ORG.BlockchainAgent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastos%2FElastos.ORG.BlockchainAgent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elastos%2FElastos.ORG.BlockchainAgent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elastos","download_url":"https://codeload.github.com/elastos/Elastos.ORG.BlockchainAgent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247496584,"owners_count":20948261,"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":[],"created_at":"2025-02-12T20:37:59.380Z","updated_at":"2025-04-06T14:35:56.699Z","avatar_url":"https://github.com/elastos.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Elastos.ORG.BlockchainAgent\n==============\n\n## Summary\n\nThis repo provide simple HTTP Restful API for developers to send did raw data to elastos did side chain.\n\n## Build with maven\n\nIn project directory, use maven command:\n```Shell\n$uname mvn clean compile package\n```\nIf there is build success, Then the package did.chain.agent-0.0.1.jar will be in target directory.\n\n## Configure project properties\nIn project directory, create configuration file from the template:\n\n```bash\n$ pushd src/main/resources\n$ cp -v application.properties.in application.properties\n$ popd\n```\n\n### Configure database\nFirst create database table use sql file in project: block_chain_agent.sql\n\nChange spring.datasource to your database.like:\n```yaml\nspring.datasource.url=jdbc:mariadb://localhost:3306/up_chain_wallets?useUnicode=true\u0026characterEncoding=UTF-8\u0026useSSL=false\nspring.datasource.username=root\nspring.datasource.password=12345678\nspring.datasource.driver-class-name=org.mariadb.jdbc.Driver\n```\n\n### Configure did side chain address\nChange \"node.didPrefix\" to your did side chain node url.\n\n### Configure did up chain wallets sum \nChange \"wallet.sum\" to change the amount of the wallets to be used to up chain. \nthe more up chain wallets the more up chain transaction at the same time and the more resource to be used.\nSo we recommend the number is bigger than 100 and less than 1000.\n\n## Run\n\nCopy did.chain.service-0.0.1.jar to your deploy directory.\nthen use jar command to run this spring boot application.\n\n```shell\n$uname java -jar did.chain.agent-0.0.1.jar\n```\n## Web Service APIs\n\n### Get deposit address for renewal\n```url\n/api/v1/upchain/deposit/address\n```\nAll the up chain fee go from deposit wallet, so you will get deposit address to renewal the system.\n\nFor example:\nWe get from our local did chain service request like this:\n```url\nhttp://localhost:8093/api/1/blockagent/upchain/deposit/address\n```\nIf Success, we will get response like:\n```json\n{\n    \"result\": \"EZdDnKBRnV8o77gjr1M3mWBLZqLA3WBjB7\",\n    \"status\": 200\n}\n```\nThe \"result\" is deposit wallet address, which need to have enough ela(\u003e10ela) to pay the up chain fee. \n\n### Renewal all the up chain wallets\n```url\n/api/1/blockagent/upchain/wallets/renewal\n```\nAfter you renewal the deposit wallet. You should call this api to renewal the really work wallets(up chain wallet) from the deposit wallet,\nto make sure the up chain recording be success.  \n\nFor example:\nWe post to our local did chain service request like this:\n```url\nhttp://localhost:8093/api/1/blockagent/upchain/wallets/renewal\n```\nwith header: \n```json\n[{\"key\":\"Content-Type\",\"value\":\"application/json\",\"description\":\"\",\"enabled\":true}]\n```\nand put the transfer ela in body.\n```json\n{\n    \"ela\": \"10.0\"\n}\n```\nIf Success, we will get response like:\n```json\n{\n    \"result\": \"a8965892e49a9f285bfd61059b9766b54f98cd0f53bf0548f17860acc9a71964\",\n    \"status\": 200\n}\n```\nThe \"result\" is txid, which is the transaction id of deposit wallet transfer to up chain wallets.\n\n### Up raw data to side chain\n```url\n/api/1/blockagent/upchain/data\n```\n\nFor example:\nI have raw data (which can be created by API:[ElaDidService.packDidRawData](https://did-service-api.readthedocs.io/en/refactor_frontend/did_service_api_guide.html#packdidrawdata)):\n```json {\"msg\":\"7B22646964223A22696A5950654E51354B336B624A6D5545486D566153345439566F5350694634585164222C22646964537461747573223A224E6F726D616C222C2270726F7065727479223A7B226B6579223A226D795F6E6F7465626F6F6B73222C22737461747573223A224E6F726D616C222C2276616C7565223A225B5C2244656C6C5C222C5C224D61635C222C5C225468696E6B7061645C225D227D2C22746167223A224449442050726F7065727479222C2276657273696F6E223A22312E30227D\",\"sig\":\"92E40A61AFB297C8B7AA97E27DF20B661507C869BA5A7E5F7A08E84791B5100AE4B370E6669F833865223DC2A2D645BECC199CFC31B1A55DA92C0B0E40C09455\",\"pub\":\"022839482C0D6A844C817F6AEACDD0BC6141A9067105292E8DB024C5A3E78D7C9C\"}\n```\nThen we post to our local did chain service request like this:\n```url\nhttp://localhost:8093/api/1/blockagent/upchain/data\n```\nwith header: \n```json\n[{\"key\":\"Content-Type\",\"value\":\"application/json\",\"description\":\"\",\"enabled\":true}]\n```\nand the raw data in post body of curse.\n\nIf Success, we will get response like:\n```json\n{\n    \"result\": \"a8965892e49a9f285bfd61059b9766b54f98cd0f53bf0548f17860acc9a71964\",\n    \"status\": 200\n}\n```\nThe \"result\" is txid, which is the record transaction id.\n\n### Get rest of wallets \n```url\n/api/v1/upchain/rest\n```\nGet rest of deposit and working wallets.\n\nFor example:\nWe get from our local did chain service request like this:\n```url\nhttp://localhost:8093/api/1/blockagent/upchain/rest\n```\nIf Success, we will get response like:\n\n```json\n{\n    \"result\": {\n        \"DepositRest\": 9.999597,\n        \"WorkingWalltesRest\": 11.099888999999978\n    },\n    \"status\": 200\n}\n```\n\n### Turn on/off up data service and timer task\nHTTP: POST\nURL : /api/1/blockagent/upchain/switch\ndata:{\n    \"service\":true,\n    \"task\":false\n}\nreturn:\n    成功：{\"status\":200}\n    失败:{\"status\":400, \"message\":\"err msg\"}\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastos%2Felastos.org.blockchainagent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felastos%2Felastos.org.blockchainagent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felastos%2Felastos.org.blockchainagent/lists"}