Karim Aya

Karim Aya

1562294803

A Simple Blockchain Application for Data Verification.

Learn how to code a viable application for Ethereum in a handful of lines.

Introduction

In this article I’m going to describe the simplest blockchain application that I know, with code examples. This is useful for those starting in the blockchain space as well as a design pattern for more experienced architects.

Imagine the following use case. You have received a document that has passed through several hands and you want to make sure that it is authentic. The document might be the service book for a car that you are buying, or it might be a document asserting that the house that you are buying really belongs to the seller. It could be anything.

Digitally signing documents to ensure that they haven’t been tampered with is nothing new. You can take the contents of the document and produce a cryptographic signature with them, which is sent along with the document itself.

The receiver of the document can produce the signature again and verify that it matches with the one provided. A match means that the document hasn’t changed.

This is what you get with MD5 checksums and it is very convenient to use. Its weakness is that you need to receive the signature to verify the authenticity of the document. If someone gets in the middle and changes both the document and the signature you will be none the wiser.

Since getting data from individuals is not something that can be easily trusted, sometimes a third party steps in to provide a record keeping service for a profit. This profit motive is what keeps the record keeper honest.

Workable, but not a perfect solution. The record keeper will naturally work itself to a position of power and extract high rents with no competition. Even worse, if economic incentives change the record keeper might become corrupt. Who watches the watchmen?

What Blockchain can do for you

A blockchain datastore is decentralized, robust and immutable.

  • Decentralized means that the datastore runs collectively on the hardware of several different people.
  • Robust means that the datastore will continue running even if some of the participants leave or stop cooperating.
  • Immutable means that once data is stored in a blockchain it cannot be altered.

Blockchain solves the document registry problem in an elegant way. Once we enter a signature in the blockchain registry we don’t need to fear that the signature will be altered to match a tampered document. To do that a majority of network participants would have to agree on the change which makes it hardly secret.

At the same time, there is no one in a position of power to extract rent for running the service. The network participants provide the service themselves.

In this context, a document can be any data set. The same pattern will work for attesting to the authenticity of any business transaction, IoT data set or user identity, among many others.

If I would be writing this in 2016 I could implement about a hundred lines of code, then a whitepaper with two dozen pages, and raise a few million in an ICO. The applications for this pattern are endless and lots of people did take the opportunity.

Nowadays, it is useful to know how to use this building block to design more complex solutions. All blockchain solutions rely on storing user generated data that can be trusted without depending on anyone.

Implementation

This time I didn’t code the contract from scratch. I’m trying to stop reinventing the wheel and blockchain registries have been implemented by the dozen. A quick google search took me to the GitHub repo that I’ll use to show how the pattern works. Even if it uses an old version of solidity it works just fine and you can test it (thanks Svetlin!).

The contract is very simple with only one relevant contract variable and two functions.

  • A documents mapping links the hash calculated for a document with the block in which it was added.
  • An add method takes a hash and stores it in the mapping.
  • A verifiy method returns the timestamp for a hash.
pragma solidity ^0.4.18;
contract DocumentRegistry {
  mapping (string => uint256) documents;
  address contractOwner = msg.sender;

  function add(string hash) 
    public 
    returns (uint256 dateAdded) 
  {
    require (msg.sender == contractOwner);
    var timeAdded = block.timestamp;
    documents[hash] = timeAdded;
    return timeAdded;
  }

  function verify(string hash) 
    constant 
    public 
    returns (uint256 dateAdded) 
  {
    return documents[hash];
  }
}

The frontend allows you to upload a document with contract.add and calculates a signature as a sha256 of the document contents.

async function uploadDocument() {
  …
  let fileReader = new FileReader();
  fileReader.onload = function() {
    let documentHash = sha256(fileReader.result);
    …
    contract.add(documentHash, function(err, result) {…});
    …
  }
}

The frontend also allows you to upload a document with contract.verifyand if it was uploaded before it will tell you approximately when.

function verifyDocument() {
  …
  let fileReader = new FileReader();
  fileReader.onload = function() {
    let documentHash = sha256(fileReader.result);
    …
    contract.verify(documentHash, function(err, result) {
    …
    let contractPublishDate = result.toNumber();
    if (contractPublishDate > 0) {
      let displayDate = new Date(
        contractPublishDate * 1000
      ).toLocaleString();
      showInfo(
        `Document ${documentHash} is <b>valid<b>, 
        date published: ${displayDate}`
      );
    }
    else
      return showError(
        `Document ${documentHash} is <b>invalid</b>: 
        not found in the registry.`
      );
    });
  }
  …
}

That’s all that you need to implement a decentralized document registry that allows two things:

  1. To sign a document
  2. To verify if a document has changed since its last recorded signature.

This works because the chance of two different documents having the same signature is very close to zero. If you get a timestamp back you can be certain that the document that you are providing was introduced to the registry at that time.

The contract code can certainly be updated and improved, but the core behaviour in those 17 lines is still correct.

Conclusion

A document registry is the simplest implementation of a blockchain application with business value. In 2016 the few lines of code in this article would have been enough to raise several million dollars in an ICO. Today they are still relevant as one of the building blocks that you can reuse again and again in more complex solutions.

