How to protect your product against conterfeiting with EMERCOIN blockchain

in emercoin •  7 years ago 

In this article we will show practical implication of emercoin blockchain app DPO. You could find theory and technology description in our previous article.

Before we begin, be sure to check our BTC Miamy meetup group. Will be glad to see your participation by any means.

EMC DPO Deployment on Your Server

In this section, we shall learn how to deploy and configure EMC DPO on your server, powered by the OS Ubuntu 16.04 LTS (amd64). It is also compatible with the following other operating systems: Ubuntu 14.04 LTS (amd64), Debian 8 (amd64, armhf), RHEL/CentOS 7 (x86_64).

1. Installing the Emercoind service

Let’s use the standard apps to install Emercoind:

apt-key adv — keyserver keyserver.ubuntu.com — recv B58C58F4 add-apt-repository ‘deb http://download.emercoin.com/ubuntu xenial emercoin’ apt update && apt -y install emercoin

Make sure that emercoind is installed, working, and starting to download the blockchain:

emc getinfo { “version”: 60000, “protocolversion”: 70002, “walletversion”: 60000, “balance”: 1.090000, “newmint”: 0.000000, “stake”: 0.000000, “blocks”: 216541, “moneysupply”: 39554119.651462, “timeoffset”: 0, “connections”: 8, “proxy”: “”, “ip”: “0.0.0.0”, “difficulty”: 206196413.012576, “testnet”: false, “keypoololdest”: 1487850355, “keypoolsize”: 501, “mintonly”: false, “unlocked_until”: 0, “paytxfee”: 0.010000, “relayfee”: 0.000100, }

Wait until the blockchain is downloaded. Then send some coins to the wallet (at the rate of 0.12 EMC approx. for one blockchain data creation/refreshment operation).

A new wallet address can be created by running the following command:

emc getnewaddress

2. Creating NVS entries

It is necessary to create entries in the blockchain’s NVS for the manufacturer (vendor) and for the products themselves (separate entry for each product unit).

2.1. Creating the main entry of the Vendor

Let’s define the input data.

  • The manufacturer (vendor) be referred as “Your Company”
  • For the vendor logo, click this link: emercoin.com/images/main-logo.png
  • We would also like to create an additional field called ‘Description’, and enter the following data there: ‘The description of Your Company’
  • The entry will be active for 730 days

After that, such an entry can be created by running the following command:

emc name_new “dpo:Your Company” “Name=Your Company Description=The description of your Company Logo=http://emercoin.com/images/main-logo.png" 730

Once this command is executed, we get a Transaction ID code, if everything has gone successfully.

Wait until this entry has made it into the blockchain. To do this, run the command:

emc name_show “dpo:Your Company”

Once the entry is in the blockchain, we should see something like this:

