In this study, a robust and dynamic transactive energy system in smart grid (SG) environment is proposed based on the Tsypkin-Polyak theorem. A key factor of the proposed system is to consider the uncertainties in electrical grid parameters. Moreover, oligopolistic behaviours of agents, i.e. demands and generating units, are considered in the modelling. It is proved that selfish agents offer their true cost parameters in the proposed transactive energy system. Therefore, optimal power flow (OPF) of the electrical grid is obtained in the proposed transactive energy system. In addition, real-time locational marginal prices (LMPs) are also presented for demand-side management (DSM). Hence, all levels of demands side can interact and communicate with generation side through real-time LMPs. This characteristic is known as interoperability of transactive energy systems. However, in addition to all benefits of the proposed system, it has adverse impacts on the stability of the electrical grid. Here, to solve this challenge, a hierarchical and robust control system is proposed by using the Tsypkin-Polyak theorem to control stability and OPF simultaneously. Finally, the effectiveness of the proposed system is validated by implementing it on a test electrical grid.