...by Daniel Szego
quote
"On a long enough timeline we will all become Satoshi Nakamoto.."
Daniel Szego

Tuesday, January 10, 2017

Combining data governance and permissions on the Ethereum Blockchain - a basic approach

As we have seen in the previous couple of blogs, there is a possibility both creating permissions on the Ethereum Blockchain and implementing basic data governance protocolls as well. Now we try to combine the two approaches into an inheritance hierarchy to cover both approaches. 

The simplest way is to define an inheritance hierarchy starting with the basic logging - governance functionalities. 
As a second smart contract let we define a descendant of the Governance smart that implements only the access modifiers. 
As the next descendant we define the administrative functions for giving access to a user. It is important to note that this functionality must already be set by the modifiers making sure that only accounts with the necessary right can set further rights. Considering governance, there is the possibility to monitor both the attempts of access and the succeed of access. It is realized by the AdminAccessRole input parameter in our example. 

Last but not least, custom functions can be set by the necessary modifiers, both ensuring that only the account with a necessary right can access to the functionality and to make sure that both the access attempts and the successfully attempts are logged. 


Notes on paper based business cards

Paper based business cards must extinct. 
They do not have any function, they do not have any usage. 
After getting the card you usually get the contact on LinkedIn and throw away the card.   
People meet, they have mobile phones they should be able to exchange business information simply by two clicking on the mobile phone. 
Paper is not required.
It is only a waste of resources,     

Monday, January 9, 2017

Basic data governance on the Ethereum Blockchain

Let we assume that we have several information on the Ethereum Blockchain and we want to realize some kind of a governance. For the first run, we want to collect and monitor the information who had access to some of the critical data and when. The easiest way is to implement an event type for logging. It provides both the possibility to log into a specific storage area and the possibility that the event is raised online on the client side (for instance in a javascript UI).
Triggering the events can be done the best by modifiers, like one for read and one for write.

Lat but not least, the functions that are critical, like access to the critical variable in this example can be extended by the modifiers. 

Certainly, the pattern works much better with inheritance, like implementing the modifiers in an ancestor smart contract and simply using them in a descendant contract. It is important to note that Ethereum is a public Blockchain. As a consequence, in this example even if getVariable is explicitly logged, there is a little bit hacking way to read out the information from the ledger itself without using getVariable.   


An attempt to define the field: Machine Assisted Human Intelligence

At the beginning of the second machine age, life has become increasingly complicated especially if someone works usually online. The reason for that is simple, the amount of knowledge and information that can be easily accessed online has been being boomed in the last couple of years on the one hand because of more and more people getting online and sharing directly or indirectly information. On the other hand, we are at the age of an IoT revolution as well, where not only people, but billions of intelligent devices are getting online, implying a huge wave of device generated data. 

From an evolutionary and biologically perspective this situation is something that is pretty new. We have been aware of the limit our physical body and human perception for thousands of years and we have been making contiguously attempts to overcome these limitations. Examples ranging from the tools of the prehistoric age via the steam engine to the industrial revolution. As an example, let we consider the capability of the human body to be able to lift at most around 100 kg. That is known to be too little already several thousands of years, implying inventions to overcome the limit from different lifting devices to different crane tools. Another well known example is the limitation of the human perception not to see in the dark. Attempts were made to overcome this limit from simply lighting a fire in the prehistory age to the nowadays night-vision systems. However information overload is something that is from an evolutionary point of view totally new. The amount of information throughout the world was something that one could overview even hundred years ago. Nowadays, the existing information is being doubled in each three years, everything is online, everything is real time and in certain fields you need pretty much of it to work or to make decisions. The human brain is simply not capable to work with such a huge amount information and well as the requirements are pretty new, we are simply not sure where exactly are our limits.     