{ “name”: “dpo:Your Company”, “value”: “Name=Your Company\nDescription=The description of your Company\nLogo=emercoin.com/images/main-logo.png", “txid”: “b11384b162e2d3d2900d10e942c6ae3aa8bca94801dc119677685d68d35c9712”, “address”: “ERGPQNKpmJNaXeaq6ZDYwgghQDMBQGVema”, “expires_in”: 127749, “expires_at”: 343616, “time”: 1487856529 }

Remember the ‘address’ field data — this is the main address from which all subsequent product entries will be derived.

We also have to devise a ‘salt’, that is, add an arbitrary set of symbols to user passwords to make it harder for phishers to bust passwords. As an example, we might form the following password: johNah2koosie3iG.

2.2. Creating Product Entries

Define the input data.

  • The product be called: “Name of your product”
  • For the photo of the product, click this link: www.blockchainengine.org/wp-content/uploads/2016/04/Smart4.png
  • We would also create an additional field called ‘Description’, and enter the following data there: ‘The description of your product’
  • For starters, we would like to create 100 serial numbers of the product: from SN-55001 to SN-55100
  • Each product entry will be active for 730 days

After that, such entries can be created by executing the following script (having first installed php-cli and pwgen):

Source: https://github.com/snvakula/svtools/blob/master/emcdpo-genbulk.sh
#!/bin/bash URL=”http://emcdpo.info/dpo" SALT=”johNah2koosie3iG” ADDRESS=”ERGPQNKpmJNaXeaq6ZDYwgghQDMBQGVema” VENDOR=”Your Company” ITEM=”Name of your product” PHOTO=”www.blockchainengine.org/wp-content/uploads/2016/04/Smart4.png" OTHERS=”Description=The description of your product” PREFIX=”SN-” FIRST=55001 LAST=55100 DAYS=730 while [ $FIRST -le $LAST ]; do echo “Creating serial $PREFIX$FIRST:” SECRET=$(pwgen 8 1) OTP=$(php -r “echo(hash(‘sha256’, md5(‘$SECRET’.’$SALT’)));”) echo “ * SECRET: $SECRET” echo “ * OTP: $OTP” echo “ * Public URL: $URL/key/$PREFIX$FIRST” echo “ * Private URL: $URL/key/$PREFIX$FIRST?otp=$SECRET” COUNT=0 while emc name_show “dpo:$VENDOR:$PREFIX$FIRST:$COUNT” >/dev/null 2>&1 do let COUNT=COUNT+1 done echo “ * NVS Record: dpo:$VENDOR:$PREFIX$FIRST:$COUNT” VALUE=”Item=$ITEM\nPhoto=$PHOTO\n$OTHERS\nOTP=$OTP” VALUE=$(echo -e “$VALUE”) echo -n “ * Transaction ID: “ emc name_new “dpo:$VENDOR:$PREFIX$FIRST:$COUNT” “$VALUE” $DAYS $ADDRESS echo let FIRST=FIRST+1 done

where URL is the web address of EMC DPO deployment.

Execution of this script results in the creation of NVS entries (if you have done it all correctly) and data output to the console will look like:

`Creating serial SN-55001:

We then save the Public URL and Private URL for each separate serial number, make QR-codes out of them, and place them as follows: one on the outside of the box; the other, naturally, inside the box, under the protective film.

3. EMC DPO Web Application Deployment

First we install dependencies and activate the desired modules:

apt install curl git apache2 libapache2-mod-php php-xml a2enmod rewrite

Clone a git-repository into /var/www:

cd /var/www git clone https://github.com/Emercoin/emcdpo

Install composer and its components:

cd /var/www/emcdpo/engine curl -sS https://getcomposer.org/installer | php php composer.phar install — prefer-dist

Designate the www-data user (or any other, through which the web server will be executing the code) as the owner of the emcdpo folder:

chown -R www-data:www-data /var/www/emcdpo/engine

Record our parameters into the file /var/www/emcdpo/engine/src/settings.php:

// General Settings CONST DPO_VENDOR = ‘Your Company’; CONST SALT = ‘johNah2koosie3iG’; CONST NVS_DAYS = 730; CONST ALLOWED_UPDATES = 2; CONST SEARCH_DEPTH = 10; // Emercoin RPC Settings CONST RPC_TYPE = “https”; CONST RPC_USERNAME = “emccoinrpc”; CONST RPC_PASSWORD = “RahRoh6ca8chaf6naji9dfaazaeghaidiLooyePi4aeQuah9lai4Eij5gotoocha”; CONST RPC_HOST = “localhost”; CONST RPC_PORT = ‘6662’;
Emercoin RPC login details can be read in the file /etc/emercoin/emercoin.conf

Then configure the web-server. To do this, create an Apache configuration file /etc/apache2/sites-available/emcdpo.conf, with the following code an example of this:

Alias /dpo /var/www/emcdpo/engine/web <Directory /var/www/emcdpo/engine/web> Options -MultiViews RewriteEngine On RewriteBase /dpo RewriteCond %{RQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L] </Directory>

Activate the configuration and restart Apache:

a2ensite emcdpo systemctl restart apache2

Now EMC DPO will be available at the following address: http://YOURHOSTNAME/dpo, and it is now ready for use.

Then, based on received URL and codes, you can generate product labels. To do so, you can, for example, use this program


# Subscribe this channel for latest emercoin news

Our materials:

Emercoin Meetup at BTC Miami
Bitfury and First Block Capital Invest in Emercoin
Emercoin 2017 Results

https://medium.com/@emer.tech/how-to-protect-your-products-against-counterfeiting-using-blockchain-78b4f5096324

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Nice tech with terrible marketing.

Why... why don't you make a ready-to-use docker container at least?

Interesting post, thanks for sharing and explaining this process with all of the commands needed!
I work in ICO consulting mainly, and think Steemit is a great platform for ICO and established cryptos. Would love to talk more!

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://medium.com/@emer.tech/how-to-protect-your-products-against-counterfeiting-using-blockchain-78b4f5096324

Sneaky Ninja Attack! You have been defended with a 7.27% vote... I was summoned by @emercoin-news! I have done their bidding and now I will vanish...Whoosh