Blockchain - Antonio

Blockchain - Antonio

Postby cdmmaui » Wed Apr 04, 2018 12:42 pm

Dear Antonio,

Are there any plans to incorporate Blockchain initiatives in to FWH?

Thank you,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Blockchain - Antonio

Postby Antonio Linares » Wed Apr 04, 2018 2:30 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42065
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Blockchain - Antonio

Postby cdmmaui » Wed Apr 04, 2018 10:52 pm

Dear Antonio,

We have been invited to be part of the global supply chain and logistics platform with IBM and Maersk (one of the largest shipping companies in the world). We are looking at available platforms and moving forward. It would be great if FWH had these capabilities.

Sincerely,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Blockchain - Antonio

Postby Antonio Linares » Thu Apr 05, 2018 7:07 am

Dear Darrell,

The key concept of the blockchain is this one:

The hash of the previous block must be found in the block to preserve the chain integrity


So you can easily apply this concept to a database table records, or to an invoice, etc. Simply select which data to control, generate its hash and store it in the next record.

If a record is modified, the hash no longer matches and the blockchain is broken and can be detected where it got broken.

A question arises: What if a record has to be modified ? In such case, all records must modify their hashes. Or modifications are not allowed.

In example: when we use GIT for source control, every change is tracked. There is no way to "modify" a change. You simply add a "new" change.

Applying these two simple ideas, you can blockchain whatever you want :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42065
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Blockchain - Antonio

Postby lucasdebeltran » Thu Apr 05, 2018 2:40 pm

Antonio,

A prototype in fivewin Will be great!!.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
User avatar
lucasdebeltran
 
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am

Re: Blockchain - Antonio

Postby George » Sat Apr 07, 2018 3:34 pm

Antonio,
Very interesting the "FWH Blockchain initiative" proposed by Darrell.
I think the Fivewin community, as a whole, should support it, as this would introduce Fivewin into the new distributed database development environment.

Regards,

George
George
 
Posts: 725
Joined: Tue Oct 18, 2005 6:49 pm

Re: Blockchain - Antonio

Postby Antonio Linares » Sun Apr 08, 2018 3:43 pm

This example shows how to create a Blockchain using an array:

The third element of each subarray contains the hash of the previous subarray. As soon as an element of a subarray is modified, we can detect
where the blockchain has been modified.

This same concept can be taken into a DBF so each record keeps a hash of the previous record. In fact we can easily modify FWH Class TDataBase to
automatically implement this on a DBF and thus provide the Blockchain security to our DBFs or SQL tables :-)

blockchain.prg (c) FiveTech Software 2018
Code: Select all  Expand view
function Main()

   local aBlocks := { { 1, "first", 0 },;
                      { 2, "second", 0 },;
                      { 3, "third", 0 },;
                      { 4, "fourth", 0 },;
                      { 5, "fifth", 0 } }

   AEval( aBlocks, { | aBlock, n | If( n > 1,;
          aBlock[ 3 ] := hb_HMAC_SHA256( aBlocks[ n - 1 ][ 2 ],;
                                         aBlocks[ n - 1 ][ 3 ] ),) } )
   aBlocks[ 3 ][ 2 ] = "changed!"    

   AEval( aBlocks, { | aBlock, n | If( n > 1,;
          If( aBlock[ 3 ] != hb_HMAC_SHA256( aBlocks[ n - 1 ][ 2 ],;
                                             aBlocks[ n - 1 ][ 3 ] ),;
          MsgInfo( "blockchain modified at " + AllTrim( Str( n - 1 ) ) + ;
                   "element" ), ), ) } )  

return nil  
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42065
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Blockchain - Antonio

Postby cnavarro » Mon Apr 09, 2018 5:53 pm

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Blockchain - Antonio

Postby Antonio Linares » Mon Apr 23, 2018 8:20 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42065
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 49 guests