In The Prosecutor and the Prey Arkady Vaksberg provides details about Krylenko's fate. The following is sourced from page 130 onwards.
the People's Commissar of Justice on 12th January 1938 when the
congress of the Supreme Soviet opened, Krylenko, who had done much
to promote chess in the Soviet Union, had been given a premonition of
his coming personal tragedy: he had not been elected the previous
December as a Deputy for any region and instead had to attend as a
guest. On 17th January, Dzhafar Bagirov, an ally of Beria's, attacked
Krylenko in a speech: Whereas Comrade Krylenko used to devote most of his time to tourism and mountaineering, he now spends it playing chess ... These words were accompanied by mocking laughter. Bagirov called Krylenko a poor Commissar of Justice.
During the Great Purge (also known as the Yezhovshchina, after Nikolay Yezhov)
many prominent Bolsheviks had testimonies prepared against them
from some time before, to be brought into play at the whim of the
dictator. The seeds of Krylenko's downfall had been planted a year
earlier, when he had had to reverse his positions held previous to
the purging of Pashukanis, a noted jurist. On 20 January 1937 Pravda printed the following about Pashukanis's beliefs: The judicial cretinism reaches Herculean proportions. It was said by a colleague of the People's Commissar of Justice: Many
had hoped that the fight against wrecking in the legal system
would be carried out by Comrade Krylenko, but in order to carry out
this task he will have to reveal a number of his own mistakes and put
an end to them. Krylenko had to concede of his defective ideas that vulgar, primitive contradiction does not become a Soviet lawyer.
Krylenko wrote article after article over the next few months in a
desperate bid to prove his loyalty and stave off the coming blow.
arrest warrant had been drawn up on 15th December 1937, before the
congress. It was not served until 31st January 1938. Five days before
his arrest, Krylenko took a phone call from Stalin himself: Don't
worry, we trust you. You'll get a new appointment, but in the meantime
get the Code ready. Be quick about it, the people are waiting. Work at
it like a Stakhanovite! Krylenko didn't finish the new legal
Code. Although the man who had named mountain peaks in the Pamirs
after Lenin, Stalin (this after it was discovered that there was a peak
higher than Lenin's!), Dzerzhinsky and Sverdlov temporarily took heart.
Krylenko was accused of being an agent of British Intelligence. His
explorations of the Pamirs allegedly enabled him to draw up maps and
prepare secret rendezvous. Eventually, however, his NKVD interrogators
concocted quite different charges. At first the questioning was led by
Lazar Iosifovich Kogan, a captain who was to be shot in 1939. His
biography in Russian is available here. Kogan set out to prove
that Krylenko had been an agent of multiple foreign intelligence
services, had planned to wipe out the entire Soviet leadership and had
schemed for the military intervention of foreign powers. The evidence had been built up over a series of previous interrogations of other enemies of the people, all of whom denounced Krylenko as a wrecker. When
Krylenko was rehabilitated in 1955, it was discovered that not one of
these denunciations could be found in the written statements of the
Krylenko held out for four days. On 3rd February 1938 he confessed to having conspired against Lenin from before the Bolshevik coup in 1917. He also admitted
to joining a body led by Bukharin in 1922 whose purpose was to stage a
coup. It is known that Krylenko was interrogated at least twice more,
on 3rd April and 28th July. On the konveier he revealed the names of around thirty accessories.
Not all of whom were subsequently arrested. At some stage Kogan
was replaced as the chief interrogator by Aronson. Krylenko assumed
that things were looking up and retracted his confession. He then saw
Aronson write: The person under interrogation confessed to everything.
This broke Krylenko, who signed the document. He was ready for trial.
It lasted twenty minutes, shortly after which he was shot. It was the
29th July 1938, the day after his final interrogation.