You can't actually melt gold from rocks; if you hold a rock over a flame hot enough to melt gold and expect the gold to dribble out, you're going to be disappointed. The process of extracting gold from ore is a multistep one, and historically it has involved the use of some dangerous chemicals, including cyanide and mercury. Cutting-edge extraction techniques have eliminated the need for these chemicals and made the process much safer. It's still too dangerous to try at home, though.
Crushing the Rock
Rocks that contain visible gold veins usually have gold inside them. To make it accessible, extractors crush the rocks into small pebbles and then grind the pebbles into a powder. In days gone by, miners and prospectors did this with hammers and a mortar and pestle, but modern gold processors use large machines called crushers to make the pebbles. They feed the pebbles into other crushing machines to make a powder or slurry. Although this process exposes all the gold, the metal is still mixed with a variety of other minerals. Gold is heavy, so processors usually agitate the slurry to separate the gold compounds, which tend to fall to the bottom of the container.
When processors soak the slurry in an aqueous cyanide solution, the gold and silver in the ore form a metal-cyanide complex. Before they introduce the slurry to a cyanide solution, they add lime to increase the pH to 10 or 11. This prevents the release of toxic cyanide gas. They also introduce oxygen or peroxygen compounds as oxidizing agents in increase the leach rate. Either during the leaching process or directly after it, processors introduce activated carbon, which adsorbs the metals to form lumps that can be easily removed from the mixture by screening. A second treatment with a cyanide solution separates gold and silver from the carbon, and the carbon is recycled. Processors extract gold from the solution by electrowinning, which requires putting the solution in a cell with a pair of electric terminals and passing a strong electric current through it, which causes gold to collect on the negative terminal.
In 2013, a team of researchers led by Zhichang Liu published a report in "Nature" describing their discovery of a gold extraction method that replaces cyanide with harmless cornstarch. None of the by-products from this process are dangerous.
Gold and mercury quickly form an alloy, so people have used mercury amalgamation for centuries to extract gold from ore. The ore must be thoroughly clean to ensure optimum contact between the gold in the ore and the introduced mercury. One way to clean it is to wash the ore in a solution of nitric acid. Mercury can be introduced in several ways – one is to rub it on the bottom of a pan, pour in a solution of the cleaned slurry and water and then agitate the mixture. The gold combines with the mercury, which can be scraped off the pan with a spatula. The alloy must then be treated, either with heat or sulfuric acid, to recover the mercury. Both processes release dangerous mercury gas.
Refining Recovered Gold
The best way to recover gold from a terminal after electrowinning is to heat the terminal to a temperature that exceeds the melting point of gold. This temperature is 1,945 degrees Fahrenheit, and it takes a furnace to supply that much heat. An open flame seldom does the trick. It's common practice to add a flux, such as borax, to the gold to lower the melting point and make the process more efficient.
Processors form gold recovered in this way, which may be mixed with silver and other metals with a lower melting point, into low-quality doré bars, which must be refined further to get pure gold. It's possible to do this with chemicals or with heat.