Samurai were the hereditary military nobility and officer caste of medieval and early-modern Japan from the 12th century to their abolition in the 1870s. They were the well-paid retainers of the daimyo. They had high prestige and special privileges such as wearing two swords. They cultivated the bushido codes of martial virtues, indifference to pain, and unflinching loyalty, engaging in many local battles. During the peaceful Edo era they became the stewards and chamberlains of the daimyo estates, gaining managerial experience and education. In the 1870s samurai families comprised 5% of the population. The Meiji Revolution ended their feudal roles, and they moved into professional and entrepreneurial roles. Their memory and weaponry remain prominent in Japanese popular culture.