During the Ming dynasty, the area of present-day Taishan was carved out of Xinhui County on 12 February 1499 as "Xinning County." By the 19th century, Xinning was already a source of migrant and emigrant workers, but a series of subsequent natural and political disasters in the exacerbated the situation. Aside from the disruption of the Sea Ban regulations ("Haijin") themselves, their revocation led to an influx of northern settlers who began long-running feuds with the returning locals; this erupted into full-scale war in the 1850s and '60s. The 1842 Treaty of Nanking that ended the First Opium War opened China to greater foreign trade just before the California Gold Rush made the prospect of emigration to the United States appealing. Many also served as contract workers abroad, as in Hawaii and Cuba and—most famously—for the Central Pacific half of America's Transcontinental Railroad, where the Chinese made up 80% of the company's workforce as they laid track over the mountains and deserts of the west. By 1870, there were 63,000 Chinese in the United States, almost all in California.