The Great Xia Dynasty is ruled by an empress, who is forced by powerful ministers to abdicate. The male lead, Lin Bufan, is reading a novel when he suddenly dies and transmigrates into the body of a young eunuch in the Great Xia Dynasty, just as the boy is about to be beaten to death with fifty strokes of the cane. He talks his way out of death. After the empress discovers that he is not actually a eunuch, he uses his knowledge of modern technology to rise to the position of chancellor and help her secure her rule. He eliminates the powerful ministers, recovers lost territory, wins the empress's heart, and becomes the new ruler.