NVS (Name-Value Storage) and DNS support in Emercoin

Please note this document may be subject to change especially around the release of Emercoin version 0.3.0.

Starting with version 0.3.0, Emercoin provides a new service: storing name->value pairs in its blockchain. The inital idea has been borrowed from the NameCoin cryptocurrency. However, where NameCoin is mostly focused on supporting decentralized domain zone *.bit in their extension, Emercoin provides a universal service to store and maintain name->value pairs without imposing narrow specialization. Of course, Emercoin supports distributed alternative DNS service too. Moreover, each Emercoin wallet contains a built-in simple DNS server, supporting the standard RFC1034 UDP DNS protocol.

General comparison

Among the myriad cryptocurrencies only two of them officially support storing additional data in a blockchain. These are, of course, NameCoin and Emercoin. In both cryptocurrencies additional data is organized in same way, by a set of pairs: 

  • name - search key (label) for stored data

  • value - data itself

A short comparison of name-subsystem follows (prices in respective coins): 

Lease time~200 daysvariable*
* Price is variable, and computed by formula:
p = sqrt(0.01 * R * y) + s / 128
    R = Current Proof-of-work reward, in cents.
    y = Lease time, in years. Available by 1 day fractions.
	The cost of creating a new name is equal to the cost of a 1 year lease.
    s = key_size + value_size, in bytes. Division is integer, so for 
        entries, less than 128 bytes, this price part is zero.

For example, 9/30/2014 PoW reward was 140EMC, or 14000EMC cents (EMc).
If you want to lease name (length 100 bytes) for 1 year, you pay:

p = sqrt(0.01 * 14000 * (1[create new name] + 1[one year lease])) + (floor)(100 / 128) = 17EMc = 0.17EMC.

All fees are "burnt" and become unrecoverable (transaction output is less than input).

Emercoin allocates 20kB for value, enough to fit public keys for most modern cryptographic applications. We consider a cryptocurrency blockchain to be an extremely reliable place to publish and maintain public keys for many cryptographic applications such as SSH/SSL certificates. Like regular payment transactions, stored name->value pairs also get confirmations during block generation, and are virtually immune to being altered in a Man-In-the-Middle attack.

Since the blockchain is a trusted data store protected from unauthorized modification it is a great foundation for the deployment of cryptographic Public Key Infrastructure (PKI), proof-of-ownership timestamps or other distributed services.

Managing names

The blockchain of Emercoin is able to store name->value pairs without any restrictions in the data format. However, for standardization purposes we recommend the following format to store names:

service_abbr:unique_keyFor example:

All DNS records must be in lowercase.

Each name->value pair has its owner. Each owner is specified by the Emercoin payment address stored together with the pair. Only the owner of the payment address is able to modify or delete the pair, or transfer ownership to another address. When a new pair is created, a new payment address for the pair is created in the local wallet.

For service purposes we recommend using the following abbreviations:

Service abbreviationService description
dns*Built-in aggregated DNS record
sshSSH public key
gpgGNU PGP public key
kxRFC2230 public key
sslSSL Certificate
blsBLS digital signature pyblic key
Trusted Timestamp
swiftBank's branch info for SWIFT transfers
dpoDigital Proof of Ownership
magnet**BitTorrent magnet links

* This is a special service abbreviation used by Emercoin built-in DNS server.

** Service to store BitTorrent magnet links, useful to share files. Proposed format:

"name" : "magnet:Emercoin 0.3.2 for Linux - packed as tar.gz, original file from", 

"value" : "magnet:?xt=urn:btih:dff183bcac72a628fcac88ac1c85c239b806fd5e&dn=emercoin-0.3.2-linux.tar.gz"

You can find other possible service abbreviations for your applications among recommended DNS record types.

