Patriot Number One: American Dreams in Chinatown by Lauren Hilgers:
Men fled China, going wherever there was work. They traveled to Peru to harvest the bird guano that was a popular and expensive fertilizer in Europe. They found their way to Cuba and worked on sugar plantations. In America they became refugees and coolies, a cheap labor solution in the aftermath of the Civil War. Drawn to San Francisco by the Gold Rush, they took over gold claims that other miners had abandoned, in locations where the work was particularly hard or the gold scarce.
Most of the laborers fleeing China paid for their journey to the United States by way of a credit-ticket system. Agents would pay for their passage to California, later to be reimbursed with interest. A network of Chinese middlemen recruited immigrants from China for big U.S. companies. In San Francisco, family-based associations opened halfway houses close to the port, offering new arrivals a place to sleep, eat, and bathe. In exchange, the clan organizations required immigrants to pay a fee before leaving town. Deals were made with shipping companies to ensure that any laborer who had yet to pay down the debt he had incurred for passage to the United States would not be allowed return passage to China.