Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving with zone files from Sia #2

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rithvikvibhu
Copy link

@rithvikvibhu rithvikvibhu commented Apr 3, 2021

What

This PR adds 2 suffixes ._sia. and ._siaregistry which can be used to download a zone file to query.

._sia. suffix

This is the simpler one where the skylink of the zone file is directly added on the blockchain.
There's already one to test (regtest, TODO: replicate on mainnet)

hsw-rpc sendupdate testname '{"records": [{"type": "NS", "ns": "AABsAiWo6vzvbhsJwG60aSztGijhT90BWnXHdxfMPpuZZg._sia."}]}'

The zone file is downloaded, loaded with bns, then queried for the user request.
The only problem here is that updating blockchain DNS for every small change of zone file takes time + $$$.

._siaregistry. suffix

This adds 1 more request to first get the skylink of the zone file from the Sia Registry (slows down response time though).
So the blockchain gives registry info (public key, data key), this is used to get the zone file skylink.
Registry entry for this domain

# note: the domain here is siaregistry, which in hindsight wasn't a great name. Will pick a better one for mainnet.
hsw-rpc sendupdate siaregistry '{"records": [{"type": "NS", "ns": "ed25519.73d03e6d4ac9325334ed1b4a40ccde62.724e5f614c8c33455c3ce59c659eb8b3.d4dd7abf18e793bac2e2ebecf8679564.b31c03c44db43ca3931a6da7475c306b._siaregistry."}]}'

And this registry can be updated easily programmatically, or with a simple interface like SkyDB.

SkyDB

Portals

By default, https://siasky.net is used, but can be configured with handover-sia-portal config. While all portals with with ._sia., not all support the registry yet. For example skyportal.xyz does, but skydrain.net does not.

Cache

Both getting skylink content and registry are cached with LRU (similar to RootCache in hsd).

Use it

  1. Register 2 names above and sendupdate.
  2. Run hsd with handover (./bin/hsd --plugins handover --log-level debug --rs-port 53)
  3. Query with dig @127.0.0.1 testname TXT and dig @127.0.0.1 siaregistry TXT

To Do

  • Make handover.js more plugin-ish. Right now there's a bit of dupe code for eth and sia, an interface to register all prefixes maybe.
  • Enable/disable for each scheme
  • More error handling
  • DNSSEC
  • Update readme
  • Update the HIP for the 2 suffixes (after reviews on this, ofc)

@kibagateaux
Copy link

Very dope. Once you guys finalize the suffix you want to use, can you update HIP-05 README with them please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants