Posted in

The Wallet Software of Namecoin in Blockchain

 

Disclaimer – This article is an excerpt from the book Mastering Blockchain, Third Edition by Imran Bashir, the ultimate blockchain guide design to equip you with the knowledge of distributed ledgers, consensus protocols, smart contracts, DApps, cryptocurrencies, Ethereum, and more.

Namecoin is the first fork of the Bitcoin source code. The key idea behind Namecoin is not to produce an altcoin but instead to provide improved decentralization, censorship resistance, privacy, security, and faster decentralized naming. Decentralized naming services are intended to respond to inherent limitations such as slowness and centralized control in the traditional Domain Name System (DNS) protocols used on the internet. Namecoin is also the first solution to Zooko’s triangle.

Namecoin is used to essentially provide a service to register a key-value pair. One major use case of Namecoin is that it can provide a decentralized Transport Layer Security (TLS) certificate validation mechanism, driven by a blockchain-based distributed and decentralized consensus.

It is based on the same technology introduced with Bitcoin, but with its own blockchain and wallet software.

The source code for the Namecoin core is available at https:// github.com/namecoin/namecoin-core.

In summary, Namecoin provides the following three services:

1. Secure storage and transfer of names (keys)
2. Attachment of some value to the names by attaching up to 520 bytes of data
3. Production of a digital currency (Namecoin)

Namecoin also, for the first time, introduced merged mining, which allows a miner to mine on more than one chain simultaneously. The idea is simple but very effective: miners create a Namecoin block and produce a hash of that block. Then, the hash is added to a Bitcoin block and miners solve that block at equal to or greater than the Namecoin block difficulty to prove that enough work has been contributed toward solving the Namecoin block.

The coinbase transaction is used to include the hash of the transactions from Namecoin (or any other altcoin if you’ve merged mining with that coin). The mining task is to solve Bitcoin blocks whose scriptSig coinbase contains a hash pointer to Namecoin (or any other altcoin) block. This is shown in the following diagram:

 

Merged mining visualization

 If a miner manages to solve a hash at the Bitcoin blockchain difficulty level, the Bitcoin block is built and becomes part of the Bitcoin network. In this case, the Namecoin hash is ignored by the Bitcoin blockchain. On the other hand, if a miner solves a block at the Namecoin blockchain difficulty level, a new block is created in the Namecoin blockchain. The core benefit of this scheme is that all the computational power spent by the miners contributes toward securing both Namecoin and Bitcoin.

Obtaining Namecoin

Even though Namecoin can be mined independently, they are usually mined as part of Bitcoin mining by utilizing the merged mining technique, as explained earlier. This way, Namecoin can be mined as a by-product of Bitcoin mining. Solo mining is no longer profitable, as is evident from the following difficulty graph; instead, it is recommended to use merged mining, use a mining pool, or even use a cryptocurrency exchange to buy Namecoin:

 

Namecoin difficulty, as shown at https://bitinfocharts.com/comparison/diffculty-nmc.html (since October 2016)(since October 2016)

Various mining pools also offer the option of merged mining. This allows a miner to mine primarily Bitcoin but also, as a result, earn Namecoin too.

Another method that can be used to quickly get some Namecoins is to swap your existing coins with Namecoins; for example, if you already have some bitcoins or another cryptocurrency that can be used to exchange with Namecoin.

An online service, https://shapeshift.io/, is available that provides this service. This service allows conversion from one cryptocurrency to another using a simple user-friendly interface.

 For example, paying BTC to receive Namecoin is done as follows:

1. First, the deposit coin is selected, which in this case is Bitcoin, and the coin to be received is selected, which is Namecoin in this case. In the top edit box, the Namecoin address where you want to receive the exchanged Namecoin is entered. In the second edit box, at the bottom, the Bitcoin refund address is entered, where the coins will be returned to in case the transaction fails for any reason.

2. The exchange rate and miner fee are calculated instantly as soon as the deposit and exchange currency are chosen. The exchange rate is driven by the market conditions, whereas the miner fee is calculated algorithmically based on the target currency chosen and what the target network’s miner would charge:

Bitcoin to Namecoin exchange

3. Once Start Transaction is clicked, the transaction starts and instructs the user to send the bitcoin to a specific Bitcoin address. When the user sends the required amount, the conversion process starts, as shown in the following screenshot.

This whole process takes a few minutes:

Notification of Namecoin delivery

The preceding screenshot shows that after sending the deposit, the exchange occurs and finally an All Done! message is displayed, indicating that the exchange has been successful.

4. A few other order details are displayed on the page, such as what currency was deposited and what was received after the exchange. In this case, it is a Bitcoin to Namecoin exchange. It’s also worth noting that relevant addresses are also displayed under each coin icon. There are a few other options, such as Email receipt, which can be invoked to receive a receipt of the transaction via email. When the process completes, the transactions can be viewed in the Namecoin wallet, as shown here:

Namecoin wallet

5. It may take some time (usually around 1 hour) to confirm the transactions; until that time, it is not possible to use the Namecoins to manage names. However, when Namecoins are available in the wallet, the Manage Names option can be used to generate Namecoin records.

Generating Namecoin Records

Namecoin records are in the form of key-value pairs. A name is a lowercase string of the form d/ examplename, whereas a value is a case-sensitive, UTF-8 encoded JSON object that’s a maximum of 520 bytes.

The name should be RFC1035 (https://tools.ietf.org/html/rfc1035) compliant.

A general Namecoin name can be an arbitrary binary string up to 255 bytes long with 1,024 bits of associated identifying information. A record on a Namecoin chain is only valid for around 200 days or 36,000 blocks, after which it needs to be renewed. Namecoin also introduced .bit top-level domains, which can be registered using Namecoin and can be browsed using specialized Namecoin-enabled resolvers. Namecoin wallet software, as shown in the following screenshot, can be used to register .bit domain names:

1. The name is entered and, after the Submit button is pressed, it will ask for configuration information, such as DNS, IP, or identity:

 

Namecoin wallet: domain name configuration

2. As shown in the following screenshot, masteringblockchain will register as masteringblockchain.bit on the Namecoin blockchain:


Namecoin wallet: showing the registered name

In this article we saw a detailed introduction to NameCoin, the first fork of the Bitcoin source code. 


About

Imran Bashir has an M.Sc. in Information Security from Royal Holloway, University of London, and has a background in software development, solution architecture, infrastructure management, and IT service management. He is also a member of the Institute of Electrical and Electronics Engineers (IEEE) and the British Computer Society (BCS).  

Passionate Content Creator, Senior Content Marketing Editor at Packt Expert Network

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.