9 January] 1901 in the village of Bolshoye Frolovoye, Tetyushsky Uyezd, Kazan Governorate (now in Buinsky District, Tatarstan) to a peasant family.
Entering the 6th Saratov Artillery Courses in September 1921, he fought as a squad leader on the Turkestan Front against the Basmachi movement between May and November 1922 with a student detachment.
Shafranov served as a head of a sector and department at the Defense Committee of the Council of People's Commissars from July 1938.
[3] After the beginning of Operation Barbarossa, the German invasion of the Soviet Union, in June 1941, Shafranov was given command of the 778th Artillery Regiment of the 247th Rifle Division of the 31st Army of the Reserve Front in July.
During March, in the Rzhev–Vyazma Strategic Offensive, Shafranov, promoted to major general, "skillfully organized the breakthrough of forward enemy defenses" before the division crossed the Volga and captured Rzhev.
Subsequently, with the 11th Guards Army of the Bryansk Front, he led the division in Operation Kutuzov and the battles for Karachev and Gorodok in mid-1943.
For his "skillful leadership" of the corps in the late June 1944 Vitebsk–Orsha Offensive of Operation Bagration, during which it made a flank maneuver and captured the rail junction of Orsha, he was awarded the Order of Bogdan Khmelnitsky, 2nd class.
During the July Kaunas Offensive, the corps crossed the Neman and advanced 50 kilometres (31 miles) in three days, capturing Kalvarija.
Under his command, the army fought in the East Prussian Offensive, capturing Schirwindt, Labiau, Wehlau, and Tapiau, which covered the approaches to Königsberg.
Transferred to become head of the Military Command Academy of the Air Defense Forces in December of that year, Shafranov was promoted to colonel general in 1958.
In August 1961 he became the representative of the Supreme Commander of the Unified Armed Forces of the Warsaw Treaty Organization to the Hungarian People's Republic, the last position held before his retirement in 1965.