Tokudo is a ceremony in Buddhism to enter into priesthood.
Originally, everyone could become a priest if he had the approval of ten senior members of Buddhist society (sanshi-shichisho (three leaders and seven witnesses) and an oath to obey religious precepts, but because they were exempted from labors, tax payments, and military service in China and in Japan, many people became priests one after the other and developed into a situation threatening the national finances. Therefore, to limit the number of people who became priests every year and in the regions, government created the tokudo as a national license system.
After Buddhism originated in India was introduced to China, it had to be taken control of by the government, in addition to its original Buddhist religious precepts. Zanning of Northern Sung mentioned in the chapter 'Soseki Shicho' (tensioning and loosening of priesthood) of his writing "The Essential History of Great-Song Monks" as follows.
Originally, Buddhism had no reason to be controlled by the government, but because not only those that seek the truth, but also those who envy the elegance and gracefulness of a priest's life, and those that wished to escape from labor by entering the priesthood, increased so much, it became impossible for Buddhist precepts alone to restrain evil customs, and government thus started to take control by the establishment of priest officials and registration of priests and priestess.
Indeed in China, since the special privilege of exemption from labor was given to priests, many priests with the purpose of exemption from labor appeared, and because of that, the government established various restraining policies and regulations, such as limiting the numbers of priests receiving tokudo. Further, the priests officially recognized by the government were forced to become organized in priesthood, and this accelerated the control by the government. Simultaneously, official certificates as priests who were officially recognized by the government were issued by the government, and its control was further strengthened.
There were nenbundo, which approved fixed numbers of tokudo each year, and rinjido (approved tokudo on special occasions), and generally, the number of tokudo approved were limited to ten. Both were officially approved by passing examinations. The ones that were approved were issued an official certificate to prove the tokudo by government, and after the priestly teacher of the approved person guaranteed his name, age, and place where his family was officially registered, signed by officials and priests of Genbaryo and Jibusho (both ministries to manage diplomacy and registration of monks), it was provided with a seal by Daijokan (Grand Council of State). As those that were approved had the privilege to be exempted from labor, farmers who became priests without official approvals were appeared, that was called shido, and priests by shido, called shidoso, were prohibited by Kokonritsu (Penal Law on Households and Marriage) and Soniryo (Regulations for Monks and Nuns), which were both part of Ritsuryo code. Also, rinjido were hold in the occasions such as a shortage of priests in official temples, praying for restoration from illness and so on to nobilities such as the Emperor, and helping nobilities, who were permitted to approve fixed number of tokudo as an award by the government to nobilities, to accumulate good deeds.
However, even when the priest was shidoso, that person seems to be treated with tolerance when he has made proper ascetic practices and activities as a priest. In article of September 11, 758 of "Shoku Nihongi" (Chronicles of Japan, Continued), there is writing about tokudo approved to 'seiko isshi' (清行逸士) in various regions around the country, who have accumulated ascetic practices for more than ten years hiding in mountains and forests. It does use the expression 'seiko isshi' (ones with pure actions), but it shows the fact that sometimes shidoso, even though making ascetic practices without an official certificate, were not punished, but were even approved as monks. After that, in writings such as Rikkokushi (the Six National Histories), there are articles that are mentioned again and again about the examinations held to approve tokudo to ones that make ascetic practices, and it is believed that many of those examinees were shidoso. Shidoso was illegal and was an object to be regulated, but actually, it is believed that there were two different policies; on the one hand, strict regulations were made against those that became shidoso for the purpose of exemption from labor, but on the other hand, to some extent, those that held actual activities as monks were approved, and those that had excellent results were not objects to be punished, but rather were objects to be approved as tokudo and actively taken into the system. Further, there are Kukai, Encho (a leading disciple of Saicho), Kyokai (the author of "Nihon Ryoiki" (Miraculous Stories from the Japanese Buddhist Tradition, written in the early Heian period)), and so on as the ones that succeeded as shidoso.