Blockchain/dApp Architecture and Design

Hey guys.

I’ve been using LucidChart to design a dApp platform which is one day supposed to be hosted on an existing blockchain or possibly run on it’s own fork of a protocol like EOS. I’m wondering if anybody knows if it’s possible to use traditional Entity Relationship Diagrams to layout the relationships between various objects and users etc. I need to know if the concepts of primary keys and foreign keys in such schemas can be easily interpreted and converted by devs into a blockchain coding scenario.

I’ve asked Ivan about this live a few times but he hasn’t really given any answers on this topic. I don’t want to keep designing in this way if developers are going to turn around and tell me I’ve wasted my time because the traditional schema modelling I’ve been building can’t be applied to blockchain.
Can anybody help?

Yours truly
The Mad Cow

If you are asking if you can model relationships such as a user has a object then I would say that is easily implemented on Ethereum through the mapping datatype. To interact with the chain every user would need a wallet and the user’s public address would be used as primary key equivalent, using a mapping type, for every kind of data object that they would own in a given contract.

I would need to know what kind of foreign key behavior you are trying to replicate to accurately answered that part of the question though.

Hi Curt
Thanks for responding.
Some examples of foreign keys would be from a ‘User Type’ or ‘Preferences’ table to a ‘Users’ table which would be for different permissions or accessibility to enable certain functions. Other FK’s would be from something like a ‘Product Category’ table to a ‘Product’ table for supply chain management.
Without going into User or Product journeys, because Ethereum’s fees and the fact that it hasn’t solved the scalability problem (and I remain a skeptic that it ever will) I don’t plan on implementing this system on Ethereum because of it’s inability to handle high throughput. Possibly will be implementing on Stellar initially.

You should be safe modeling your data schema with entity relationship diagrams then. I do wonder how much of this data is a good fit for being committed to the blockchain though. When thinking of the design of dApps, I like to break the data out into what must be essential immutable record keeping ( committed to the chain ) and what could be worked with something else. For you the blockchain important bits would be the product journey as it traverses the supply chain. Details about those products could be off chain in something more akin to a traditional database.

You got me looking and there are a couple of projects trying to do decentralized databases but I have no idea the state of their technology at present. You can look them over and see if they could help you out.

https://tiesdb.com/database //Ethereum specific

https://bluzelle.com/

1 Like

Yes things like user settings wouldn’t be committed to the same chain as the supply chain journey’s chain but if it is a true decentralised app, user specific data such as settings would need to be committed to a chain somehow because if it were to sit on a traditional database on a server it wouldn’t be a dApp anymore.

Maybe I’m wrong? I’m not sure, this is why I’m here asking these questions.

Hey MadCow!

I remember you asking this Ivan way back and you got me thinking then. First off everything is possible (think in a way of liner transformation) so yes you can use relationship diagrams however most likely most developers won’t know what to do with them. You would have to include additional steps and transform it into blockchain friendly form and like e.g. @CurtGreen suggested that could be done with the help of mapping.
Don’t get me wrong I’m not a blockchain guru but I think you should watch this video by Phillip before deciding how to proceed because in the end you need external source of truth so you can’t really build fully decentralized apps in a practical way yet. Once we reach and pass the point when we have blockchains talking to one another everything this is going to change however we still have a long way to go until we reach the “Internet of Blockchains” point.

These truly are the early days and we’re all pioneers here so before you decide on how to move forward watch that video by Phillip.