Managing names can be performed by the Emercoin wallet GUI, console commands in debug window, or by JSON API interface. Emercoin's operator set was inspired by NameCoin API, but it is different. Below is the list of the operators and parameters (parameters in square brackets [ ] are optional).

  • name_new <name> <value> <days>
    This operator creates a name->value pair and publishes it into the blockchain. The 3rd parameter <days> specifies lease time in days.

  • name_update <name> <value> <days> [<toaddress>]
    This operator:

    • updates the value for an existing name

    • adds lease days

    • transfers name ownership to another Emercoin address

  • name_delete <name>
    This operator deletes a name->value pait from the blockchain. There is no refund for unused lease time.

  • name_show <name>*
    This operator retrieves a name->value pair and transaction info for specified <name>.

  • name_list [<name>]*
    This operator lists all matching pairs belonging to the current wallet and those that were transferred in the past. If <name> is not specified, then it lists all names.

  • name_scan [<start-name>] [<max-returned>]*
    This operator lists all pairs existing in the blockchain. Parameter <start-name> is to skip all names in the list which are located above the specified name, useful to download the list in chunks.

  • sendtoname <name> <amount> [comment] [comment-to]*
    Send payment to the address associated with the specified <name>. Amount is rounded to cents. <comment> and <comment-to> will be stored in the local wallet, not in the blockchain. For instance, by using this operator you can send a donation to folding@homeproject.

  • name_filter [regexp] [<maxage=36000> [from=0] [nb=0] [stat]
    Not implemented yet, returns an empty list.

* parameters and behavior are the same as in NameCoin.

To create a name alias for payment address, just create a pair with a specified unique name and any value. A new associated payment address will be created in your wallet automatically. We recommend writing a text description as the value. All payments to that name will be sent to the appropriate payment address, to which the name is registered.

Value="Donation to support participants of folding@home project from Stanford University"

DNS subsystem

As mentioned above, Emercoin is able to store in its blockchain special name->value pairs containing DNS records. Because of the nature of distributed blockchains these records are completely decentralized and uncensored and cannot be altered, revoked or suspended by any authority. Only the record's owner can modify it or transfer it to another owner. The record's owner is specified by the payment address.

Technically, Emercoin DNS can support virtually any DNS-zone. However, for seamless integration into a standard DNS tree, and to prevent collisions with existing DNS-zones, we currently recommend creating Emercoin DNS records only in the zones: *.emc, *.coin, *.lib, *.bazar.

These DNS records could be easily retrieved from any Emercoin wallet, by abovementioned JSON RPC API, or by standard DNS protocol RFC1034, using built-in DNS server subsystem.

To activate this subsystem you can specify two optional parameters in the emercoin.conf config file, emcdns and emcdnsport:

emcdns=1 # Run DNS server. Default is 0 (don't run)
emcdnsport=NNN # Port for DNS, default is 5335

OpenNIC peering

Emercoin has entered a peering agreement with the OpenNIC community which will allow domains registered in Emercoin's blockchain to be accessible to all users of OpenNIC DNS. Once peering is in place, Emercoin domain zones will be accessible by changing your DNS resolver address to your nearest OpenNIC server. This can be achieved by visiting and following their guides for setting your DNS resolver. This is the most simple and convenient method to access Emercoin DNS zones. 

Integration into a regular DNS tree

To integrate Emercoin DNS server into a regular DNS tree, you can use full-service DNS or caching DNS. The standard Windows DNS-client is unable to perform this work, so you should use an additional DNS proxy server to do it. Below we will show some examples.

Single PC, Acrylic DNS proxy

Running the Emercoin wallet and everything else on a single PC is the most common case. For this we recommend to install the light weight Acrylic DNS proxy onto your PC. Because of integrating namezones, it will improve performance of your PC by resolving DNS requests more quickly with the local cache, decreasing latencies with browsing or any other Internet activity.

For installation and initial configuration in Windows, see guide at Acrylic website. After installation you should configure Acrylic to integrate Emercoin domain zones. A config file example is available online. To configure, you should forward all requests to Emercoin zones (*.emc,*.coin, *.lib, *.bazar) to the local Emercoin wallet, and all requests to other zones to the default DNS provider. This can be configured in the Acrylic config file as follows:

; Forward to primary (default) DNS server anything but EMC-zones
PrimaryServerAddress=DNS_of_your_provider or any public DNS, for example:

; Forward to EMC wallet requests for EMC-zones only

Alternately, you can download this AcrylicConfiguration.ini file, pre-configured to use OpenDNS as primary & secondary DNS-provider (for regular DNS-tree), and local Emercoin wallet as the ternary provider, for domain zones *.emc, *.coin, *.lib, *.bazar.

Default path to this file is: C:\Program Files (x86)\Acrylic DNS Proxy\

The Emercoin team also provides Acrylic package for download, already pre-configured for Emercoin DNS.

Single PC, BIND DNS proxy

Instead of installing a DNS proxy, you also have the option to install a full service DNS server. Fortunately, the full DNS server "BIND" is available for Windows, and is free. You can find many tutorials on the internet that show how to install BIND onto Windows. For example, see this manual.

After installation you should tell BIND to forward EMC-zones to the local Emercoin wallet by adding to the BIND configuration file named.conf as follows:

zone "emc" {
 type forward;
 forward only;
 forwarders { port 5335; // Local Emercoin wallet
zone "coin" {
 type forward;
 forward only;
 forwarders { port 5335; // Local Emercoin wallet
zone "lib" {
 type forward;
 forward only;
 forwarders { port 5335; // Local Emercoin wallet
zone "bazar" {
 type forward;
 forward only;
 forwarders { port 5335; // Local Emercoin wallet

Local network, BIND DNS proxy

If you have a server in your LAN, it is a good idea to install BIND onto your server, and in the PC network configuration point the primary DNS address to your BIND server. On the server you can run a headless Emercoin wallet to which BIND will forward requests to the appropriate zones. In this case configuration of BIND is exactly the same as above.

Also you can run the Emercoin wallet on any PC of your LAN, instead of on the BIND server. If so, you should change the forwarding address from to the IP address of that PC. Of course that PC should have a static LAN IP.

Local network, DNSMASQ proxy

Modern routers usually contain a built-in proxy DNS in their firmware. Usually this is DNSMASQ. And some firmware like DD-WRT (as well as other WRTs) allow you to configure a built-in DNS proxy. See DD-WRT configuration manual here.

In this case the wallet should be run on a PC with a static IP and DNSMASQ from the router would send DNS requests to that PC. Following are examples of the configuration lines needed to add into dnsmasq.conf. In this example the PC has the LAN IP address


Public Internet, direct gateway

The ability also exists to make a public gateway from a regular DNS tree into the distributed Emercoin DNS subsystem. In this case, you can lease any public domain or subdomain, and point the NS records for this domain to a machine that is running the Emercoin wallet with an active DNS server on port 53 (see in the next paragraph for how to define the port). Once you do this, all regular NS requests to that domain will be resolved by the DNS server, and answers will be retrieved from the NVS database in the Emercoin wallet.

For example, we have set up a new domain (Emercoin Gateway Network). When you click, your name request is resolved by the Emercoin wallet, and you go directly to emer.coin in the EMC-supported domain zone. Analogously, a link to our EMC<->USD exchange service also works:

Thus, if you register any name with Emercoin DNS, the name would be resolved by any Emercoin DNS gateway -, or any other. And your site site.coin will be available through any such gateway, by links such as, or

To configure a new domain as a public Emercoin DNS gateway, you need to specify DNS servers as authoritative for your zone (domain). For domain, we specified two Name Servers (NS), authoritative for this domain with our domain registrar:


You can check this info using whois.

On each of these nameservers runs an Emercoin wallet with an active DNS server which serves the gateway and local zone for DNS specific config parameters for the file emercoin.conf are as follows: 

If you are only running a DNS gateway for your local computer (with Acrylic or BIND) or for your LAN, it is enough to specify just a single der-box;outline: 0px"/>When a Visitor clicks this link, the program lnx_ref.php is invoked with the contract name parameter. The program extracts the contract from the local db, and parses it. It verifies the domain signature, and if OK - it forwards the Visitor to the URL specified in the contract. The URL must refer to lnx_pay.php, located on the Buyer's site. As a CGI-parameter, lnx_ref.php sends an invoice in the format:


For example:

On the Buyer's side, lnx_pay.php validates the contract, checks the balance, invoice, etc, and if everything is OK, it pays for this click. Pay attention to the last value - credit (-0.06). If this value is positive, this means that the Host trusts the payer, and does not require payment instantly. Credit can grow, during a continued relationship between this Host and Buyer. So, if both behave fairly then payments will be less frequent, and the payment amount per transaction is increased. 

The system deters new Hosts from behaving badly: when a new Host sends an invoice to the payer, they can request only ~5% of the CPC amount. Over time, as the Buyer becomes assured of honest Host behavior, the maximum invoice value goes up, closer to the contract CPC.

Context links

There is an interesting way to use context links on a CPC basis. As you see above, lnx_ref.php receives a single CGI-parameter - contract name. It doesn't matter where the link is placed. Thus, you can link to your instance of the lnx_ref.php site on a 3rd party blog, forum signature, or another website. Any Visitor clicking this link, will go to your referrer, and your referrer will charge Buyer for the click value.

Bot mitigation

It is necessary to prevent web crawlers (e.g. google) from following emcLNX links, and so hosts should take several precautions:

  • robots.txt

    Hosts should specify that search engines do not index the /emclnx directory in their website's robots.txt as follows:

    User-agent: * Disallow: /emclnx/

  • Robot trap

    To help defeat bots which ignore the robots.txt, hosts should also include a hidden link somewhere on their page, that leads to therobotrap.php that is included with the emcLNX archive. For example:

    <font size="1%"><a href="emclnx/robotrap.php">&#21;</a></font>

    The above link is not visible to humans since it contains only a non-printable symbol, but a bot will follow it, and their IP address will subsequently become banned by the emcLNX system. Please, don't click the link yourself, otherwise your IP will be banned.


  • Is there a website already which shows example advertisements?

    Yes! There is a test page on 
    And cryptor: (see gray ad line on top of page).

  • If a Buyer does not pay, what happens? Will the system prevent their advertisements from being shown?

    Yes. There are several fraud protection measures in the code. If buyer does not pay, the host simply does not show their ads. The buyer is identified by their domain, so they cannot easily create new domains to fool the system. Analogously, a "credit level" is maintained for hosts. If a host tries to "click out" ads, then the buyer will automatically stop paying this host.

  • What is the software license for the emcLNX php code?

    The code is, of course, open souce, and can be freely used by anyone - just like emcSSL, emcSSH and Emercoin itself.

  • My site is located behind CloudFlare or another service - how do I ensure payment requests are processed correctly?

    CloudFlare and similar services cache pages, and if a request comes to lnx_pay.php, they may return a cached value. As a result, the Buyer does not pay for referrals, and their link will become banned by other participants. 

    CloudFlare provides a solution here. According to this solution, you can exclude certain urls from CloudFlare's caching, and set up a rule to bypass the cache for emcLNX related links. e.g. **.php -> Bypass cache 

    Please take steps to avoid this problem, which can occur with any kind of server-side caching! 


You may also like

Scan QR Code & Share