how to erase all personal data from iphone 4 while preserving JB?

hi, i currently have an iphone 4 running 4.2.1 jailbroken on greenpois0n. i found a buyer and i should be selling it tomorrow. i need to know how to manually erase all accounts and personal data from phone while preserving the jailbreak for the buyer (a friend).

thank you.
There was a similar question posted here, maybe their suggestions will help you as well. best way to erase all personal data and keep jailbreak/unlock?
ouch... that sounds like quite a hassle.... thanks!
i have another question... im reading about this baseband 6.15... is this the latest version of te bb or is this some sort of mod to unlock phones? the only reason why im selling it is because it's locked to my current network and im moving to another country and my baseband is 3.10.

if im able to safely software unlock it then id probably just keep it!
It's a mod to unlock, but you can't use it on the iP4. 3G/3GS only.
so still iphone4 can't be unlocked huh... hmm...
isnt there any way i can legally factory unlock my phone? like buy a code from apple or something?
If you're moving to another country, you might try calling your carrier or Apple Support just to see. Doesn't hurt to try.

Original thread: https://forums.imore.com/threads/how-to-erase-all-personal-data-from-iphone-4-while-preserving-jb.218326/