pixelspark / catena

Catena is a distributed database based on a blockchain, accessible using SQL.
MIT License
302 stars 23 forks source link

What would it take to just switch this to run on Ethereum? #129

Closed yello123 closed 6 years ago

yello123 commented 6 years ago

Would it be possible for you to build a smart-contract that's capable of generally storing and organizing data and using sql and your web interface to interact with it?

pixelspark commented 6 years ago

@yello123 good question! I reckon storing an SQL transaction log on Ethereum would be very costly as Ethereum is not designed for any such storage. However it would be possible to store e.g. grants and transaction checksums on Ethereum and pair it with the Catena chain (which then doesn't need to be mined)..

georgek146 commented 6 years ago

Let's assume the cost of using Ethereum is not a problem.

I go to the web interface do a transaction, and the log gets recorded in an Ethereum contract. Where in the code could i implement that?

pixelspark commented 6 years ago

@georgek146 the CatenaCore module defines interfaces for the underlying blockchain, So what you'd do is add a Ledger implementation that accepts SQLTransaction transactions, and then put them in the Ethereum chain (probably by posting a message to an Ethereum client daemon). You'd probably also need to implement your own version of Blockchain and perhaps some other stuff in order for the web interface to work. Also, you should rip out the logic for gossiping transactions and blocks as you are delegating this to Ethereum, and should add a listener for new SQL transactions coming from the Ethereum client daemon.

Is this something you'd be working on in public? if so, very interested in the result!