Lin's deal includes a player option for the third year, a trade kicker and bonus provisions, a league source said.
Lin confirmed his agreement with an Instagram post shortly after The Vertical reported that he was nearing a deal.
His agents, Roger Montgomery and Jim Tanner, completed the deal with Nets general manager Sean Marks on Friday morning. Lin's $12 million annual salary is a steep increase from the $2.1 million he earned with Charlotte this past season.
Lin, 27, has had stops with the Golden State Warriors, New York Knicks, Houston Rockets, Los Angeles Lakers and Hornets. For Lin, it is a return to the New York market where Linsanity was born with the Knicks during the 2011-12 season. New Nets coach Kenny Atkinson was an assistant with the Knicks that season and built a strong relationship with Lin.
The Nets had been aggressively pursuing Lin since the start of free agency on Friday, beating out several teams, including New Orleans, league sources said.
Lin had a strong season for the Hornets last year, averaging 11.7 points and three assists.
More NBA coverage from The Vertical: