The man accused of murdering five members of the Lin family allegedly had "numerous" conversations about the crime with a fellow prisoner who gained his trust, telling him where he bought the hammer and rope used in the attack and where they were hidden, a court has heard.
But the inmate subsequently turned on the alleged killer and will now give evidence against him in his Supreme Court murder trial in return for a reduction in his jail sentence.
Lian Bin "Robert" Xie is accused of murdering Min "Norman" Lin, 45, Mr Lin’s wife, Yun "Lily" Li Lin, 44, their sons Henry, 12, and Terry, 9, and Ms Lin's sister, Yun Bin "Irene" Yin, 39, in Boundary Road, Epping, in the early hours of July 18, 2009.
He has pleaded not guilty to all charges.
The opening of Mr Xie’s murder trial has heard the Lin family were killed by a combination of blunt force trauma inflicted by a “hammer-like object” and asphyxiation carried out with a ligature or bar.
Terry Lin survived for one to two hours after a "furious struggle" with his attacker and his brother was alive for at least 30 minutes after the attack.
Mr and Mrs Lin suffered multiple injuries to the face and head, which went far beyond what was required to take their lives.
Continuing his opening address to the jury on Monday, Crown prosecutor Mark Tedeschi, QC, said the inmate, known as "Witness A", would give evidence of about 21 separate conversations he had with Mr Xie over the course of 18 months they spent in neighbouring cells in Long Bay jail from mid-2011.
"They befriended each other and had a number of common interests, including ping pong, medical and health issues and doing business overseas," Mr Tedeschi said.
"Over many months, a level of trust grew between these two and the accused confided a number of things about these murders."
Mr Xie allegedly told his fellow inmate that he had bought the hammer involved in the murder at "a two-dollar shop which only had dummy cameras in it".
"He had a number of conversations about the hammer in which it was implicit that he knew where it was disposed of or hidden and that it could be obtained by someone on the outside."
Mr Tedeschi said that at a certain point the inmate decided to report his conversations to police, agreeing for a number of them to be secretly recorded, while others were reported in the form of letters written to the officer in charge.
He said the inmate had subsequently agreed to give evidence against Mr Xie during the trial.
This decision stemmed from reasons that were both "altruistic and not altruistic", including that he had received a substantial reduction in his prison sentence in return for helping police.
"Witness A is not a person who anyone would admire," Mr Tedeschi said. "He has served numerous prison sentences ... and has spent most of his adult life in jail.
"This includes offences of violence, violence towards his partner, offence of theft, offences of dishonesty.
"The Crown does not choose its witnesses."
The trial continues.