蝦夷共和國
Hayashi returned home in the midst of the Boshin War of the Meiji Restoration, and joined with Tokugawa loyalists led by Enomoto Takeaki, whom he accompanied to Hokkaidō with the remnants of the Tokugawa fleet. He was captured by Imperial forces after the final defeat of the Republic of Ezo at the Battle of Hakodate and imprisoned in Yokohama.