"Shomonki" is an early war chronicle that details TAIRA no Masakado's War, which occurred in Togoku (the eastern part of Japan, particularly the Kanto region) in the middle of the tenth century.
There are no extant copies of the Shomonki. Two manuscripts are extant, the "Osukannon bon" and the "Yang Shoujing kyuzobon" (so named because it was once owned by Yang Shoujing), but the beginning sections of both manuscripts have been lost, and consequently, the original titles cannot be verified. It seems that during the Kamakura period, it was referred to as the "Shomon kassen sho" or the "Shomon kassen jo." The book chronicles TAIRA no Masakado's downward spiral from intra-family strife to full-fledged rebellion against the state, also depicting his final moments and death and even beyond, recording as it does the so-called "message from the underworld" he is said to have sent after his death from hell.
"Shinpukuji bon" has been handed down by the Shinpuku-ji Temple in Nagoya City, and it bears a postscript stating that it was transcribed in 1099. The Chinese characters are well-formed and the composition as a whole well-ordered, with few errors or corrections. The "Yang Shoujin kyuzobon" is said to have been owned by Yang Shoujing of Qing-dynasty China; Yang came to Japan at the beginning of the Meiji period. Compared to the Shinpukuji bon, there are many missing sections and the handwriting is extravagant and unrestrained; later corrections and additions stand out dramatically from the rest of the text, and many sections actually differ in content as well. However, certain researchers have offered the opinion that it's several decades older than Shinpukuji bon. The initial section is missing from both manuscripts, but judging from the Shohon shomonki ryaku (an abridged version of the Shomonki), it is possible to infer that the beginning of the book described the details of internecine strife in Masakado's family. In terms of literary style, both manuscripts are written in an abnormal kanbun (Sino-Japanese) script that shows strong influence from Japanese.
Who wrote it and when
Neither the author nor the date of writing is known, and opposing theories abound. One theory holds that the author must have been a Buddhist priest who was close to Masakado, because the author gave a very detailed account of TAIRA no Masakado's Rebellion and because both the general worldview expressed and certain specific episodes reveal a Buddhist perspective. Another theory argues that, because some descriptions are based on official documents, the author may well have been a nobleman in the imperial court. There are still different views. As for when it was written, at the very end of the manuscripts there is a note that it was "written in the sixth month of 940," so the theory that it was written immediately after Masakado's death predominated beginning in the Meiji period, but since entering the Showa period, the viewpoint has emerged that argues this date was actually a fabrication that is supposed to be attached to Masakado's message from the underworld. Some researchers, noting that the work also depicts Mappo (the final, decadent age in Buddhist cosmology), believe that it must have been written no earlier than 1052. Many university entrance exam study guides claim it was written during the Kamakura period.
Hachimanjin (the god of Hachiman-gu Shrine) and military government
According to "Shomonki," TAIRA no Masakado received an oracle from Hachiman Daibosatsu (Great Bodhisattva Hachiman) in 939 at the kokucho (office of local government) and called himself "Shinno" (new emperor). As shown here, Hachimanjin had an important role in releasing samurai from the orders of the Imperial Court and creating a world that was different from that of Amaterasu Omikami (the Sun Goddess). This was why the warrior class believed in the god Hachiman and took him to be a guardian deity.