After installing iPhone OS 4.0, you will lose your jailbreak and unlock on your iPhone and iPod Touch, and being beta release you may not look forward to continue with it. If you are looking for a solution to downgrade iPhone 4.0 firmware to 3.1.3 then follow the steps below (only for mac users). Windows users may follow separate instructions here.
Steps to downgrade iPhone 4.0 firmware to 3.1.3
Step #1 Copy the application “iRecovery” on the desktop and install the library “libusb”.
Step #2 Open iTunes, click the ALT key + Restore and manually load the original 3.1.3 firmware.
Step #3 During the restore process, you’ll notice a pop up with error 1015, neglect it.
Step #4 Click Ok to close the pop-ups and close iTunes.
Step #5 Now open the terminal and type the following commands:
. / iRecovery -s
setenv auto-boot true
Step #6 Wait a few seconds and disconnect the iPhone from the cable, then reboot the phone by clicking Home + Power buttons simultaneously.
Step #7 Once you connect the phone via USB and proceed normally, the Apple logo appears on the display.
Voila! The downgrade from iPhone OS 4.0 to iPhone OS 3.1.3 is successfully completed.