After seeing a spy lurking around his house in Ukraine, Andrew Charnetski hastily removes his family to a safe location. While away, Peter of the Button Face, acting under the orders of Ivan III of Russia, burns the Charnetskis' village to the ground in search of the "Great Tarnov Crystal", a mysterious Tarnov crystal that has caused many wars over the millennia and had, a few centuries previously, been entrusted by the city of Tarnów to the Charnetski family for safeguarding until its discovery by others, at which time it was to be given to the current king of Poland.
Realizing that someone must have been after the crystal, and finding himself homeless, Andrew takes his family to Kraków, where his cousin Andrew Tenczynski lives, in order to give the crystal to King Kazimír Jagiełło. However, upon his arrival he finds that Tenczynski has been murdered and that his estate is under the control of Elizabeth of Austria, the queen of Poland. Destitute, Charnetski camps his familyin the middle of the city for the day.
Charnetski's fifteen-year-old son Joseph explores the city, passing the Church of Our Lady St. Mary, from which a trumpeter plays an unfinished song called "the Heynal" [in Polish: Hejnał mariacki ] four times every hour, once to each direction (north, east, south, and west). Joseph ends up saving an alchemist named Nicholas Kreutz and his niece, Elżbietka, from a wolfdog (even though the book said a dog). Kreutz offers Joseph and his family an apartment just below his on the unsavory Street of the Pigeons, a street near Kraków University where scientists and magicians often live.
Meanwhile, Andrew Charnetski and his wife (who is never named) have been found by Peter of the Button Face, who has pursued them from Ukraine. Surrounded by bandits and a jeering crowd, Andrew, his wife, and Joseph (who joins them) are only saved by the appearance of Jan Kanty, a respected scholar and priest. Kanty offers Andrew the position of night trumpeter in the Church of Our Lady St. Mary. Delighted at the prospect of a job and home on such short notice, Andrew accepts both offers.
The following night Andrew takes Joseph with him to the tower of the Church of Our Lady St. Mary, leaving his wife behind with Elżbietka. In the tower Andrew explains to his son the story of the trumpeter of Kraków — a trumpeter who, in 1241, was pierced by a Tartar arrow before he could finish the Heynał. Accordingly, the song has always been abruptly cut short.
Nicholas Kreutz, meanwhile, teaches a German student named Johann Tring chemistry in the loft above his apartment every evening. Tring, however, is obsessed with the idea of obtaining the philosopher's stone, and finally convinces Kreutz to go through sessions of hypnosis, which Tring believes will open Kreutz's "Greater Mind", revealing the secret of the creation of a chrysopoeia. All Tring can glean from Kreutz's trances, however, is that the chrysopoeia is at hand (which Tring takes to mean that they have nearly discovered how to make it).
When unhypnotized, Kreutz reasons that there cannot be one stone that automatically changes brass into gold, but that there must be a process by which such a change could occur. He believes that all things are subject to change, and wishes to change the bad things in the world to good things through the use of alchemy. An example he gives is the landlady's deformed son, Stas, whom Kreutz believes could be saved through alchemical transmutation.
In the meantime, Peter of the Button Face hears Stas, the landlady's son, discussing the Charnetskis and pays him a fortune to learn of their whereabouts. He leads a burglary on the Charnetski's apartment while Andrew is up in the church tower, and discovers the Tarnov Crystal hidden in Andrew's mattress. He and his men are surprised, however, by the appearance of Nicholas Kreutz, clad in clothes covered in phosphorus and burning resin, and take him for a demon. The bandits flee and are caught by the night watchmen, but Peter stays to reclaim the Crystal. When Kreutz asks the mercenary why he has come, Peter realized the alchemist is not a demon and stops being afraid. He directs Kreutz's attention to the Crystal, then trips the alchemist and grabs the gem, heading for the door. Kreutz throws some explosive powder at Peter, who drops the Crystal in agony and escapes over the rooftops of Kraków.
Tempted by the realization that the Crystal is the chrysopoeia he and Tring have been ardently seeking, Kreutz steals the Tarnov Crystal before anyone figures what has happened. When he tries to use the Crystal, however, Kreutz realized that it only makes him think of his own desires. He realized, then, that it can only reflect back the gazer's own subconscious knowledge, and therefore will not reveal the secret of chrysopoeia unless he himself has all the pieces stored somewhere in his head.
Andrew teaches Joseph the Heynał, realizing that he may be attacked by seekers of the Crystal and that someone must be left to trumpet the song on the hour. While in the tower one evening, Andrew and Joseph are attacked and held captive by Peter and his band. Peter demands to be led to the location of the Crystal (which neitherAndrew nor Joseph knows), but first orders Joseph to trumpet the Hejnał since it is two o'clock and its absence will be noticed. Thinking quickly, Joseph plays the Hejnał the entire way through, not stopping at the broken note. Elżbietka, lying awake in her apartment waiting to hear the Heynał,realizes the finished tune is a sign and rushes to Jan Kanty's cell. Kanty calls the night watchmen to his aid and heads for the church tower, where they surprise the bandits and free Andrew. Peter, meanwhile, notices the troop of watchmen and flees the city.
Much later, Kreutz finally gives in to temptation and reveals the Crystal to Johann Tring. Tring is giddy with excitement and instructs Kreutz to gaze at the crystal. The alchemist, however, is tired from his numerous trances and goes into one as he stares at the gemstone. In it his thoughts arrange themselves into a strange order, and he reads in the stone what Tring believes to be the formula for the chrysopoeia, but what is in actuality the formula for a niter-based explosive. When Tring mixes the ingredients together, the loft explodes into flames and Tring flees for cover. Kreutz grabs the stone and, still crazed, heads off into the streets of Kraków. After that, he is dragged to the tower by Jan Kanty and the Great Tarnov Crystal is given back to Pan Andrew.
The fire starts to spread through the Street of the Pigeons, and during the tumult the king's royal guards catch Peter of the Button Face skulking around the scene and haul him off to the prison. Joseph, his mother, and Elżbietka escape from their home to the church tower, and Joseph replaces his father as the trumpeter while Andrew goes to work stopping the flames, which have spread throughout the city. The fire is extinguished by the morning and Jan Kanty finds Nicholas Kreutz wandering aimlessly about in the rubble with the Tarnov Crystal in his hands.
Jan Kanty, Nicholas Kreutz, and Andrew and Joseph Charnetski all seek an audience with King Kazimír. Once granted, they present to him the Tarnov Crystal and tell them its story and theirs. The king then summons Peter of the Button Face, who bargains for his life by promising to tell the king why there have been disturbances in Ukraine. He tells the king that Ivan III, the king of Russia, wished to have Makhmud Khan invade Ukraine and capture it for Russia. Makhmud agreed under the condition that Ivan would procure for him the Great Tarnov Crystal. It was thus that Ivan hired the mercenary Bogdan Grozny, called Peter, to steal the Crystal.
After hearing Peter's story, Kazimír banishes the mercenary from Poland for life. As they begin to depart, the king gazes into the Crystal and becomes transfixed. Kreutz, still entranced, grabs the Crystal and runs out the door down to the banks of the Vistula, into which he throws the Tarnov Crystal. Jan Kanty and the king decidenot to retrieve the crystal, deeming it safely protected in the grounds of the castle. Andrew Charnetski's house in Ukraine is rebuilt and he is rewarded by the king. Kreutz and Elżbietka come to Ukraine as well, the alchemist having regained his sanity, and six years later Joseph marries Elżbietka.