First of all, I want to express my gratitude to habrakhabr for free provided corporate blog.

The article describes a tool that I developed for 3 years and, finally, laid out on github in the spring of 2014. With it, you can both make money and lose it. All risks will be considered, and the scheme of the instrument operation will be analyzed.
It is no longer necessary to put sources on your server; you can use other people's nodes just by entering their address in the address bar of the browser.
Introduction
The tool is a set of
source codes that are put on the user's computer and, according to the algorithm incorporated in them, interact with the computers of other users. The tool is called Dcoin. So that the article does not turn out too big, instead of explanations, I will give links to the wiki.
')
About Dcoin
Here is my previous article on Habré about Dcoin.
In Dcoin there are no central servers, just as in bitcoin each node stores a complete copy of
the database . The exchange of new data between nodes takes place using
blocks . Each block contains a hash of the previous block. Each transaction from the user contains a signature that proves that the transaction is from this user.

Unlike Bitcoin, in Dcoin there is not one, but
66 type of various transactions , thanks to which Dcoin can exist in the form in which it is presented.
Transaction Structure Example
Field | Description | The size |
---|
TYPE | Transaction type | 1 byte |
TIME | Transaction time | 4 bytes |
USER_ID | ID of the user who created the transaction | 5 bytes |
CURRENCY_ID | Currency ID | 1-3 bytes |
AMOUNT | The size of the promised amount | 1-12 bytes |
VIDEO_TYPE | youtube, vimeo, youku, null | 4-7 bytes |
VIDEO_URL_ID | ID from video hosting | 5-32 bytes |
PAYMENT_SYSTEMS_IDS | Payment systems id | 1-24 bytes |
SIGN | From 1 to 3 signatures (TYPE, TIME, USER_ID, CURRENCY_ID, AMOUNT, VIDEO_TYPE, VIDEO_URL_ID, PAYMENT_SYSTEMS_IDS) from USER_ID | 128 to 4096 bytes |
The header (TYPE, TIME, USER_ID) and SIGN are in all transactions, and all other fields change depending on the purpose of the transaction.
Block structure
Field | Description | The size |
---|
BLOCK_ID | Block sequence number | 4 bytes |
TIME | The time when the block was created | 4 bytes |
USER_ID | ID of the user who created the block | 5 bytes |
LEVEL | The level at which the miner was at the time of block creation | 2 bytes |
SIGN | Signature from (TYPE, BLOCK_ID, PREV_BLOCK_HASH, TIME, USER_ID, LEVEL, MRKL_ROOT) made using the node-key | from 128 bytes to 512 bytes |
TRANSACTIONS | Transaction list | Up to 3Mb |
How is determined the one who will generate and write in the blockchain the next blockAll
miners are divided into levels. Miner, which is at the 0th level, i.e. has the right to generate a
block and add it to the
blockchain before anyone else, is defined like this:
$ctx = hexdec(substr($hash, 0, 6)); $hi = $ctx / 127773; $lo = $ctx % 127773; $x = 16807 * $lo - 2836 * $hi; if ($x <= 0) $x += 0x7fffffff; $leve_0_miner_id = (($ctx = $x) % ($max_miner_id + 1)); $leve_0_miner_id = ($leve_0_miner_id==0)?1:$leve_0_miner_id;
Where $ hash is sha256 (sha256 (user_id, block_id, prev_head_hash))), $ max_miner_id is the maximum miner_id from the
miners table
If, for example, miner_id 12689 is at the 0th level, then at the 1st level there will be miners with ID 12690-12691 (2), at the 2nd level - 12692-126995 (4), etc.
If the miner at the 0th level could not generate the block, then the work of the nodes of the 1st level, if they could not, then the 2nd, etc. In this case, there should be delays between the levels, which are defined in the variable
sleep . Those. if sleep-> generator [0] = 120, then miners from level 1 will not be able to add their blocks to the blockchain until 120 seconds have passed.
Between miners of the same level, a block with the smallest hash is searched, and the found block is written into the blockchain.
51% attackLevels are determined based on a block header, in which there is no value that can be manipulated. This means that it is impossible to make it so that at level 0 there is a specific miner_id. The 51% attack is possible if the attacker seizes 51% of the
miners' private keys. If there are 100,000 miners in the DC network, then the attacker will need to gain control of more than 50,000 private keys.
A more detailed description of the work of Dcoin can be found in the
wiki .
In Dcoin
77 types of currencies . But for convenience, the article will only mention DUSD.
Comparing risks in Dcoin with the risks of playing on the cryptocurrency exchange
The instrument closest to Dcoin in terms of riskiness is the cryptocurrency exchange, therefore, I consider their comparison to be quite appropriate.
The possibility of stealing customer money by the owner of the service
The probability of losing your money on the stock exchange is
quite high .
In Dcoin exchange is not needed, because All transactions occur
between users directly . Although there is a risk here too, it will be discussed later, in the section “Unfair miner”.
The word miner itself (translated as a miner) is probably not very suitable for designating a user with elevated privileges . But historically, miner is used.The possibility of bugs
The Bitcoin release was in January 2009. Obviously, the bitcoin engine has been studied more thoroughly, and the likelihood that there is a bug is pretty low.
The release of Dcoin was in April 2014, bugs are not excluded.
The ability to predict the course
It is possible to predict with high accuracy where the exchange rate will go on the exchange, only having insider information related to the currency traded there.
Dcoin has a constant increase in the number of coins.
The course is always 1: 1 . But there is a risk that the trigger will work and the process of
reducing the volume of coins will start.
How much can you earn?
Hundreds percent per annum.
How can you lose money while reducing the amount of coins
The graph shows one of the possible scenariosHow to get real data of total DUSD and promised amountsDUSD:
SELECT SUM(`tdc_amount`) + (SELECT SUM(`amount`) FROM `wallets` WHERE `currency_id` = 72) FROM `promised_amount` WHERE `currency_id` = 72
Promised USD:
SELECT sum(`amount`) FROM `wallets` WHERE `currency_id` = 72
The vertical axis displays the system-wide volume, let it be thousand $. On the horizontal axis - months.
The graph shows that on the value of 1200 the amount of the
promised amounts of USD equaled the volume of DUSD. At this moment (more precisely, then, when the volume of the promised sums became less than the volume of DUSD),
the trigger is triggered and the DUSD is reduced by 10%. If the situation does not change, after 2 days there is another reduction of 10%, and so on until the amount of the promised sums does not exceed the volume of DUSD. On the graph, the reduction stopped only when the volume of DUSD decreased by 2 times.
Those who
gave their cash for DUSD in the 8th month, in the 9th month received a loss of -50%. It remains for them to either wait until the DUSD rises again, or to fix the loss and leave the game.
Well, those who bought DUSD, for example, in the 3rd month, and sold before the onset of reduction, received hundreds of% of the profits.
What can provoke the intersection of the red line with the blue?
- Too many decided to get rid of DUSD
If this leads to a drop in the exchange rate on the stock exchange, then the number of coins in Dcoin is reduced.
- Too much growth in DUSD.
Theoretically, this can be controlled by reducing the% growth of DUSD. But in practice this is not so easy, because % growth is set by
voting miners.
About reduction
As there is a process of reduction, we figured out. Now consider what happens when this process begins.
New requests for exchanging DUSD for cash reduce the amount promised. With a reduction in the volume of DUSD, there will be few people willing to give their cash for DUSD.
Imagine that you see the following statistics:
DUSD volume | 950 thousand |
Volume of promised amounts | 900 thousand |
Exchange requests completed | 6% |
Your balance: | 100 DUSD |
The reduction in the next 48 hours is likely to be. To satisfy the incoming requests, you most likely will not.
Next, you need to decide whether to send the request to another miner himself in order to exchange your DUSD for $. At the same time, if you look at the system-wide statistics, the probability that he will execute it is only 6%. And the most important thing: if you send such a request, you will aggravate the situation throughout the system, and the reduction will continue, because Unfulfilled requests for the exchange of promised amounts reduce the total amount of promised amounts in the system. When the majority ceases to send requests for the exchange of their DUSD on $, the reduction will stop. Those who refuse to change their $ to DUSD can
update their promised amounts once every 2 weeks, and they will again be taken into account in the system-wide statistics.
How else can you lose money in Dcoin
Suppose you are registered, become a miner, added the promised amount of $ 100, you have already come up with some amount of coins, perhaps you have already exchanged them for cash with some miner. While the risks were zero.
Fake request
And suddenly you receive a request, according to which, you must give $ 100 for 100 DUSD.
If you did not set the source code to yourself, but used the
pool , then there is a risk that this is a fake request that the admin pool has made. To make sure that the request is real, you need to put the source code on your computer and get the same request based on the data from your
local database .
Bots
There is a risk that in some way millions of mining miners got into Dcoin, who minted the coins and now withdraw them. It is necessary to exclude this option.
You can simply read the independent sources, whether there are any reports that something is wrong with Dcoin. Or you can conduct your investigation.
Here you can download the latest archive of photos and videos of all miners. Of course, it will be more reliable to compile such an archive on your own by
tracing the miners_data table and downloading photos and videos of all the miners. The existing archive can either be selectively checked, or run through any software that is looking for the same person. Why it is impossible to fake a video, you can read
here .
Unscrupulous miner
There is a risk that giving $ 100, you will not get 100 DUSD. Those. You received a request, contacted the sender of the request, he indicated the account number, for example, in Yandex money, you sent him $ 100, and he received the money and stopped responding.
The most reliable way is to
exchange cash for dcoin in person. For this, Dcoin uses one-time codes. You give money, and in return receive a code whose hash you already know. Thus, even if there is no Internet in the meeting place, you can easily calculate sha256 (sha256 (“code”)), and if it converges with your hash, then everything is fine, and when the Internet appears, you just need to specify the code in your the office.
But if the amount is small and the miner does not have negative reviews, then you can take a chance and conduct the transaction without a personal meeting.
More about hundreds of percent per annum
There are 2 types of accounts:
Miner and
user .
Most of the time, the number of coins in all grows.
Miners by voting
set % for miners and for users. For miners it can be from 0 to 1000% / year, for users - from 0 to 500% / year.
Miners can create coins from nothing. Those. The miner can create, for example, 100 DUSD, without spending a single cent. To do this, the miner must
promise to give some amount of $ for DUSD. The maximum amount is $ 1000. Miner% refers specifically to this amount. Those. at 1000% per annum from $ 100 a month will be created 22 DUSD. When the miner wants to exchange running DUSDs for $, he sends a request to the nearest miner, who has the required amount promised. When the exchange
rate is always 1: 1 .
You can have an unlimited number of user accounts, they are completely anonymous, they have no limits, but there is no possibility to add the promised amount, i.e. create coins from nothing. The user can buy DUSD on the stock exchange (more precisely, for the time being it cannot, because dcoin is not yet on the exchanges). DUSD, which lie with users, grow from 0 to 500% per year.
Coins are
reduced the same way as miners and users.
Forecasts
Due to the fact that all data is stored in the blockchain, anyone can create their service with schedules, statistics and, based on them, make their own forecasts when the
volume of coins will
decrease .
Dcoin in e-commerce
If Dcoin becomes popular and its coins can be bought and sold on stock exchanges, then for sellers of goods and services, Dcoin reception will differ little from bitcoin reception: received payment, sold at the exchange, received cash.
Monetization
Temporarily not active. In the future, the commission will be taken from those coins that are transferred from the promised amount to the wallet. Premine is not.
Conclusion
Do not consider Dcoin as a tool for serious investment. It should take more time and should gather more statistics. But for experiments with very small amounts, Dcoin has already matured.
To try