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

Improve the modularity of blockchain #80

Closed
taoeffect opened this issue Dec 12, 2014 · 2 comments
Closed

Improve the modularity of blockchain #80

taoeffect opened this issue Dec 12, 2014 · 2 comments
Assignees
Milestone

Comments

@taoeffect
Copy link
Member

See this comment:

# result.value = JSON.parse result.value
# TODO: [BDNS] this! also, note that we're converting JSON multiple times
#       this is ineffecient and ugly.
#       organize all this code in a generic way to support all blockchains.

Let's do this in the icann branch I just created (on top of which #67 will be rebased and a new PR submitted).

@wemeetagain let's work together to do the following:

  1. Create a template blockchain.coffee file that contains a class for the other blockchains to subclass (in nmc.coffee, bdns.coffee, etc.)
  2. Move the subclasses into a blockchains folder that's inside of src or src/lib (not sure yet, which do you think is better?)
  3. When DNSChain boots up, automagically load up all of the files from the blockchains folder. The subclasses themselves must check to see if the system supports them. If they are able to "boot up" then they automatically set themselves up to start processing queries. This can be automated a bit by having the super class have a method that must be overridden (called config:). Return null if no file can be found, otherwise return an object? with the configuration.
  4. Each subclass should check to see if the blockchain configuration file has been manually specified in dnschain.conf and use it instead if so use it instead (Allow dnschain.conf to specify path to the namecoin configuration file #60).
  5. Address the inefficiency and ugly issues that the TODO: comment above describes.

Ultimately, adding a new blockchain will consist of simply copying the blockchain.coffee template into blockchains/ and overriding it, and that's it. No other files should need touching.

@taoeffect
Copy link
Member Author

Note: the PR for closing this issue is currently #92.

@taoeffect
Copy link
Member Author

Closed, great job on this one @wemeetagain!

@taoeffect taoeffect modified the milestone: 0.5.0 Feb 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants