catena icon indicating copy to clipboard operation
catena copied to clipboard

How to submit mutating queries programatically to catena?

Open grakshith opened this issue 6 years ago • 1 comments

Right now, the postgres wire protocol just supports non mutating queries. The HTTP API also does not support mutating queries. Is there any other way to submit mutating queries(transactions) so that they can be automated?

grakshith avatar Aug 29 '18 09:08 grakshith

Both actually support submitting mutating queries!

When you use the pq protocol, just connect with your hashed public key as username and private key as password (the server will sign and submit any mutating query; note that this is not the optimal solution from a security point of view as the private key is transmitted unencrypted over a socket - nevertheless it should be okay for localhost communication). When you do not provide a (valid) key hash as username or omit the password, the server will indeed only allow immutable queries.

You can also use the HTTP API, although you'd have to build and sign the transaction yourself. The web client can show you how to do this (just create a mutating transaction there and observe the requests made).

pixelspark avatar Aug 29 '18 12:08 pixelspark