Engineering Smart Retail Electricity Markets