How to ID Various Objects

One option is to arrange for all the blocks to have a pair of contact pads on the base and connect them internally using a resistance which is unique for each block. In the socket put a couple of spring contacts which connect to the block when it is inserted properly. You might choose to put a lamp next to each socket and turn it on when you detect the block has been inserted, if you have any trouble getting a reliable connection.

Within the sketch, use the block's resistor as one half of a voltage divider so that you can calculate the resistance of the block and hence identify it.