The 19-year-old's move to the Iron is subject to EFL ratification and he will take the No 26 shirt.
Born in Redcar, Hayden joined Boro's Academy at Under-10s level and has represented England Under-15s.
After impressive performances for Middlesbrough's Under-18s and Under-23s, the midfielder scored the winner against Burton Albion to give them their first-ever win in the Football League Trophy.
Hackney, who signed his first professional deal two years ago, made his senior debut when he started in their FA Cup third round match against Brentford in January 2021 before his league bow on the final day of last season against Wycombe Wanderers. He was rewarded with a new contract this summer.
"I'm delighted to be here, and just can't wait to get going," Hackney told iFollow Iron.
"The gaffer has told me what he wants and I also know (Iron coach) Tony McMahon from his time coaching at Boro and helped my decision to come here.
"I want to help the team as much as I can, play as many matches as possible, and hopefully get some wins. I want to chip in with some assists, goals and work hard for the team really.
"I'm a box-to-box midfielder who can do both sides of the game, defensively and creatively.
"I've been on the bench for Boro but I want to be playing and I can't wait to start."
See more from Hayden Hackney on iFollow Iron.