I have an ad campaign and I want to store data(like campId, number of impressions, start date, end date etc.) of each campaign on blockchain. Also, whenever I will pass campId, I should be able to access data of that particular campaign. I am just wondering should I just create simple contract and create new instance of it for every campaign and save the address of each contract in the relation db or I should use some pattern like Factory or Registry patten?
1 Answer
If you want to avoid having a backend/bd to store data and solely want to run your application on a decentralized way, then a Factory patter should be what you're looking for. This way you can store your campaigns in your factory. I would also recommend you look at the proxy contract patterns. You should create a proxy contract to that point to your factory. This way, in case you ever want to update your application (new features, bug fixing etc...) you can just deploy a new factory and point your proxy to it. Hope it helps.