abstract the envelope encoding/decoding for the M3DA client