FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Blockchain - Antonio
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Blockchain - Antonio
Posted: 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Blockchain - Antonio
Posted: Wed Apr 04, 2018 02:30 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Blockchain - Antonio
Posted: 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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Blockchain - Antonio
Posted: Thu Apr 05, 2018 07: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
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: Blockchain - Antonio
Posted: Thu Apr 05, 2018 02: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.
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: Blockchain - Antonio
Posted: Sat Apr 07, 2018 03: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Blockchain - Antonio
Posted: Sun Apr 08, 2018 03: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 (fw): Select all Collapse
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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Blockchain - Antonio
Posted: Mon Apr 09, 2018 05: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Blockchain - Antonio
Posted: Mon Apr 23, 2018 08:20 AM
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion