{"id":22763290,"url":"https://github.com/nikstar/ton-dns","last_synced_at":"2025-03-30T09:41:41.266Z","repository":{"id":168257819,"uuid":"212862922","full_name":"nikstar/ton-dns","owner":"nikstar","description":"Smart contract for Telegram competition","archived":false,"fork":false,"pushed_at":"2020-05-11T10:09:14.000Z","size":82,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T11:44:49.546Z","etag":null,"topics":["dns","telegram","ton"],"latest_commit_sha":null,"homepage":"","language":"C","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/nikstar.png","metadata":{"files":{"readme":"README.md","changelog":"change-owner.fif","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-04T16:54:54.000Z","updated_at":"2024-08-08T22:12:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"412ab444-fa9d-4371-8a6d-3a81406eaa97","html_url":"https://github.com/nikstar/ton-dns","commit_stats":null,"previous_names":["nikstar/ton-dns"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2Fton-dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2Fton-dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2Fton-dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2Fton-dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikstar","download_url":"https://codeload.github.com/nikstar/ton-dns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301960,"owners_count":20755512,"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":["dns","telegram","ton"],"created_at":"2024-12-11T11:07:56.942Z","updated_at":"2025-03-30T09:41:41.260Z","avatar_url":"https://github.com/nikstar.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Manual DNS\n\n*This contact won II place prize in the first [blockchain contest](https://contest.com/blockchain). [Entry page](https://contest.com/blockchain/entry364) contains version that was submitted, and notes by judges.*\n\nThis project implements **manual DNS** smart contract, along with scripts needed to register subdomains and change smart contract ownership. \n\nDNS values are parsed from specially formatted text files which let user store text or binary data. This submission includes scripts for generating public keys and local testing.\n\nFeel free to [get in touch](https://t.me/nikstar). This project is hosted [on Github](https://github.com/nikstar/ton-dns), I will make it public after submission deadline. Check there for updates!\n\n## Creating new contract\n\n1. Compile contract code:\n    \n    ```bash\n    func -PS -o manual-dns.fif stdlib.fc stdlib_ext.fc manual-dns.fc\n    ```\n\n    [manual-dns.fc](manual-dns.fc) includes smc code and [stdlib_ext.fc](stdlib_ext.fc) includes some asm extensions.\n\n    Note that `manual-dns.fif` is already checked in this repo, so this step can be skipped.\n\n2. Create new contract:\n\n    ```bash\n    fift -s new-manual-dns.fif 0 files/id1\n    ```\n\n3. Send Grams to non-bouncable address and upload.\n\n4. Get-method `seqno` should return 1 on success.\n\n## Registering new subdomain\n\nNew subdomains can be registered using [register.fif](register.fif):\n\n```bash\nfift -s register.fif files/id1.addr out/id1.pk \"ru.\" files/entries.txt 1 files/reg1.boc\n```\n\n(Run without options for help.)\n\nIn this example DNS values are parsed from following text file:\n\n```\n-2 =\u003e file out/id1.pub\n-1 =\u003e address kQCnvV61wU5cLVghtZGlgGs_uS-Kzhgc1wp3K-3pyxH7z6xv\n 1 =\u003e text Hello darkness, my old friend\n 2 =\u003e base64 SSd2ZSBjb21lIHRvIHRhbGsgd2l0aCB5b3UgYWdhaW4K\n 3 =\u003e base64url QmVjYXVzZSBhIHZpc2lvbiBzb2Z0bHkgY3JlZXBpbmc=\n 4 =\u003e hex 4c65667420697473207365656473207768696c6520492077617320736c656570696e670a\n```\n\nAs you can see, values can be provided in any desired format: imported from file or provided directly as text or encoded data.\n\nThis format can be easily extended for further convenience once more details of DNS are nailed down. For example, aliases for predefined categories can be used: `-2 constant OWNER`, `1 constant CNAME` and so on. See [register.fif](register.fif) for implementation details.\n\n### Unregistering subdomains\n\nSubdomains can be deleted using [unregister.fif](unregister.fif):\n\n```bash\nfift -s unregister.fif files/id1.addr out/id1.pk \"ru.\" 2 files/unreg1.boc\n```\n\nThis is equivalent to passing an empty file to `register.fif`.\n\n## Dnsresolve\n\nDnsresolve get-method has been implemented according to spec. In this example\n\n- `dnsresolve \"ru.\" 0` returns (3, dictionary from category to dns-value),\n- `dnsresolve \"ru.\" 1` returns (3, dns-value),\n- `dnsresolve \"ru.\" 42` returns (0, null),\n- `dnsresolve \"ru.yandex\" 0` returns (3, dns-value for category=-1) (if category=-1 is not set, returns (0, null)),\n- `dnsresolve \"org.\" 0` returns (0, null).\n\nOne thing I was not clear about is handling string with multiple subdomain names, e.g. `ru\\0org\\0`. I opted to return value for the first subdomain (`ru` in this case) and ignore the rest of the string. If smc is expected to return values for *any* of the names provided, it is unclear what to return as the first value (number of bytes consumed).\n\n## Changing ownership\n\nOwner (i.e. public key stored in smc persistent storage) can be changed using [change-owner.fif](change-owner.fif):\n\n```bash\nfift -s change-owner.fif files/id1.addr files/id1.pk files/id2.pub 3 files/change12.boc\n```\n\nNote that public key file can be obtained by running `fift -s pub.fif files/id2`. Current owner does not necessarily have access to new private key, so this interface was chosen.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikstar%2Fton-dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikstar%2Fton-dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikstar%2Fton-dns/lists"}