What is OurSql ?
OurSQL is a an open source project built in Go that provides a set services that leverages MySQL in a cluster, to build a decentralised ledger in a quick and easy way. The project it still in its infancy however it has a lot of potential.
Applications connect to the OurSql through a MySql Proxy. The application executes standard sql commands to the proxy as if it is communicating directly to a MySql server. This is a powerful concept as it means that any application build to interact with MySQl can be easily exposed to blockchain with zero changes from the application perspective.
OurSql determines if a user can execute the SQL query using a set of consensus rules that can be defined through a configuration file.
If the SQL query is allowed, OurSQL server builds a transaction and adds the transaction to a pool of transactions and executes the SQL update. The transaction is then transmitted to to other nodes
If the transaction pool contains enough transactions a new block is created and added to the blockchain.
When a node receives the transaction from one of its peers. It checks that the command can be executed against the consensus rules and if yes executes and adds to the pool.
Current consensus is based of Proof of Work. Options related to the creation of the blocks like the block hash options and the number of transactions per block can be modified through the configuration files.
OurSql also supports the concept of cryptocurrency as you can set a cost to the SQL operations. Cost can be defined per table or per SQL command type.
How to try OurSQL
Currently OurSQL does not provide an “simple” installation process. Best approach is to test through a docker image provided by the developer.
docker run –name oursql -p 8788:8788 -i oursql/oursql-server
You can run the sql commands through the proxy on port 8766.
mysql -h 127.0.0.1 -P 8788 -u blockchain -pblockchain BC
CREATE TABLE testtable (id int unsigned primary key auto_increment, testfield varchar(200));
INSERT INTO testtable SET testfield =’testdata’;
More examples can be found on the github site.
This project is still in its infancy but has a lot of potential as applications based on mysql can now leverage blockchain with zero changes as the application.
Hope this blog was helpful. If you need assistance or consultancy feel free to contact me on [email protected].