Good examples are for instance many IT fields, like cloud computing. The field did not exist 10 years ago, despite nowadays there are thousands of books of information about and it is being continuously increased. Working in a field like this requires huge amount of time to simply keep up with the information without doing anything productive. There are not many companies and business models that can support such a thing. As a consequence the need for extending information processing limits  of the brain is an always increasing and demanding field.  

On the other hand current trends of artificial intelligence and machine learning provide many intelligent tools that could be efficiently used extend the limits of the humans' recognition and information collecting process. These fields have rather the focus of creating something that is thinking - working - acting similarly as a human. However with the little refocusing the tools might be used not to copy something that already exist and slowly will not be sufficient for the modern world requirements but rather to extend the human's thinking capabilities. Certainly it should be analysed which AI tools and methodologies can be really used in this field as well: rather methods that produce at the end symbolic results in a human understandable way. With other worlds, let machines support our cognitive capabilities by gathering, analyzing, structuring and storing data.  

Fields of machine assisted human intelligence might be the followings:
- Integrated man-machine interfaces
- Integrated man-machine knowledge discovery
- Integrated man-machine learning and knowledge integration:
- Integrated man-machine memory or storage.
- Integrated man-machine decision making.
- Integrated man-machine collaboration

In this sense the field is located somewhere between cognitive science and machine intelligence, having perhaps more general elements from computer science (Figure 1).


Figure 1. The field of machine assisted human intelligence.

An example for such an ecosystem which already can be found practically in each car is the navigation system. The navigation system extends the human memory simply by storing all of the required maps. It helps with the integrated decision making by collecting online data about traffic collecting both from individuals and from automatic sensors as well, practically realizing an integrated knowledge discovery environment as well. Advanced navigation systems take into account the experience and preferences of the driver as well, providing at the everything on a human readable interface (which I would say can be further developed in the future).

Another innovative field that is emerging at the moment and can be regarded as machine assisted human intelligence is the robo-advisory trend of the fintech industry. 

Using permissions on the Ethereum Blockchain with Smart Contract Inheritance

As we have seen in the last two blogs, there is a possibility to use access for functionalities for na Blockchain on permission basis and on group and permission basis as well. One way to use the functionality efficiently is with the help of Smart Contract inheritance. The modifiers and the logic are implemented in an ancestor class, as a consequence they can be used on the exactly same way in the descendant class as well. 



Creating groups and permissions on the Ethereum Blockchain for a SmartContract

We briefly covered in the last blog how to create permissions for accessing information on the Ethereum Blockchain. Let we extend the model for administrating the access rights not on the individual user (address) basis, but with the help of groups and group membership. We are presenting only a simply version as a prototype; certainly more complex solutions can be built as well. 

As usual, let we create a smart contract, some state variables to access, some elementary access level presented by an enum and two mappings: groupAtomicRoleMapping for mapping an atomic role for a group, and groupsForMembers for mapping list of members for a group name. A constructor is also presented that creates the first Administrators group with an Admin atomic access level and puts the current user into the group. 

Secondly let we create four modifiers to check if the the account calling a function in a group having Read, Write or Admin atomic access. Additionally one modifier checks if the account is the owner of the Smart Contract. 

As a next step some functions are implemented to access to the data of the smart contract and setting access to groups or adding users to group. All functions are modified based on the right modifiers. 

Last but not least, a help function is implemented for string comparison and a destructor as well. 

First testing of the contract can be done in the browser version of solidity. As an example after creating the contract with Create (default zero constructor) we get exception for services that require Admin access. (Please note that in this example there is a type error for the AccessWithGroups constructor. In this way we make tests with or without executing the functionality in the constructor).


After calling the constructor AccesWithGroups constructor explicitly, the administrator group is created set with Admin access and the current account is put into the group. As a consequence we have access for functions like setGroupAccess. 


Certainly real life examples would require more considerations, like implementing functionality for adding or deleting groups, having the possibility for a group to have more than one atomic access level or just implementing error checking into the existing functions.  


Sunday, January 8, 2017

