Chinese labour forces ebbed and flowed around the newer countries during the 19th century. The Chinese working on US railways weren't slaves, although they worked vey hard for very little pay. Many of them came directly from the failed goldfields of California or the Chinatown slums of San Francisco.

Although they were accepted on the west coast, the midwest and the east never really felt comfortable with Chinese neighbours, and they weren't encouraged to stay. Many of them made enough money to go back to China and live in some style, but many more remained or moved on to Australia and New Zealand as gold fields opened up in those two countries.

I read a book about this very subject some years ago, but I can't remember the title or the author, I'm afraid.