HN Gopher Feed (2017-07-25) - page 1 of 10 ___________________________________________________________________
SQL on Ethereum Blockchain with Presto
101 points by xiaoyao
https://github.com/xiaoyao1991/presto-ethereum___________________________________________________________________
[deleted]
ivanbakel - 3 hours ago
You want to write SQL-like queries for the ETH blockchain using
Postgres? How exactly do you intend to do that?
TkTech - 3 hours ago
Ignoring the stupidity of that guys "just use postgres"
comment, it is actually possible to do this by writing a
foreign data wrapper[1].[1]:
https://www.postgresql.org/docs/10/static/fdwhandler.html
Kiro - 3 hours ago
Did you even click the link? Your comment makes no sense.
sctb - 2 hours ago
Please stop posting unsubstantively like
this.https://news.ycombinator.com/newsguidelines.html
tsukaisute - 2 hours ago
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
xiaoyao - 2 hours ago
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.
leddt - 3 hours ago
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
xiaoyao - 2 hours ago
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 - 1 hours ago
I think that's a caching issue
megalodon - 2 hours ago
I agree and your comment didn't come off as negative to me.
detaro - 2 hours ago
Agreed. Since they only show single commands and no animation
etc, plain text would be better.
Phlow - 3 hours ago
Oh look, another Ethereum post.Nope, still not putting money/time
here, sorry.
ahallock - 3 hours ago
Please enlighten us why.
[deleted]
jameskegel - 2 hours ago
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.
Animats - 2 hours ago
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.
DennisP - 2 hours ago
Transactions on Ethereum are atomic. If something throws,
everything rolls back.There's one well-known exception, which is
that if your contract sends ETH to another contract, invoking its
fallback function, then a throw in the callee just means the call
returns false. So in that particular case you have to check the
return value and rethrow to make it atomic; this sounds crazy but
in some circumstances you don't actually want to throw. The
compiler gives you a warning if you don't check.
Animats - 2 hours ago
Didn't the DAO hack happen because someone found a way to make
an "atomic" transaction fail without full rollback?
DennisP - 1 hours ago
No, it was a reentrant attack. The contract was doing a state
change after sending ETH, and since the recipient called
back, it was able to get repeated ETH sends before the state
updated.
Animats - 1 hours ago
That's an atomicity failure. That class of bug,
incidentally, is a classic source of trouble in
window/widget GUI systems.
simondedalus - 2 hours ago
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...)
ah- - 1 hours ago
https://github.com/pixelspark/catena
xiaoyao - 2 hours ago
It's not loaded into a SQL database. You can think of Presto as
simply as a SQL query engine. It sources data from Ethereum and
run queries on it.
AlwaysBCoding - 3 hours ago
Business model for you: Host a node yourself, and charge a
micropayment in ETH to make SQL queries against the DB.
granda - 2 hours ago
How do you account for the cost of the transaction itself? Those
aren't cheap.
meesterdude - 2 hours ago
Querying the blockchain does not cost anything, just making
changes to it. Otherwise, verifying transactions would be a
recursive cost. I could be wrong though, but pretty sure since
it's distributed reads are free, writes are where it costs.
tylersmith - 2 hours ago
I think he means for the micropayment. For that system to be
viable it would need Raiden or some other payment channel
system.
tylersmith - 2 hours ago
The tech isn't quite here yet but payment channels would be a
good solution.
xiaoyao - 2 hours ago
+1, I have another project on payment channels, coming soon
WaxProlix - 1 hours ago
Interesting - Presto-As-A-Service is hard to do because of the
way it handles permissions / auth. With an inherently shared
resource like a blockchain it becomes a lot more feasible.
pweissbrod - 58 minutes ago
If im not mistaken presto-as-a-service is the power behind aws
athena. They charge by the bytes scanned.
WaxProlix - 46 minutes ago
I'm not interested in the charging so much as how they handle
privacy and security for multiple users/accounts in
(supposedly) a single Presto cluster.
brepl - 3 hours ago
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 - 3 hours ago
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 themPresto itself has a JDBC driver, so
you could run it + this plugin in a Java app/codebase