There are two concepts to distinguish to understand why
UNPACK requires a type in Michelson (and SmartPy) but the
tezos-client unpack michelson data does not: serialization and type-checking.
Serialization is the process of converting a tree-like structure into a linear representation. In our case the tree-like structure is Micheline and the linear representation is a sequence of bytes (usually written in hexadecimal notation with the
0x prefix). Deserialization is, as the name suggests, the opposite transformation from byte sequences to Micheline.
Type-checking is the process by which we filter nonsensical expressions. The input of the Michelson type checker is Micheline. An important invariant of the Michelson interpreter is that the data manipulated on the Michelson stack is always well-typed.
UNPACK Michelson instruction does both deserialization and type checking. If either fails, it returns
None. The type argument of the
UNPACK instruction is only used for the type-checking part of the job.
tezos-client unpack michelson data command does only deserialization; it returns a Micheline node that may or not be well-typed.
To type-check the Micheline node produced by the
tezos-client unpack michelson data command, you need another command:
tezos-client typecheck data ... against type ....