Could someone explain to me how the bitcoin transaction scripts work?How to build custom scripts? Also please explain the data structure of transactions as specified by the bitcoin protocol? How to collect unconfirmed transactions to start mining, what is protocol API for writing python scripts to collect transactions, generate blocks, build transactions and other necessary information to build a bitcoin client from scratch?
A client for transactional purposes can have less capabilities than a client that also will perform the tasks needed to support mining.
A lightweight client to review might be picocoin, "a tiny bitcoin library, with lightweight client and utils".