The U.S. electric grid is being transformed from a one-way channel delivering electricity from central power plants to customers at set prices, toward a distributed grid with two-way flows of information and electricity and dynamic distributed markets. The benefits of creating distributed markets for electricity are potentially great. Consumers can participate as buyers and sellers in these markets, utilities can reduce costly peak electricity load and risk of outages, and firms can be rewarded for innovation. However, along with these potential benefits come significant cybersecurity and privacy risks. Participants in distribution-level markets may be technically unsophisticated and use energy management and communications systems that do not provide high levels of security. The potential cost of a security breach that overloads or shuts down large areas of critical infrastructure is immense. This research identifies potential security and privacy risks associated with distributed electricity markets, measures to provide an acceptable level of risk, and trade-offs between risk reduction and performance of distributed markets. The results will provide guidance to utilities, regulators and other participants in designing effective and robust market structures with necessary security and privacy protection. The research is multidisciplinary, including economics, computer science and public policy. It employs an innovative mix of research methods, including interviews, modeling of market structures, simulations using real world electricity use data, modeling of data flows, and security threat analysis. A discrete event simulation framework is used to model interacting agents that will comprise distributed electricity markets and to estimate a cost function for the relative welfare cost of given grid topologies and market policies. A software simulator is constructed and tested using real electricity use data to vary parameters on multiple dimensions and minimize cost. Security attacks are introduced into the simulations to identify impacts on grid stability, market trust and privacy. The use of real world data enables simulation of a wide array of different market structures and interactions with a variety of bidding and response policies on the part of distributed consumers/producers and market controllers. The research is transformative in its development and use of modeling and simulation tools, tested with real data, to identify security and privacy risks associated with different market structures, security methods, and threat types.