Introduction
The Blockchain Platform Emer has been around for three years, and a number of distributed services are based on it. It is of the greatest interest in the business applications environment (b2b), as well as IT-professionals, mainly telecommunication workers and security personnel.
It was originally designed as a stable platform for industrial applications, that is, based on considerations of "sound conservatism."
Mechanisms have been introduced into the core of the system to
stabilize the network and increase its efficiency . Also for security reasons, a ban was imposed on the execution of arbitrary program code downloaded from outside, and the classic
Satoshi script , incomplete in Turing, was left. However, the current limited functionality, without compromising security, allows you to create and operate blockchain services, examples of which are given below.
The main idea of ​​the Emerging Platform: Many services on one blockchain. In other words - install a single blockchain, and get a package of services, as well as the ability to easily add your services. A number of companies, such as
Deloitte and
I-teco, have evaluated the capabilities of the platform, and are already using it to solve their problems. This article will tell you how to access the Emer blockchain and use both existing services and implement your own.
Emer network and its nodes
The Emer network structure is similar to that of the vast majority of other cryptocurrencies, such as Bitcoin, Litecoin, and the like, and is a peer-to-peer peer-to-peer network consisting of nodes (nodes). Emergency nodes communicate with each other via TCP / IP, port 6661. During operation, the nodes exchange information about other available nodes, and thus, new p2p connections appear in the network. The connection graph has high redundancy, that is, there are many possible ways to transfer messages between arbitrary nodes, and new transactions and blocks are distributed throughout the network, like rumors in a big city. And if some way for some reason becomes unavailable, then most likely, the data will find a way around. This redundancy makes the network reliable, although it consists of unreliable elements, since the nodes do not always have 100% availability.
')
To gain access to the Emergency network, you need to install a wallet program (node), and just launch it. To do this, you need to either download and install a
binary program , or compile most of the source codes available on
github .
The program comes in two versions:
- Full version, with GUI: emercoin-qt
- Daemon without GUI: emercoind
After downloading and installation, the program can immediately run. The launched program (node) will connect itself with other active nodes (peers), and synchronize the blockchain, and at the first start, download it from peers. After the initial synchronization, which takes several hours, the node is active and ready to go. At the first start, the program creates a wallet.dat wallet file, which is located in the same directory as the blockchain and other files (program data directory). Depending on the OS used, these files are located in:
- Windows: C: \ Users \ USERNAME \ AppData \ Roaming \ Emercoin
- MacOS: $ HOME / Library / Application Support / Emercoin
- Linux / FreeBSD: $ HOME / .emercoin
The file wallet.dat contains the private keys of your wallet, that is, your balance. If you lose this file, you will lose your money too. Therefore, we strongly recommend regularly making a backup of this file, especially after creating new names and sending money, that is, after actions that create new private keys and addresses.
When installing the emercoind daemon on packages from Linux, a special pseudo-user “emc: emc” is created for this daemon, whose home directory is in / var / lib / emc, and the program is installed in / usr / bin /. The emercoin-cli program, which is the command line interface to the daemon, is also installed there. The program has access rights such that it can be run by any user of the system that belongs to the “emc” group. By controlling the list of this group, you can control the access of non-privileged users to the Emer node.
Interface to the node
The launched program can be controlled either via GUI (if it is emercoin-qt) or via HTTP JSON API (both options: emercoind, emercoin-qt).
In the QT version, you can open the debug console in the Help / Debug Window / Console section, and enter console commands. For example, the “getinfo” command returns information on the node and purse balance (of course, the balance in the new wallet is zero). The “help” command displays a list of available commands. The “help getinfo” command will print detailed information on the getinfo command. Likewise, help works for other commands.
Of greatest interest is the HTTP JSON RPC API, through which you can easily connect the Emer node to other systems, and thereby get an interface to the blockchain.
The interface parameters are managed by the following lines of the emercoin.conf configuration file located in the program data directory:
listen=1 # API server=1 # API- rpcallowip=127.0.0.1 # rpcport=6662 # HTTP JSON RPC API rpcuser=emccoinrpc # username API rpcpassword=secret_password # API
In the standard daemon linux distribution, the emercoin.conf file with the corresponding initial content is created by the installation script. In the case of a manual installation of a QT program for your username, or on a Windows system, this file must be created manually, and the corresponding parameters should be entered there. In Windows, be careful - by default, Windows hides file extensions, and if in this mode you try to create emercoin.conf, then Windows will create an emercoin.conf.txt for you, which the program will not read. Make sure that your extensions are not hidden, and the file is really called emercoin.conf.
If you created the emercoin.conf file while the program is running, restart it.
Command line
In the case of a daemon, the emercoin-cli program is used to control it, which has the abbreviated symlink “emc”. Thus, in Linux / BSD, type in the command line:
$ emc getinfoAnd you will see the answer from the demon node. Other commands work similarly. For example, enter:
$ emc helpAnd you will see a complete list of commands. Both the commands and the emercoin-cli parameters correspond to those from the QT debugging console.
Access from external programs
For the time being we managed without any programming. And then we will do without him in terms of the blockchain itself. Still, when integrating Emer's blockchain as a component of other systems, some programming
outside the blockchain is still necessary. The reliability of these programs is not made of super-high demands, because these programs are on the side of the application software and not in the blockchain, and therefore can always be corrected or replaced if necessary.
Access is performed by a standard HTTP request to the port specified in the configuration file. The request sends POST JSON, respectively, the response also receives JSON containing the requested information, or the error code. The interaction scheme resembles requests and responses to a SQL server.
The interface is fully compatible with the Bitcoin JSON RPC API, and you can use all the Bitcoin documentation as a guide. For example, this
document demonstrates the use of an interface from various programming languages ​​— true, using the corresponding interface libraries.
But those libraries are not particularly needed, and requests can be submitted directly, "as is." The example below demonstrates the use of the curl program to submit such a request (send everything in one line):
curl –user emccoinrpc:secret_password --data-binary \ '{"jsonrpc": "1.0", "id":"test", "method": "getinfo", "params": [] }' \ -H 'content-type: text/plain;' http:
In this example, the getinfo command and an empty array of parameters are sent. In commands that require parameters, they must be entered into the params array.
Below is a procedure in PHP that, without any libraries, makes a direct request to the Emer-node. The first parameter is a command, the second is an array of arguments:
$emcCONNECT = “http://emccoinrpc:secret_password@127.0.0.1:6662/”; // Performs request to EMC wallet function Req($cmd, $params) { global $emcCONNECT; // Prepares the request $request = json_encode(array( 'method' => $cmd, 'params' => $params, 'id' => '1' )); // Prepare and performs the HTTP POST $opts = array ('http' => array ( 'method' => 'POST', 'header' => 'Content-type: application/json', 'content' => $request )); $fp = fopen($emcCONNECT, 'rb', false, stream_context_create($opts)); if(!$fp) throw new Exception('emcssl_NVS_req: Unable to connect to EMC-wallet'); $rc = json_decode(stream_get_contents($fp), true); $er = $rc['error']; if(!is_null($er)) throw new Exception('emcssl_NVS_req: Response error: ' . $er); return $rc['result']; } // Req
An example of using this procedure can be found in the
emcvote blockchain voting subsystem. Let's clarify that the second argument of the function, “params”, is not an associative JSON array, but a regular PHP array created by the built-in array () function. If the command does not require parameters, then it must pass an empty array by calling for example:
$ reply = Req ("getinfo", array ());A similar interface for the “C” language using the curl library can be taken from the emcssh source code:
github.com/emercoin/emcsshEmergency Extensions
As mentioned above, Emer is compatible with Bitcoin in the recruitment of commands and their arguments, the interface of which is de facto the standard of Fintech technologies, and everything that works with Bitcoin will work with Emer without problems too.
However, Emer has a strong difference from Bitcoin. Emer is in the Emerging blockchain - NVS - Name-Value Storage. This is a universal storage of arbitrary data in the blockchain. Storage is made in the form of key-value pairs, where the key is a search key that is unique within the network, and the value is an arbitrary array of bytes. Data size - up to 20kb, search key size up to 512 bytes.
Access to this repository is provided by an extended set of API commands that form the level of service representation (No. 6) in the
seven-level OSI model .
Accordingly, access to NVS is in the GUI, in the “Manage Names” tab. A list of API commands and examples of using NVS
are provided in the project’s
wiki reference .
NVS provides multiple services on a single blockchain. The recommendation is to use the service prefix, which is separated by a colon from the subsequent search key. An example of such a key with the service indication (EmerDNS): dns: flibusta.lib
Even with a zero balance on your wallet, you can extract records and their history. For example, submit the following commands to the console (or via the API):
name_show dns:flibusta.lib name_history dns:flibusta.lib
And you will see the current DNS record Flibusta, and the change history of this record. To make new entries or modify existing ones in your wallet, you need to have a balance in several EMCs to purchase a service — add something to the blockchain.
Specify that the entry modification implies the creation of a new value for the same search key, the old value also remains in the blockchain forever and is available through the name_history command. Creating the same records is done with the name_new command, and the update is done with the name_update. The recording becomes available to other nodes of the network after the first confirmation (block closure), which occurs approximately once every 10 minutes.
Service prefixes are arbitrary, the table in the wiki gives only recommendations, what prefixes and what to use. You can create your services, and assign them your prefixes, which you yourself will process. But, naturally, the current handlers of various services are already configured to use the appropriate prefixes. So do not be surprised if you create your new service prefix, and current services will ignore it.
NVS-records made by anyone on the blockchain can be seen on the
Emergency Block browser website , in the NVS section. Also on this site you can see the structure and history of the blocks. This is a very good debugging tool for observing, “what did we add to the blockchain?”
The network already has several non-monetary services in operation, we give examples of the most popular ones:
- EmerDNS - Decentralized uncensored domain name system.
- EmerSSH - Worldwide public key infrastructure.
- EmerSSL - Decentralized password-free authorization system.
- InfoCard is a distributed electronic business card system. Works in conjunction with EmerSSL, but can be used separately. Technical description of the EmerSSL + InfoCard bundle . Test site for this system, with code examples.
Also in the process of commissioning are the services
emcDPO and ENUMER.
There is also a mechanism for attracting funding for projects through IPO on the Emer block. A successful example of such an IPO produced a farm Kolionovo, the results of which experience was written instruction "
Blockchain for farmers ."
All of these services use NVS as a distributed trusted repository of critical information — domain records, public encryption keys, certificate hashes, and similar trust-building elements between distributed agents. Note that, from the blockchain-system side, the recordings in NVS are passive, that is, even if a program is placed there, the blockchain-system itself will not execute it. And if someone needs to execute it - he can do it not in the general blockchain, but on his side, taking the risks of executing an arbitrary Turing-compatible code.
For more information, visit the project
wiki .
Or
contact the developers .