Creating permissions on the Ethereum Blockchain with SmartContract

Let we create a simply example for a permissioned Smart Contract on Ethereum Blockchain. Let we assume that we have the following atomic level of access:
- Read: reading information from the state of the Smart Contract.
- Write; Writing information to a Smart Contract.
- Admin: administration the roles.

Let we assume that the Smart Contract has a couple of variables in a struct for storing internal information an enum for storing atomic access information, a mapping for storing the access information for each account and and a constructor that guarantees that the creating account is registered as Admin. 
Let we create as the next step three modifiers to guarantee that certain functions can be called only by the necessary rights. 
Last but not least, we use the modifiers in the service functions to make sure that only people with the necessary right are able to reach the given service, In our example, we have three services: for reading out data, for writing data and for administrating access.

Certainly, getData functionality does not really cover the expected functionality. As Ethereum is a public Blockchain, the data can be practically read out from the Blockchain even if the getData function can not be explicitly called. 

Saturday, January 7, 2017

Notes on API Integration Frameworks and API query languages


Regarding general IT trends, hosted API solutions are getting more and more common. It implies that solutions will be built up in the future with integrating several API-s as a service. As a consequence frameworks will be more and more important to integrate API-s, to test them, to measure the availability of the individual API-s, or just simply query data efficiently. 

Notes on testing a Bockchain application

Testing a Blockchain application is actually fundamentally different as testing a custom software solutions. The problem is that the domain of a usual Blockchain solution is usually in a domain that requires high privacy and security. Theoretically, the Blockchain technology itself provides a certain level of privacy and security, despite there have been already a lot of hacking both for the Bitcoin protocol and for systems like Ethereum as well (for instance the DAO). Consequently, testing a Blockchain application requires much more competence in the direction of system hacking or cryptography than traditional testing methodologies. Instead of classical tests, perhaps a better way to set up an explicate set of advisories as possible attacks and show that the system is immune for these attacks. Another point to consider, if it is possible to test a Blockhain platform itself from an application that is built on top. 
    
One way in this direction to formulate the problem from a quality management point of view and give an explicit set of rules that should be kept at the implementation in order the system to be secure. Example for such an initiative is the CryptoCurrency Security Standard (CCSS) for defining implementation rules for Bitcoin applications. 

Another way might be the direction of mathematical proofs if the program works as expected. One initiation is the formal verification from solidity.

Friday, January 6, 2017

Setting up Ethereum development environment - tools

Being new in a programming language and environment it is sometimes a difficult to set up an initial development environment. We try to summarize the most important tools in the followings:

Solidity, browser edition (https://ethereum.github.io/browser-solidity/):
- lightweight development environment for coding in solidity. 
- good tool for developing and manually testing small contracts or simply to practice the language. 
- no-live Blockchain integration

Mist browser (https://github.com/ethereum/mist/releases):
- I would say this is the infrastructure part of Ethereum: fancy user interface for managing accounts, smart contracts, deploying into the test or live Blokchcain or simply initiating transactions between actors. 

Geth (https://geth.ethereum.org/downloads/):
- This is another tool on the infrastructure side. Geth is a command line tool for similar purposes as the Mist browser, like creating accounts, deploying contracts to the Blokchain or transferring ethere  between different accounts. It provides however extended functionalities. like setting up a private Blockchain or accessing to some of the detailed cryptographycal elements of an account.   

Ethereum Block explorer (https://etherscan.io/):
- It is an online monitoring tool for the live Ethereum Blockchain, providing the possibility to see accounts or transactions.

Ethereum Studio (http://blog.ether.camp/post/142794388568/ethereum-studio-is-ready-for-you, or https://live.ether.camp/):
- Ethereum Studio is a complex online integrated development environment to develop and test Blockchain applications, including both solidity and other javascript elements.

Additional practical tools (http://ether.fund/tools/):
- There are some additional tools that are nice to use, like Ethereum unit converter.