Blockchain - Antonio

Post Reply
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Blockchain - Antonio

Post by cdmmaui »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Blockchain - Antonio

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
cdmmaui
Posts: 653
Joined: Fri Oct 28, 2005 9:53 am
Location: The Woodlands - Dallas - Scottsdale - London
Contact:

Re: Blockchain - Antonio

Post by cdmmaui »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Blockchain - Antonio

Post by Antonio Linares »

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
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: Blockchain - Antonio

Post by lucasdebeltran »

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.
George
Posts: 710
Joined: Tue Oct 18, 2005 6:49 pm

Re: Blockchain - Antonio

Post by George »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Blockchain - Antonio

Post by Antonio Linares »

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

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
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Blockchain - Antonio

Post by cnavarro »

C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Blockchain - Antonio

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply