8KkJlehpBNmASDD5HijskBxB3RRPCYWlasiLEK6BJ7fZKJk4YyR7ikKER1eVb28KkJlehpBNmASDD5HijskBxB3RRPCYWlasiLEK6BJ7fZKJk4YyR7ikKER1eVb28KkJlehpBNmASDD5HijskBxB3RRPCYWlasiLEK6BJ7fZKJk4YyR7ikKER1eVb28KkJlehpBNmASDD5HijskBxB3RRPCYWlasiLEK6BJ7fZKJk4YyR7ikKER1
Here's what was going on in Deadwood. In 1868, the U.S. government signed a treaty with the Lakota that recognized their ownership of all of South Dakota west of the Missouri River, a region that includes the sacred Black Hills. However, this treaty was ignored by pretty much everyone except the Lakota - gold prospectors repeatedly entered the reservation, and the Army even staged an expedition led by Lt. Col. George A. Custer in 1874. Custer's expedition confirmed the presence of gold in the Hills, and the Army and Ulysses S. Grant's administration decided it would be easier to change the treaty than enforce it. The Lakota steadfastly refused to give up the Black Hills under any circumstances, and the Black Hills War ensued - this war saw the Battle of Little Bighorn and of Slim Buttes, both of which were mentioned in the show (in fact, the first season takes place between these two battles, with Swearengen mentioning Custer's death in the early episodes and E12 featuring General Crook making a speech about Slim Buttes).
The residents of Deadwood knew they were technically illegally settled on sovereign Native American land, and that the Lakota and Cheyenne were more than willing to fight for it, so attacks on travelers did happen - but it's important to keep in mind that when Swearengen offers a bounty for Indian heads, that's also true. In 1862, U.S. Surgeon General William Hammond established the Army Medical Museum and issued a standing order to all officers stationed on the frontier to collect Indian bodies for study and display, and in 1868 this was followed with an order emphasizing the importance of collecting skulls (the Smithsonian to this day holds more than 18,000 partial or complete Native American bodies). One officer reported (proudly) that he had waited until grieving families had left a burial site, then ventured out under cover of darkness to disinter the bodies and remove the skulls. Other instances of skull collecting were investigated and it was revealed that the Indians had been murdered for the express purpose of sending their skulls to eastern museums.
So to answer your question "Was it after settlers have already done wrong doing to the tribes?" I would argue yes, it was after the settlers had done wrong to the tribes. Bullock is attacked by a Lakota who Utter later says was infuriated by his friend's decapitation - not a random attack on a traveler, but one inspired by a desire for revenge as dictated by his code of honor (which was widely shared among Plains and Rocky Mountain nations, and was quickly adopted by Euro-Americans, especially ones who worked or traded heavily with Natives).
I've only seen a few episodes of Hell on Wheels, but Native Americans definitely realized that trains were bringing settlers to their ancestral land in large numbers, and these settlers had different ideas about how to best use the land than the Natives did. They also wantonly slaughtered the buffalo, which Natives correctly interpreted as an attack on their way of life and chief means of sustenance, and declared their personal ownership of land and water sources that Natives had always seen as perhaps belonging to one tribe or another, but with use rights for all. Not to mention that these settlers carried smallpox, measles, typhoid, and other diseases that absolutely decimated Native communities. Attacks on wagon trains, railroad work parties, and the railroads themselves were inspired by a recognition that these were the causes of the Natives' shrinking land, population, and resources.
Sources: Andrew Gulliford, Sacred Objects and Sacred Places; Elliott West, The Contested Plains; Devon A. Mihesuah, ed., Repatriation Reader: Who Owns American Indian Remains?; James Riding In, Six Pawnee Crania; Hampton Sides, Blood and Thunder
Post Script: In 1877, the U.S. Senate modified the 1868 treaty to make it easier to "legitimately" take the Black Hills from the Lakota. Although the changes were never accepted by the tribe, the government went ahead with their plan and dispossessed the Lakota. In 1980, the Supreme Court upheld a decision finding that Lakota had been illegally dispossessed and were owed $15.5 million for the land itself (in 1877 market value) and an additional 103 years' worth of interest, totaling $105 million. The U.S. currently owes $1.3 billion to the Lakota, many of whom are not interested in the money, but rather in the return of their sacred and illegally taken land.