4

I come across a situation where i need to implement a relational database for an application. Now my question is how to implement it and where should i save the data? also i don't want to save data on RAM as it get very expensive when data size grows.

3

A good way would be to use the demux-js library. It listens for specified actions and allows updating logic for whatever kind of database you like. This is a RAM free option which essentially allows you to achieve CRUD functionality by creating a mirror image of what the blockchain would show if you played through all of your actions.

Mind the mess, but you can see me implement demux here.

| improve this answer | |
  • blockchain is decentralized and so the data is just want to confirm by using demux the data will be centralized.is it good for a dapp? – Abdul Manan Sep 6 '18 at 9:37
  • 1
    Demux provides a mirror of the chain for ease of use. You can still verify on chain. – Nat Sep 6 '18 at 9:40
  • that's great !! if i setup mongo db at my local server and do save data before every transaction ! is it good practice ? – Abdul Manan Sep 6 '18 at 11:19
  • So inorder to run demux do i need to run my own node (nodeos) in develpment server. – YashwanthKambala Oct 4 '18 at 3:06
  • 1
    @YashwanthKambala No, but you'll want to use a local node. "// Locally hosted node needed for reasonable indexing speed". You can also set the initial block that you want to listen for so you don't start at the first block. github.com/EOSIO/demux-js – Nat Oct 5 '18 at 11:25
1

Another option is to use eosio mongodb_plugin for archive blockchain log into mongodb by running a node then apply queries on it.

https://developers.eos.io/eosio-nodeos/docs/mongo_db_plugin

@Nat i need your opinion about that option.

| improve this answer | |
  • 3
    It may be viable, but I think demux is more flexible because you can use almost every db you like. – TeeAttack42 Sep 6 '18 at 7:59
  • Yeah, that one of plus point. we want to save data in decentralized database and give data ownership to user. is there any decentralized db who work well in that situation ?? – Farhan-TroonTechnologies Sep 6 '18 at 8:03
  • 1
    To be honest, I haven't touched that plugin. I'm still compiling contracts on 1.07 :). I'll update when the docs do. They're working hard at b1 right now and short handed in that department. I agree with TeeAttack42. – Nat Sep 6 '18 at 8:16
  • Thank you so much Nat & TeeAttack42 for your quick response. That help us a lot. – Farhan-TroonTechnologies Sep 6 '18 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.