Blockchain in theory and real applications