A framework is proposed for an electrical power microgrid, such as for a colony or small township of homes that generate electrical power from solar energy and use it directly when possible, and via stored battery power at other times. The situation is described as a demand and supply problem in a multi-agent system with many consumers and suppliers and no explicit communication or coordination among the agents. Such a demand and supply problem is modeled as a Potluck Problem, a generalization of the Santa Fe Bar Problem. Power produced by PV panels and batteries may be used in the local market, in addition to being consumed locally. The proposed microgrid system model is able to determine the optimum operation of a solar-powered microgrid with respect to load demand, environmental requirements, PV panel and battery capacities. The results indicate the effect of various such parameters on the performance of these micro-grids. This paper also analyzes and proposes, based on auction theory, the most efficient and competing pricing mechanism in the proposed microgrid system model. Two important market bidding techniques, single bidding and discriminatory bidding, are considered. The microgrid is made to participate in the bidding process to serve the consumers at a reduced price and to provide better revenues. The viability of the model proposed is illustrated with analyses using realistic assumptions and published historical data.