A warning regarding NaOH: NaOH (AKA sodium hydroxide, lye, caustic soda) is a strong base, which can be obtained as a drain opener. It is corrosive and will burn your body. If swallowed, don't induce vomiting and drink copious amounts of water. If it gets on your skin, wash it thoroughly with water and remove contaminated clothing. In case of eye contact, flush the eyes out with water for 15 minutes, lifting the eyelids occasionally. It is best to see a doctor, or at least call poison control, in case of any contact. See also the materials warning.
A warning regarding HCl: HCl (AKA muriatic acid, hydrochloric acid, hydrogen chloride) is a strong acid, normally obtained as muriatic acid at a hardware store. It is, by itself, a gas, but the stuff found at the hardware store is a ~35% solution (approximately the maximum concentration, you will see HCl vapors coming off). It needs to be used in a well ventilated area, especially when dealing with larger amounts. First aid procedure is the same as for lye. Check the materials warning for compatibility information.
A warning regarding materials: There are a few things to take note of before deciding what containers and implements you will use in your extraction because the chemicals used are quite harsh. Xylene will dissolve most plastics, with the notable exceptions of HDPE (recycling number 2) and PTFE (Teflon). HCl will react with most metals, so don't use those. If you forget about plastics, this leaves you with one good option: glass. Glass isn't fully immune to the chemicals either, however; lye tends to slowly attack it making it brittle and easily breakable, so watch out for that.
Put the cold water into the gallon jug and mix in the NaOH (400g). This will generate heat, and this is why the water should be cold. You don't want this nasty stuff boiling over on you! It might take some stirring to get all of the NaOH into solution. Now add your cactus powder. Use anywhere from 100 - 200 grams of dried cactus, or it's fresh equivalent. Next, add 1 liter of xylene. It will sit on top of the water like oil. I like to draw a line around the jug where the xylene interfaces with the water/cactus/lye at this point so you know when it's done settling/separating later on (You'll see what I mean as you read on). Finally, mix this up occasionally, letting it settle in between mixings, for about 24 hours. Try to completely homogenize the layers because the better you mix it up, the better this will work, and the fewer extractions you'll have to perform in the long run. The idea is to get as much contact between the xylene and water/cactus/NaOH as possible. Most people find the best way to mix is to roll the jug around. If you shake it too vigorously, you will end up creating an emulsion that will take a long, long, time to settle out. If this happens setting the jug in hot water and/or adding more NaOH can help break up the emulsion. Another trick for getting it to separate better if you are having problems is to add more NaOH. This drives up the density of the water layer, making the xylene more buoyant
The lye serves two purposes here. It 'freebases' the mescaline (detatches the acid molecule), and it breaks down the cactus to release the mescaline from the cells. After the mescaline is freebased it becomes soluble in the xylene layer and insoluble in the water layer and therefore moves to the xylene.
After mixing for around 24 hours and allowing the xylene and water/cactus to COMPLETELY separate, the xylene needs to be drawn off and put into the mason jar. You want to get as much as you can without getting ANY of the water/cactus/NaOH along with it. This is very important. If any of the NaOH gets into this step, it will consume your acid (so to speak) and also produce sodium chloride (table salt - NaCl), which will result in a less pure product and thus affect dosage. And if, god forbid, way too much gets in, the lye may not react with all of the acid, and the remainder of the lye will end up in the product. This could be DEADLY! Add approximately 5 drops of HCl to ~1.5 ounces (45ml) of water. It's always better to use less acid rather than more. If you use too much, it can 'burn' your final product. If you use too little, all of the mescaline won't be converted to it's salt form, but it will be converted when you repeat this step later on so in the end it won't matter. Pour this acid water into the xylene in the mason jar and shake. Allow the layers to separate. Decant (pour off) as much of the xylene as you can back into the main jug. The easiest way to get rid of the remaining xylene is to put the mason jar (with the lid still on) into the freezer. The water will freeze, but the xylene won't. Just pur the xylene off (again, into the main jug) and rinse with a small amount of water to get any residue. Pour the rinse water back into the main jug as well. Another way to do it is to use an eye dropper or syringe to suck up as much as you can. Do what works for you (maybe a combination of different techniques), but whatever you do, make damn sure that you get as much of the xylene off as is humanly possible. A little TINY bit will almost certainly remain, but it's not a huge deal. Now, save the water for step 3 or evaporate it right now to get your mescaline. Now go back to the part where you mix the xylene and water and repeat at LEAST 3 times, probably using 1 drop less acid each time.
Adding the acidic water to the xylene converts the mescaline back into its salt form. The salt is soluble in water but not in xylene, so it moves into the water.
Now all that's left to do is evaporate your water. This will leave you with the alkaloids. The more surface area, the more heat, and the more air flow, the faster evaporation will go. I don't suggest boiling the water, but you can if you wish. Just make sure to stop the boiling before the water is all gone, or you may burn off the mescaline! The resulting powder should be white or a slight yellow as seen in the picture. If yours is more colorful, it usually means you used too much acid. Just add a little less next time. I suggest doing a tiny taste test on the product to make sure it's of good quality, and it should be if you followed directions carefully. It shouldn't taste salty (NaOH + HCl -> NaCl + H2O), or burn your mouth with a very bitter taste (as lye would). A strong sour taste indicates that it is still wet with acid. A small amount should be bitter, but not overly so. You can aslo check to see if there is acid or NaOH in the product by taking a small amount, putting a drop of water on it, and testing with litmus paper. Those are the three main possibilities as far as contaminants go, assuming that you followed the directions about HDPE/PTFE/glass. Salt contamination would not be a huge deal, but bear it in mind when dosing and be more careful in the future; A little more NaOH carrying through in the previous step and you could have had a majorly dangerous problem on your hands (see the warning in the step above). If you want a more pure product, you can recrystalize, or do a cold acetone rinse. I won't cover that here, but there is information on both subjects on the internet. One more thing; Make sure that the alkaloids are completely dry before you attempt to scrape them up with something metal such as a razor blade. The acid will react with the metal and possibly contaminate and discolor your product, as well as dull and corrode the blade.
Notes on dosing: The product obtained here is NOT pure mescaline by any means because the other alkaloids in the cactus are extracted as well. Recrystalization will yield nearly pure mescaline. The acid used also affects your dose because of the differing molecular weights. See Erowid's dose page in the mescaline vault for more information. I find that about 450mg of this crude (not recrystalized) extract approximates 350mg of pure mescaline, but this will depend on your cactus. If you recrystalize or acetone wash, you can dose more accurately.