A drug dealer was caught after his behaviour in the street attracted the attention of police, Lincoln Crown Court was told.
Officers stopped Sam Bradley in January 2014 because they thought his behaviour indicated he may have been taking drugs.
Bradley, 22, of New Street, Sleaford, admitted charges of being concerned in the supply of drugs, supplying drugs and possession of drugs.
On Thursday Bradley was given an eight month jail sentence suspended for two years with 12 months supervision and 100 hours of unpaid work.
Steven Taylor, prosecuting, said Bradley appeared extremely nervous and as a result he and his companion were searched.
“Bradley volunteered that he had some cocaine and he produced and handed to the officer four bags of white powder.
“He was arrested and went on to give a full and frank account in his interview.”
Bradley had admitted that he had supplied cannabis found on his friend. He added that he had been asked to take the cocaine to another person and was on his way when he was stopped.
Adam Pearson, defending, said Bradley had been a recreational user of cannabis in the past but had stopped taking the drug since his arrest.
Mr Pearson added: “He is at the very bottom rung of the ladder of those involved in the supply of drugs.
“He is a well-spoken and quiet man with motivation for the future. He has never been in trouble with the police before.”