Prepare an Ice Bath Setup: Fill a large mixing bowl halfway with ice and cold water, filling it to about two-thirds full. Place a smaller heatproof bowl on top of this ice bath to cool the ice cream base later.
Melt the Chocolate Gently: In a heatproof bowl set over a pot of simmering water (double boiler setup), add the chopped chocolate. Stir frequently until completely melted and smooth. Carefully remove the bowl from the heat and dry its bottom thoroughly to avoid any steam or water from mixing into your chocolate.
Warm the Dairy Mixture: In a medium saucepan, combine the whole milk, heavy cream, half of the sugar, Dutch-process cocoa powder, and espresso powder if using. Warm over medium-low heat, stirring occasionally until the sugar dissolves and the mixture just begins to simmer. Avoid boiling.
Whisk Egg Yolks and Sugar: While the dairy heats, whisk the egg yolks with the remaining sugar in a separate bowl until the mixture is pale, thick, and forms a slow ribbon when the whisk is lifted. This step is key to creating a smooth custard base.
Temper the Eggs: Slowly pour about half of the hot dairy mixture into the egg yolks while whisking vigorously to gradually raise their temperature without scrambling. Once combined, pour this mixture back into the saucepan with the remaining dairy.
Cook the Custard Base: Return the saucepan to low heat. Stir continuously with a wooden spoon until the custard thickens slightly and reaches about 185°F (85°C). You can test doneness by dragging your finger across the back of the spoon—if a line remains, it’s ready. Remove from heat immediately.
Combine Chocolate and Flavorings: Stir the melted chocolate, vanilla extract, and sea salt into the warm custard until smooth and fully blended.
Cool the Base Quickly: Pour the custard through a fine mesh strainer into the bowl resting over the ice bath. Stir gently every few minutes to help it cool rapidly, preventing any cooking to continue and ensuring a silky texture. Cool until the mixture reaches room temperature.
Chill Overnight: Cover the cooled custard directly with plastic wrap to avoid skin formation. Refrigerate for at least 4 hours or preferably overnight to develop flavors and texture.
Prepare the Peanut Butter Swirl: In a small bowl, whisk together the smooth peanut butter, heavy cream, and a pinch of salt until creamy and spreadable.
Churn the Ice Cream: Follow your ice cream maker’s instructions to churn the custard until it reaches a soft-serve consistency.
Add the Peanut Butter Swirl: Transfer the churned ice cream to a freezer-safe container. Add dollops of the peanut butter mixture as you fill the container and gently swirl using a spatula or knife to create marbled ribbons of peanut butter throughout.
Freeze Until Firm: Cover the surface with parchment or plastic wrap, then freeze for at least 4 hours or until firm enough to scoop.