In 1862, the Pacific Railroad Act chartered the Central Pacific and the Union Pacific Railroad Companies, tasking them with building a transcontinental railroad that would link the United States from east to west.
The two companies both were tasked with this job, though there could have been some competition.