How to reset the iphone 4 back to factory specifications?

There's a passcode on the phone that i can't get passed

Have you tried restoring using itunes?

Since it won't connect to iTunes until u place the code in u won't be able to restore it until u remove the code unless you force into recovery mode. If you need help you can call easysmartphonesupport.com and get help for about 15 bucks and occasionally on Saturdays for free