This article examines the rituals involved in wall construction in the Neolithic and Early Bronze Age of China. Since the building of a settlement wall required the involvement of most of the residents and the settlement gate was used as a public place, such rituals were probably conducted in public without any restrictions on the participants. During the Longshan period, when early states first formed in China, these ritual activities became increasingly elaborate and more humans were sacrificed. The people who were sacrificed were probably captives caught during warfare. Sacrificing enemies in public rituals can reinforce ethnic identity, which is conducive to the ideological formation of an early state.