Whisk the granulated sugar, cocoa powder, and cornstarch in a medium saucepan.
1 cup granulated sugar, ¼ cup cornstarch, ½ cup unsweetened cocoa powder
Separate the eggs and save the whites for another use. Whisk the egg yolks and milk in a large mixing cup, then pour into the saucepan along with the butter.
Cook over medium heat, whisking frequently, until the mixture is thick like pudding.
Remove from heat and stir in the salt and vanilla extract. If the mixture is lumpy then use an electric mixer to beat out the lumps.
¼ teaspoon salt, 2 teaspoons vanilla extract
Pour the chocolate pudding into a fully cooked pie shell and transfer it to the refrigerator to chill for at least 3 hours.
1 pie shell
Top with whipped cream or meringue, if desired.
Notes
For Whipped Cream:
Place 1 cup of heavy cream, 3 tablespoons granulated sugar, and ½ teaspoon vanilla extract in a large mixing bowl.
Beat on medium-high speed until the cream forms stiff peaks.
Spread the cream onto the pie just before serving.
For Meringue:
Place the 3 egg whites into a clean large bowl. Using the whisk attachment of your electric mixer, beat the egg whites on medium-high speed until they are glossy.
Add the ¼ teaspoon cream of tartar then turn the mixer to medium speed.
Slowly add the 3 tablespoons of sugar while beating the egg whites. Once all of the sugar has been added, increase to medium-high speed and continue beating until stiff peaks form.
Spread the meringue on top of the chocolate pie. Use a spoon to create divots and peaks, then place the pie 4-5 inches under the broiler.
Broil on HIGH for several minutes, until the meringue turns golden brown.
This pie can be made in advance. Store leftovers in the refrigerator, covered with plastic wrap, for up to 5 days total.