new method in javascript iterated client to write sample to chain