{"id":18863955,"url":"https://github.com/hellc/bans","last_synced_at":"2026-01-26T11:33:11.336Z","repository":{"id":197471972,"uuid":"143707056","full_name":"hellc/bans","owner":"hellc","description":" DNS based Blockchain Address retrieval method","archived":false,"fork":false,"pushed_at":"2018-09-24T08:14:55.000Z","size":6171,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-30T21:26:59.300Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/hellc.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}},"created_at":"2018-08-06T09:34:57.000Z","updated_at":"2019-07-30T13:57:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"77e96b9f-6e8c-4705-bd21-343543f2f3ad","html_url":"https://github.com/hellc/bans","commit_stats":null,"previous_names":["hellc/bans"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellc%2Fbans","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellc%2Fbans/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellc%2Fbans/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellc%2Fbans/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellc","download_url":"https://codeload.github.com/hellc/bans/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239808523,"owners_count":19700451,"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":"2024-11-08T04:39:12.088Z","updated_at":"2026-01-26T11:33:06.312Z","avatar_url":"https://github.com/hellc.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple BANS (Blockchain Address Name Service)\n### DNS based Simple Blockchain Address retrieval method\n\nThe purpose of this method is to provide ability to link\nblockchain wallet or smart contract addresses with existing public domain names.\n\n![demo](https://github.com/hellc/bans/blob/master/demo/bans.gif)\n\n## SETUP GUIDE\n\nThe main goal is to provide secured and anonymous features to link and retrieve your custom blockchain address based on public domain name you own. That will allow you to use short and user friendly names that could be found by everyone \nthrought the simple validation procedure.\n\n### STEPS\n\n#### 0. You will have to use your existing blockchain address in order to link it with your own domain name.\n#### 1. Select private and secured DNS.\n\nWe recommend you to select DNS with DNSSEC and DNS over HTTPS/TLS support.\nFor example: Cloudflare DNS service should be good enought. Also you could take a look at Google DNS.\nCloudflare as well provide TOR based DNS services. Check: https://blog.cloudflare.com/welcome-hidden-resolver/\n\n#### 2. Create BANS DNS record\n\nThere are no specification on bans record format, however we are suggest you to follow:\n\n```\nDNS record\ntype: TXT\nname: bans.\u003ctoken code\u003e.\u003ccode address seq. number\u003e\nvalue: \u003cyour blockchain address\u003e\n```\nFor example: \n\n```\nDNS record 1\ntype: TXT\nname: bans.xvg.0\nvalue: DCfgkLJXMMAjcnKxTuw3CaTqNmgT7mwc5T\n\nDNS record 2\ntype: TXT\nname: bans.xvg.1\nvalue: DCfgkLJXMMAjcnKxTuw3CaTqNmgT7mwc5A\n\nDNS record 3\ntype: TXT\nname: bans.btc.0\nvalue: 1A8BS8UTKq7PMunsHKFPgzHq122gZ3vkqS\n\n...\n```\nResult Cloudflare record should looks like:\n\n![demo](https://github.com/hellc/bans/blob/master/demo/dns_Record.png)\n\n#### 3. Retrieve your DNS record on client\n\nTo demonstrate this we will [fork](https://github.com/hellc/vIOS) the upcoming [XVG iOS wallet](https://github.com/vergecurrency/vIOS). \nTo provide the anonymity we will perform connection via __TOR__ network using __DNS over HTTPS__ JSON request method.\n_KXP.ONE_ - domain name will be used for our demonstration.\n\nSWIFT base method will look like:\n```SWIFT\nclass CloudflareAPIClient {\n    \n    static let shared = CloudflareAPIClient()\n    \n    let torEndpoint: String = \"https://dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion/dns-query?\"\n    let basicEndpoint: String = \"https://cloudflare-dns.com/dns-query?\"\n    \n    func walletAddressFor(currency: String, domainName: String, torDns: Bool = true,\n                          completion: @escaping (_ address: String?) -\u003e Void) {\n        let endpoint = torDns ? torEndpoint : basicEndpoint\n        let url = URL(string: \"\\(endpoint)name=bans.\\(currency).0.\\(domainName)\u0026type=TXT\")\n        \n        var request = URLRequest(url: url!)\n        request.setValue(\"application/dns-json\", forHTTPHeaderField: \"accept\")\n        \n        let task = TorClient.shared.session.dataTask(with: request){ (data, resonse, error) in\n            if let data = data {\n                do {\n                    let json = try JSON(data: data)\n                    let result = json[\"Answer\"][0][\"data\"].string?.replacingOccurrences(of: \"\\\"\", with: \"\")\n                    \n                    completion(result)\n                } catch {\n                    print(\"Error info: \\(error)\")\n                    completion(nil)\n                }\n            } else if let _ = error {\n                completion(nil)\n            }\n        }\n        \n        task.resume()\n    }\n}\n```\nHere the request:\n\n```SWIFT\nCloudflareAPIClient.shared.walletAddressFor(currency: \"xvg\", domainName: \"kxp.one\") { \n                resultAddress in\n                \n                if resultAddress?.count != 34 { //SIMPLE ADDRESS VALIDATION\n                    //DO: ADDRESS IS NOT VALID\n                    return\n                }\n                //DO: ADDRESS VALID, PROCEED ADDRESS\n                //resultAddress: \"DCfgkLJXMMAjcnKxTuw3CaTqNmgT7mwc5T\"\n            }\n```\n\nSame via curl:\n\n```curl\ncurl -H 'accept: application/dns-json' 'https://cloudflare-dns.com/dns-query?name=bans.xvg.0.kxp.one\u0026type=TXT'\nor\ncurl -H 'accept: application/dns-json' 'https://dns4torpnlfs2ifuz2s2yf3fc7rdmsbhm6rw75euj35pac6ap25zgqad.onion/dns-query?name=bans.xvg.0.kxp.one\u0026type=TXT'\n\noutput:\n{\"Status\": 0,\"TC\": false,\"RD\": true, \"RA\": true, \"AD\": false,\"CD\": false,\"Question\":[{\"name\": \"bans.xvg.0.kxp.one.\", \"type\": 16}],\"Answer\":[{\"name\": \"bans.xvg.0.kxp.one.\", \"type\": 16, \"TTL\": 300, \"data\": \"\\\"DCfgkLJXMMAjcnKxTuw3CaTqNmgT7mwc5T\\\"\"}]}\n```\n\nTo provide additional layer of security - perform your request using __DO__ field to get DNSSEC feature.\nFor more info, please visit: https://developers.cloudflare.com/1.1.1.1/dns-over-https/json-format/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellc%2Fbans","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellc%2Fbans","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellc%2Fbans/lists"}