Source: Serious Eats
Makes 1 quart (900ml). I bought these 10.75-ounce jars, and had exactly enough for three jars.
Put on disposable latex gloves if you have sensitive skin. I didn't use gloves and my hands were okay; just make sure to wash them before touching your eyes or lips.
Deseed the chilies. Place a wire rack on top of a baking tray. Using kitchen shears, cut down the middle of the chilies, from the stem to the tip. Most of the seeds should bounce and fall out after being cut. After cutting all the chilies, shake the wire rack over the tray so that the seeds fall through the holes of the rack onto the tray. Don't worry about removing every seed, but spot check a few chilies to see that most seeds are removed. Transfer chilies to a bowl and discard seeds.
Using a spice grinder (or a food processor, but this won't work as well), process chilies until they are ground to a size just larger than standard chili flakes. Place processed chilies into a heatproof bowl or pot large enough to accommodate bubbling oil (at least 4 quarts in size). Add the peanuts, ginger, black pepper, star anise, cardamom, cumin, Szechuan peppercorn, mushroom powder, salt, MSG (if using), and sugar. Set aside.
Set a strainer over a 2-quart heatproof bowl. In a 4-quart saucepan, combine oil and shallots. Cook over high heat while constantly stirring. When shallots are light golden brown, strain them through the sieve. The residual heat will crisp them up and darken their color to a deeper golden brown.
Pour oil back into pot and add garlic (if bits of shallot have fallen through the strainer into the oil, just fish them out before adding garlic). Cook over medium-low heat, constantly stirring, until light golden brown. This takes only about a minute or two, depending on how hot the oil is. Watch carefully and get ready to strain when garlic is just barely browned. Garlic can quickly become bitter, so make sure to stop cooking before it turns golden brown. Strain the garlic, then return oil to pot once more. Set aside fried shallots and garlic.
Heat oil to 375°F (190°C). Pour hot oil over chilies, spices, and other seasonings. Stir well to distribute hot oil, then let fully cool, about 30 minutes or until the bowl is cool to the touch.
Once chili-and-oil mixture has cooled, remove star anise and cardamom pods. Mix in shallots and garlic. Pour finished chili crisp into jars. It can be served immediately, but for best flavor, eat the next day. Stir well before serving. The chili crisp will keep in the fridge for up to 3 months.