move encoding/decoding to edge