A document registry effectively uses the decentralization and immutability properties of blockchain to eliminate the need of trusting anyone that the data provided is genuine. The idea is simple but revolutionary.

#web-development #blockchain

What is GEEK

Buddha Community

A Simple Blockchain Application for Data Verification.
Siphiwe  Nair

Siphiwe Nair

1620466520

Your Data Architecture: Simple Best Practices for Your Data Strategy

If you accumulate data on which you base your decision-making as an organization, you should probably think about your data architecture and possible best practices.

If you accumulate data on which you base your decision-making as an organization, you most probably need to think about your data architecture and consider possible best practices. Gaining a competitive edge, remaining customer-centric to the greatest extent possible, and streamlining processes to get on-the-button outcomes can all be traced back to an organization’s capacity to build a future-ready data architecture.

In what follows, we offer a short overview of the overarching capabilities of data architecture. These include user-centricity, elasticity, robustness, and the capacity to ensure the seamless flow of data at all times. Added to these are automation enablement, plus security and data governance considerations. These points from our checklist for what we perceive to be an anticipatory analytics ecosystem.

#big data #data science #big data analytics #data analysis #data architecture #data transformation #data platform #data strategy #cloud data platform #data acquisition

Macey  Kling

Macey Kling

1597579680

Applications Of Data Science On 3D Imagery Data

CVDC 2020, the Computer Vision conference of the year, is scheduled for 13th and 14th of August to bring together the leading experts on Computer Vision from around the world. Organised by the Association of Data Scientists (ADaSCi), the premier global professional body of data science and machine learning professionals, it is a first-of-its-kind virtual conference on Computer Vision.

The second day of the conference started with quite an informative talk on the current pandemic situation. Speaking of talks, the second session “Application of Data Science Algorithms on 3D Imagery Data” was presented by Ramana M, who is the Principal Data Scientist in Analytics at Cyient Ltd.

Ramana talked about one of the most important assets of organisations, data and how the digital world is moving from using 2D data to 3D data for highly accurate information along with realistic user experiences.

The agenda of the talk included an introduction to 3D data, its applications and case studies, 3D data alignment, 3D data for object detection and two general case studies, which are-

  • Industrial metrology for quality assurance.
  • 3d object detection and its volumetric analysis.

This talk discussed the recent advances in 3D data processing, feature extraction methods, object type detection, object segmentation, and object measurements in different body cross-sections. It also covered the 3D imagery concepts, the various algorithms for faster data processing on the GPU environment, and the application of deep learning techniques for object detection and segmentation.

#developers corner #3d data #3d data alignment #applications of data science on 3d imagery data #computer vision #cvdc 2020 #deep learning techniques for 3d data #mesh data #point cloud data #uav data

Gerhard  Brink

Gerhard Brink

1620629020

Getting Started With Data Lakes

Frameworks for Efficient Enterprise Analytics

The opportunities big data offers also come with very real challenges that many organizations are facing today. Often, it’s finding the most cost-effective, scalable way to store and process boundless volumes of data in multiple formats that come from a growing number of sources. Then organizations need the analytical capabilities and flexibility to turn this data into insights that can meet their specific business objectives.

This Refcard dives into how a data lake helps tackle these challenges at both ends — from its enhanced architecture that’s designed for efficient data ingestion, storage, and management to its advanced analytics functionality and performance flexibility. You’ll also explore key benefits and common use cases.

Introduction

As technology continues to evolve with new data sources, such as IoT sensors and social media churning out large volumes of data, there has never been a better time to discuss the possibilities and challenges of managing such data for varying analytical insights. In this Refcard, we dig deep into how data lakes solve the problem of storing and processing enormous amounts of data. While doing so, we also explore the benefits of data lakes, their use cases, and how they differ from data warehouses (DWHs).


This is a preview of the Getting Started With Data Lakes Refcard. To read the entire Refcard, please download the PDF from the link above.

#big data #data analytics #data analysis #business analytics #data warehouse #data storage #data lake #data lake architecture #data lake governance #data lake management

Database Vs Data Warehouse Vs Data Lake: A Simple Explanation

Databases store data in a structured form. The structure makes it possible to find and edit data. With their structured structure, databases are used for data management, data storage, data evaluation, and targeted processing of data.
In this sense, data is all information that is to be saved and later reused in various contexts. These can be date and time values, texts, addresses, numbers, but also pictures. The data should be able to be evaluated and processed later.

The amount of data the database could store is limited, so enterprise companies tend to use data warehouses, which are versions for huge streams of data.

#data-warehouse #data-lake #cloud-data-warehouse #what-is-aws-data-lake #data-science #data-analytics #database #big-data #web-monetization

Cyrus  Kreiger

Cyrus Kreiger

1618039260

How Has COVID-19 Impacted Data Science?

The COVID-19 pandemic disrupted supply chains and brought economies around the world to a standstill. In turn, businesses need access to accurate, timely data more than ever before. As a result, the demand for data analytics is skyrocketing as businesses try to navigate an uncertain future. However, the sudden surge in demand comes with its own set of challenges.

Here is how the COVID-19 pandemic is affecting the data industry and how enterprises can prepare for the data challenges to come in 2021 and beyond.

#big data #data #data analysis #data security #data integration #etl #data warehouse #data breach #elt