Function documentFromChain