Last week Apple announced a repair program for the iPhone 8 ($679 at Walmart). According to the company, some iPhone 8 phones produced between Sept. 2017 and March 2018 may experience random freezing, unexpected restarts or won't turn on.
Apple published a page where users can check to see if their phone is eligible for a free repair.
Visit this page, preferably on your iPhone 8 (just to speed up the process).
Then locate the serial number of your iPhone 8 in Settings > General > About > Serial number. Long-press on the serial number and select Copy, then paste it into Apple's webpage for checking to see if your device is part of the repair program.
If your device is eligible for the repair program, Apple will detail your next steps to get the logic board in your phone replaced, free of charge.