Another written-up digression ...
Where I am atm: working on
nTotalBurnedCoins is slooooow,
main.h is imported all over the place and so everything has to be recompiled, which seems to take forever and basically trashes the edit-compile-debug cycle. I've parked this effort on the back burner until I either get a new Linux box or get round to renting a fast machine in the cloud.
ACME-SLM is rolling along reasonably well. The
blocknotify script which updates the Fuseki-hosted RDF graph has a bad habit of silently failing, leaving the RDF lagging until I notice it and run a catchup routine which so far has done the trick. So a little more work there, possibly refactoring to use a messaging system to trigger the graph update rather than calling the update script directly.
I'm currently extending ACME-SLM's features, my intention is to make it a desirable companion to the client that can be replicated as required. I picked up the OHLC history from Novaexchange and am retrofitting a marketcap line on top of the OHLC data.
In process:
This entails patching the RPC API to return the total minted coins and total burned coins for a given block, data that is saved in the database index but inaccessible via RPC.
From description of CBlock
/** Nodes collect new transactions into a block, hash them into a hash tree,
* and scan through nonce values to make the block's hash satisfy proof-of-work
* requirements. When they solve the proof-of-work, they broadcast the block
* to everyone and the block is added to the block chain. The first transaction
* in the block is a special one that creates a new coin owned by the creator
* of the block.
*
* Blocks are appended to blk0001.dat files on disk. Their location on disk
* is indexed by CBlockIndex objects in memory.
*/...
description of CBlockIndex and how to detect an orphaned block
/** The block chain is a tree shaped structure starting with the
* genesis block at the root, with each block potentially having multiple
* candidates to be the next block. pprev and pnext link a path through the
* main/longest chain. A blockindex may have multiple pprev pointing back
* to it, but pnext will only point forward to the longest branch, or will
* be null if the block is not part of the longest chain.
*/what actually gets written to the index:
IMPLEMENT_SERIALIZE
(
if (!(nType & SER_GETHASH))
READWRITE(nVersion);
READWRITE(hashNext);
READWRITE(nFile);
READWRITE(nBlockPos);
READWRITE(nHeight);
READWRITE(nMint);
READWRITE(nMoneySupply);
READWRITE(nFlags);
READWRITE(nStakeModifier);
if (IsProofOfStake())
{
READWRITE(prevoutStake);
READWRITE(nStakeTime);
READWRITE(hashProofOfStake);
}
else if (fRead)
{
const_cast(this)->prevoutStake.SetNull();
const_cast(this)->nStakeTime = 0;
const_cast(this)->hashProofOfStake = 0;
}
// block header
READWRITE(this->nVersion);
READWRITE(hashPrev);
READWRITE(hashMerkleRoot);
READWRITE(nTime);
READWRITE(nBits);
READWRITE(nNonce);
// PoB
READWRITE(fProofOfBurn);
READWRITE(burnHash);
READWRITE(burnBlkHeight);
READWRITE(burnCTx);
READWRITE(burnCTxOut);
READWRITE(nEffectiveBurnCoins);
READWRITE(nBurnBits);
//cached hash of the block
READWRITE(blockHash);
)
In there is the
nMoneySupply value needed (as the dividend to the corresponding OHLC record's price divisor) and I wrote earlier about adding an accumulating total
READWRITE(nTotalBurnedCoins) to the above - and happily, hacking the index to do just that is fairly straightforward and seems to work.
Not *just* to retrofit a market cap but also to expose additional essential information via the API and get a better handle on adapting 3rd-party apps that need to read the Slimcoin blockchain.
I can, and shall, configure ACME to use a back-end store, make a daily call on Novaexchange's API and record the OHLC data for that day as a db entry along with nMoneySupply and nTotalBurnedCoins. 24 hours seems adequate granularity for such a broad-brush presentation.
And after that, it would be quite straightforward to extend the data recording to use coinmarketcap.com's API to pick up marcap data for, say a dozen other coins whose market characteristics are perceived as sufficiently similar to Slimcoin's in some aspect or other to act as an index backdrop, setting Slimcoin market data in a more readily comparable context.
The last task is to embellish the publications listing with the metadata that accompanies the signed graph (that will be) stored in the adjacent Fuseki dataspace:
Cheers
Graham