0

I am implementing an order management system using ethereum private block chain. Each order is a smart contract. Each order will be acted upon by multiple actors. The status of the order will also be updated by these actors. How do I get the current status of the order? Will need details like when the order was last processed and by whom, and its status. I will also need the ability to find orders by status(ex: Completed, Failed etc). Find orders that were processed within a date range etc. Is it possible to retrieve such data from the blockchain itself?

If not, what should be the approach to implement such a system?

1 Answer 1

1

For storing the status, you can use events in your smart contract functions and log whatever status you want. Also, you can access event logs in Transaction Receipt or you can also watch all events logged in a contract to access the logged data. Apart from storing status code in events, you can log anything else as well as per your requirement.

We implemented status code functionality in one of our projects, you can take a look and that may help you understand this solution better -

Smart Contract with Status Events - https://github.com/Imaginea/lms/blob/master/contracts/LMS.sol

Test Cases to access those event logs - https://github.com/Imaginea/lms/blob/master/test/testLMS.js

The list of status we use in our code - https://github.com/Imaginea/lms/blob/master/app/components/notifications/status.js#L2

Note: While defining events, you can pass your argument as indexed value so that you can filter out events on the basis of that attribute later.

Hope this helps.

2
  • Thanks for the reply. Creating events was what I was thinking of doing. But if I create events and then log/store that data wouldn't it be similar to building a non distributed system ? Is this the right approach? Jun 21, 2017 at 8:29
  • Events are nothing but transactions, so as per my understanding it will be stored on blockchain(which is ultimately distributed). Getting back status is very handy and fetching them is easy too.
    – Sanchit
    Jun 22, 2017 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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