In your example
let value = cast[uint8](address)
Run
should be
let value = cast[uint8](address[])
Run
You should use UncheckedArray here for nicer syntax:
const size = 3
var buf = cast[ptr UncheckedArray[uint8]](create(uint8, size))
buf[0] = 0
buf[1] = 1
buf[2] = 2
var data = newSeq[uint8](size)
for i in 0 ..< size:
data[i] = buf[i]
echo data
Run
