The Stannary Palace, also known as the Duchy Palace, circa 1265–1300, was a complex of buildings constructed by the Earls of Cornwall as the centre of their administration. The surviving exchequer hall is reputed to be the oldest non-ecclesiastical building in Cornwall. The much larger great hall, of which large parts remain, was built as a replica of Westminster Hall. Its original function was as a court and place of taxation dealing with the Cornish tin industry. The Earls of Cornwall and later, after 1337, the Dukes of Cornwall had their residence at Restormel Castle so the original name would have been the Stannary Hall or the Great Hall of Lostwithiel. After 1337 it was sometimes referred to as the Duchy Palace. In 1265 Richard, Earl of Cornwall, second son of King John and brother of King Henry III, acquired Restormel Castle, the Borough of Lostwithiel and the town of Fowey, from the de Cardinan family. During this period Lostwithiel was the most important port of Cornwall and second only to Southampton along the South Coast. In 1273 Richard died and was succeeded by his son Edmund, who took occupation of Restormel Castle and built the Great Hall. This building was a very large complex, covering more than and consisted of the Great Hall, which was the Convocation Hall for the Stannaries and Duchy affairs. It also housed the smelting houses, the coinage hall for the stannaries and duchy. In this complex the stannary courts were held and the stannary prison located. Records state that the whole complex was built and completed between 1272 and 1300 and regarded as the finest and grandest buildings in Cornwall. In 1338 the earldom was raised to a dukedom and the first duke was the Edward, the Black Prince. The building then became the administrative centre for the duchy and the only polling station for the whole of Cornwall. The Cornish Stannaries were suspended as a consequence of the Cornish Rebellion of 1497. Henry VII restored them in return for a payment from the tin miners of the, at the time, enormous sum of £1,000, to support his war on Scotland. In addition to restoring the stannaries and pardoning the people who participated in the rebellion, Henry's Charter of Pardon of 1508 provided that no new laws affecting miners should be enacted without the consent of twenty-four stannators, six being chosen from each of