Abraham Lincoln was elected president in 1861 and signed the Pacific Railroad Act in 1862, which directed the construction of the first transcontinental railroad across the United States. The railroad was built between 1863 to 1869 by thousands of Irish, Chinese, and black workers and connected the Union Pacific Railroad in Omaha, Nebraska to the Central Pacific Railroad in Sacramento, California. The completion of the railroad in 1869 transformed the United States by enabling mass migration westward and the growth of towns and cities along the rail line, including Cheyenne, Wyoming and San Francisco, California.