Skip to content

Instantly share code, notes, and snippets.

@leightkt
Last active April 9, 2021 20:34
Show Gist options
  • Save leightkt/5d02be914e8eb3099605f940f8c641e7 to your computer and use it in GitHub Desktop.
Save leightkt/5d02be914e8eb3099605f940f8c641e7 to your computer and use it in GitHub Desktop.
let BelayChain = {}
const loadBelayChain = () => {
Block.find({})
.then(blocks => {
BelayChain = new Blockchain(blocks)
return BelayChain
})
.then(BelayChain => {
Node.find({})
.then((nodes => {
nodes.forEach(node => BelayChain.networkNodes.push(node.nodeURL))
}))
})
}
app.listen(port, loadBelayChain())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment