Hello again, trying to follow this but kinda stuck right now. I have opened 2 terminals, one I ran node api/server.js and the other node index.js. Not sure how to do this "We can test our code by broadcasting custom_json operations" Does this mean I need to write on the blockchain?
Also in streamBlocks, see below code snippet. It's like processing the latest block number, so is it possible when you broadcast the custom_operation, there's a chance of missing it if the block number it was included in is not the latest block ex. the block number increases too fast?
if (gdgp.result.head_block_number > lastBlock) {
lastBlock = gdgp.result.head_block_number
cb(lastBlock)
}
Sorry for the questions, really new to blockchain programming and JS.Lastly, my hive-tx config is node: 'https://api.hive.blog', should i change to a testnet?
TIA
Read up the docs on devportal and try out different API calls. I might write another startup guide targeted for newer devs. I think this was more for the devs familiar with the Hive blockchain overall and how it works.
The code reads off of the chain so yes.
The block number won't change fast. There is a minimum of 3s between each block produced and we pull the last block less than that. But, another extra check to make sure the increase is not more than 1 would be better.
A testnet would be ideal but using mainnet for small things wouldn't matter. Mainly because it doesn't involve financial transactions.