
SQL on Ethereum Blockchain with Presto - xiaoyao
https://github.com/xiaoyao1991/presto-ethereum
======
tsukaisute
There seems to be a lot of confusion in the other posts as to what this is.

Simply, it is an adapter that lets you use SQL syntax to introspect Ethereum
blockchain data (blocks, and transactions.) Typically people do this using a
JS API built into the node software [1], and it may/may not be ones' cup of
tea.

[1] [https://github.com/ethereum/wiki/wiki/JavaScript-
API](https://github.com/ethereum/wiki/wiki/JavaScript-API)

~~~
xiaoyao
Yes, and with presto you can join tables from different sources. So you can
join ethereum data with whatever you want, be it a mysql table of accounts in
observations, etc.

------
Animats
Oh, they loaded the Etherium blockchain into an SQL database. Easy. From the
title, it appeared that someone had figured out how to represent an SQL
database in the blockchain using the virtual machine for contracts. That would
be hard.

As I've pointed out before, smart contracts need atomic transactions. Either
everything commits, or nothing commits. This is a basic property needed for
accounting systems.

~~~
simondedalus
not only would it be hard, but using a blockchain (a type of database) to
represent a functional SQL database using smart contracts is a _mind-
numbingly_ bad idea.

(insert "should i use a blockchain" infographic, which is amusingly impossible
to google image search for, because this question evidently does not often
occur to people...)

~~~
misterdata
That might just depend on what parts of a "SQL database" you'd implement using
a blockchain, and on the application type. You could e.g. segregate the data
and only use the blockchain to authorize or timestamp transactions, for
instance. In the latter case, Blockchain is just another consensus layer, and
all distributed databases need one. See also
[https://github.com/pixelspark/catena](https://github.com/pixelspark/catena),
which uses the blockchain like a replication journal, logging only mutating
queries and providing authorization based on public key crypto (disclosure: I
am the author).

~~~
simondedalus
not to put too fine a point of it, but there's a world of difference between
creating a ledger that creates a "distributed" SQL database whose integrity is
guaranteed among non-trusted nodes through a blockchain, and using smart
contracts to "put a functioning SQL database on the blockchain."

"get used to blockchain when all you know is SQL" \- cool.

"guarantee all us non-trusted nodes have the same SQL database" \- ...sure,
but for any project such that i want this, i'm pretty sure i don't need a
blockchain. (but of course, your project doubtless has uses i haven't thought
of)

"i want a trustless SQL database so i'm going to use EVM and solidity and put
it on The Blockchain because i'm awesome" \- very bad.

"i'm starting a new project, so naturally i need to use a blockchain" \-
extremely bad.

------
brepl
Is this a JDBC connector for Ethereum? If so, that's neat. Ethereum APIs are
generally awful, so a known, sane language for interacting with the blockchain
has to be welcome.

~~~
herval
It’s a Presto (prestodb.io) plugin - presto is a tool to do SQL queries over
data sources (hadoop, nosql dbs, sql dbs, etc), including joining over them

Presto itself has a JDBC driver, so you could run it + this plugin in a Java
app/codebase

------
AlwaysBCoding
Business model for you: Host a node yourself, and charge a micropayment in ETH
to make SQL queries against the DB.

~~~
granda
How do you account for the cost of the transaction itself? Those aren't cheap.

~~~
tylersmith
The tech isn't quite here yet but payment channels would be a good solution.

~~~
runeks
Payment channels alone are only a good solution if you consider it acceptable
to establish a payment channel with everyone you want to pay. So, in other
words, it only makes sense for recurring payments to the same merchant, and
you pay the blockchain fee once for each merchant you want to pay.
Consequently, if you only pay once you pay the same fee as an on-chain
transaction, and if you pay 1000 times you pay, in average, 1000th the
blockchain fee per payment.

------
leddt
Those gif are quite annoying to read and don't add anything of value. Static
images, or even plain text, would be a lot better.

Edit: Sorry for the negativity. I created a PR for it.
[https://github.com/xiaoyao1991/presto-
ethereum/pull/8](https://github.com/xiaoyao1991/presto-ethereum/pull/8)

~~~
xiaoyao
Thanks for the PR, and it's merged, but the gif is still animated though. I'll
update with still images later in the day.

~~~
leddt
I think that's a caching issue

------
buremba
The compute abstraction of Presto query engine is great, we have been working
on a similar project based on Presto:
[https://enginesql.com/](https://enginesql.com/) (Shameless plug)

------
thedaemon
Presto is the in house 3d software used by Pixar. I came here and was very
confused. Do we not Google search our software's name before assigning it?

------
foota
I've been thinking about building API's for interaction with the off chain
world, it seems like this is something with interest?

~~~
xiaoyao
Can you elaborate more? What specifically about offchain world?

~~~
foota
My first thought was sending email.

------
Phlow
Oh look, another Ethereum post.

Nope, still not putting money/time here, sorry.

~~~
ahallock
Please enlighten us why.

~~~
jameskegel
For myself, it's a matter of integrity. As an early holder, I was enamored
with the idea, and took "Code is law" at face value. The response to the DAO
incident alienated me. I don't have any ill will, and I'm not saying it's a
scam or that you shouldn't get any, I'm just saying it is not for me.

