How to kill a player when they touch a block?

Solution 1:

Put this command in a repeating, always active, unconditional command block:

execute @a ~ ~ ~ detect ~ ~-1 ~ grass 0 kill

This will execute the command kill at all players (@a ~ ~ ~) that have a grass block underneath them (detect ~ ~-1 ~ grass 0).