2

i hope you can help me improve or validate my storage concept. I am glad for each suggestion. Since this is my first DApp, i might not consider all possible options for my problem.

To understand the Background: I plan to realize a DApp (based on Ethereum) that compares prices and search the cheapest price for a product in an certain area. The product itself is homogeneous, only the price matters. To keep it simple: Its a complicated product, it takes several days for the supplier to confirm an order and several month to deliver the product. The prices for the product are volatile, so there is a possible incentive for suppliers to cheat, meaning that they offer a low price in the beginning and demanding a higher price when they confirm the order a couple of days later.

The reason why i want to use the blockchain is transparancy and tracebility for the customer. So the customer should be able to easily validate, that the price that is suggested by the DApp is really the cheapest one in his area. Furthermore the Customer need to proof, that the supplier really offered a certain price at a certain time and cant claim a higher price later in the order confirmation.

So the interaction with the blockchain need to deliver two things: a. Evidence that the result is really the cheapest price in his area b. That the supplier itself offered the suggested price at this time.

Here are my thoughts and solutions so far:

The easiest and most transparent way would be one huge smart contract with all the data (prices, areas, suppliers) stored inside. The suppliers would update the prices in the smart contract with transactions.

a. The customer could simply check the smart contract attributes to validate the lowest price suggestion of the DApp.

b. The customer can proof the origin of the price through the transaction history of the contract.

Since data storage is extremely expensive on the blockchain, the interaction with this contract is not really an option. Updates of prices are very expensive because of the amount of data that is shoveled around (I tried it already). Instead the storage on the Blockchain for each supplier should be smaller, but still have the same transparency. I thought about using IPFS as datastorage and just store the Hash, but IPFS itself does not really proof anything because its mutable. So the important data need to be on the Blockchain, at least for my understanding, maybe you have a better idea?

So this is my last idea where I ask your help for. I tried to draw it in a use-case class model mix, I hope it becomes more clear this way. Unfortunately you have to download it, because i dont have enough reputation

https://i.stack.imgur.com/miebd.jpg

Each supplier has its own contract (Supplier). The suppliers update the prices within their contract through transactions. Each contract supplier references to the same IPFS datastorage. The Datastorage just contains a list of all supplier smart contracts (adresses).

The Smart Contract HashStore just contains the IPFS Hash to this list.

To get the lowest price, I will in javascript (Class Price Search) simply read the Hash out of the Smart Contract HashStore. Then I will access the datastorage on IPFS and get all the addresses. I don’t use the prices stored on IPFS. Instead I loop through the addresses and call each time the GetData Method of each smart contract Supplier. After I collected all prices I simply choose the cheapest one.

a. The customer could check the datastorage on IPFS for an Overview of all prices. Since I read the price directly out of the Smart Contract, there is nothing to win for the supplier to manipulate the IPFS Table.

b. The Customer can easily check each supplier and its transaction history through the individual smart contract. So he can easily proof price changes.

I think this solution might work, but i still feel that I miss a part. Maybe Swarm offers some options I don’t know? Or there are some cool functions in Solidity I am not aware to handle this problem?

Thanks for your help!!!

MrMoehner
  • 21
  • 3

0 Answers0