"The Legend of Wenlong" is an ancient folk story of Han Chinese origin. Today it is mostly known in its operatic form as Liu Wenlong and the Water-chestnut Mirror. It is now a traditional song of the Zhuang people that is sung at the Dragon Boat Festival in some places.
'The lost Nanxi opera version of Liu Wenlong and the Water-chestnut Mirror is the source of the versions found among the Zhuang, Dong, Buyi, Maonan and Mulao peoples of Southern China.The story has at least an 800-year-old history and remains a form of cultural entertainment to this day both as a traditional Zhuang opera and within a number of Chinese opera adaptations.
In 16th century Ming Dynasty the famous painter, poet, writer and dramatist Xu Wei mentions "The Legend of Wenlong" in a list of 65 12th century Song Dynasty Nanxi operas under the title 刘文龙菱花镜 (Liu Wenlong and the Water-chestnut Mirror). However, all copies of this opera have been lost. The fifteenth century Yongle Encyclopedia, the largest known encyclopedia at the time, mentions the opera-play Liu Wenlong.
Although the original version has been lost, the general content of Liu Wenlong and the Water-chestnut Mirror is still known to a degree. A comparison of the roles and plot make it clear that the Zhuang version is adapted from this lost opera-play. Since there is no record of when its transition from Chinese took place, it is assumed to have happened from the Song Dynasty onwards, most likely during the Ming Dynasty. It has been preserved in written form using the traditional Zhuang writing system, Sawndip since the Ming or Qing dynasties. Although their lengths vary, most of the Sawndip manuscripts are about 500 lines long. Some versions have five characters per line and others seven characters per line.