Sentencing Francesco John Prevete to at least 23 years in prison, the judge at Mold Crown Court said: "you carried out a brutal and ferocious attack on Craig Maddocks.”
Prevete showed no emotion as the sentence was passed.
Mr Justice Jeremy Baker detailed the injuries inflicted by more than 50 stab wounds, causing "a significant degree of mental and physical suffering”.
He said the victim would have been “conscious of what you were doing to him.”
The judge said that there was evidence that Mr Maddocks’ use of cocaine meant that he owed people money, including £300 to Prevete's father - and that Prevete decided to punish him.
He denied murder during the trial, and Mr Justice Jeremy Baker said: “Because of your claim to have no knowledge of the offence, it may never be known with certainty what lay behind your decision to kill him."
Detective Constable Laura Griffiths from North Wales Police read out a statement from the family of Craig Maddocks, after Francesco John Prevete was sentenced to at least 23 years in prison for his murder, in the toilets of a Wrexham pub last year.
It said: "our lives have been totally unbearable over the last 12 months due to the murder of our son. Craig loved life and loved to make people smile. He was loved and adored by all of his family and friends."
"We as a family will never get over the dreadful circumstances of how Craig died, and our lives will never be the same again."