Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Basic Concepts of Monero

DZone's Guide to

Basic Concepts of Monero

We give a basic, but low-level, introduction into the world of cryptocurrencies by taking a look at Monero. We'll see how it works, a little of the code that makes it go, and more.

· Security Zone
Free Resource

Discover an in-depth knowledge about the different kinds of iOS hacking tools and techniques with the free iOS Hacking Guide from Security Innovation.

Several hundred cryptocurrencies are out there today. Many of them exist for a few months without any unique idea. But there are cryptocurrencies which promise great prospects. One of them is Monero (XMR). Monero (from Esperanto for "coin") is an open-source cryptocurrency, and is intended for anonymous cash settlements. Monero is based on the CryptoNote protocol, which allows you to make transactions with a very high degree of anonymity via obfuscation of transactions (more detail how on this happens will be given below) and it works exclusively on Proof-of-Work.

At the moment of writing this article, capitalization of Monero is $1,376,648,631 USD, which is #9 among all cryptocurrencies. One of the main reasons for the growth of Monero was the addition of Monero to the trading platforms of Darknet Oasis and AlfaBay. Entering on the huge market, albeit with a negative reputation, produced a significant increase in the price of Monero. A little disclaimer - this article is not about "Is anonymity good or bad?" or  the philosophy of "how DApps change the world." It's about "Basic concepts of Monero." So let's start.

Ring Signatures

Ring signatures are used to hide the real inputs of transactions in such a way that it is impossible to tell what the story behind each output of this transaction is in the chain of blocks. A ring signature is an electronic signature that allows one of the group members to sign a message on behalf of the entire group, and it will not be known for sure which of the group members signed it.

Image title

                                                        Picture 1 - Ring signature schema

The curious reader can consider the following ring signature code in Python from this wiki:

import os, hashlib, random, Crypto.PublicKey.RSA

class ring:
    def __init__(self, k, L=1024):
        self.k = k
        self.l = L
        self.n = len(k)
        self.q = 1 << (L - 1)

    def sign(self, m, z):
        self.permut(m)
        s = [None] * self.n
        u = random.randint(0, self.q)
        c = v = self.E(u) 
        for i in (range(z+1, self.n) + range(z)):
            s[i] = random.randint(0, self.q)
            e = self.g(s[i], self.k[i].e, self.k[i].n)
            v = self.E(v^e) 
            if (i+1) % self.n == 0:
                c = v
        s[z] = self.g(v^u, self.k[z].d, self.k[z].n)
        return [c] + s

    def verify(self, m, X):
        self.permut(m)
        def _f(i):
            return self.g(X[i+1], self.k[i].e, self.k[i].n)
        y = map(_f, range(len(X)-1))
        def _g(x, i):
            return self.E(x^y[i])
        r = reduce(_g, range(self.n), X[0])
        return r == X[0]

    def permut(self, m):
        self.p = int(hashlib.sha1('%s' % m).hexdigest(),16)

    def E(self, x): 
        msg = '%s%s' % (x, self.p)
        return int(hashlib.sha1(msg).hexdigest(), 16)

    def g(self, x, e, n):
        q, r = divmod(x, n)
        if ((q + 1) * n) <= ((1 << self.l) - 1):
            rslt = q * n + pow(r, e, n)
        else:
            rslt = x
        return rslt

Stealth Addresses

Stealth addresses are the method by which the sender can receive the public address of the recipient and convert it into a one-time address in such a way that it's publicly impossible to establish a connection with any other address. The originator of the initial public address and only the recipient can receive a secret key associated with a one-time address. Stealth addresses rely on the Elliptic curve Diffie-Hellman algorithm to let users accept payments on addresses they never generated. You have one public address that you can transfer to anyone, not allowing observers to know anything about the transaction history or the balance of this address. The Monero address system uses two private keys: a view key and a spend key (key for waste, you sign the transaction with it). The view key is used to search for incoming payments in the chain of blocks.

RingCT

RingCT allows users to hide transaction amounts. RingCT introduces an improved version of ring signatures called A Multi-layered Linkable Spontaneous Anonymous Group signature. RingCT was activated on the Monero network on January 9, 2016. Initially, RingCT was optional, but after the planned update, the RingCT technology in Monero is mandatory, without any way to circumvent it.

Kovri — I2P

The Kovri project aims to implement an I2P router, which will eventually allow Monero users to hide their IP addresses. Kovri is currently in heavy, active development and not yet integrated with Monero. When Kovri is integrated into your Monero node, your transactions will be more secure than ever before. Kovri will protect you and Monero from node partitioning attacks and metadata leakage.

Fungibility

Monero is fungible, meaning one Monero will always be equal to another. This means you won't have to worry about Monero blacklisted by exchanges or vendors.

Monero is a revolutionary technology in the world of distributed applications, it uses reliable time-tested cryptography and, because of its reliability, will be in demand.

Learn about the importance of a strong culture of cybersecurity, and examine key activities for building – or improving – that culture within your organization.

Topics:
cryptocurrency ,block chain ,security ,monero

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}