Move code from script to wallet

Continues #4754
Sorry, I always get confused with symbols, should it be:

   wallet.cpp \
   wallet_ismine.cpp \
   walletdb.cpp \

or 

   wallet.cpp \
   walletdb.cpp \
   wallet_ismine.cpp \

?