The first transcontinental railroad was largely built by Chinese immigrants. These were males who had come to San Francisco and were living on the west coast alone and had escaped China due to economic reasons or because of the Chinese Civil War. Other people building the railroad were veterans of both the Union and the Confederate Army.