– Datacoin is a Primecoin-fork: same PoW method
– Binary data field added to all transactions. Data field size is limited to 128Kb. Block size is limited to 1Mb.
unsigned int nLockTime;
+ std::vector<unsigned char> data;
– senddata RPC method is added: it creates a tx with data and the change sent back. The example below shows how to save a bzip2 compressed file into the blockchain. senddata method requires base64 encoded data as an argument. senddata method prints txid on success.
bzip2 -c -9 filename.txt | base64 -w 0 | xargs -I XX datacoind senddata XX
– getdata RPC method will be added later. Following commands can retrieve data from blockchain without dedicated RPC method:
datacoind getrawtransaction TXID | xargs -I XX datacoind decoderawtransaction XX | grep -E ‘”data”‘ | grep -E -o ‘: “.*”‘ | sed -E ‘s/[“: ]//g’ | base64 -d | bzip2 -d > filename2.txt
– MIN_TX_FEE is set to 0.05 (Primecoin value is 0.01) => fully loaded block will give 51.2 coins to miner additionally to block reward.
– You can use perl scripts for testing sending\receiving data from blockchain.
ATTN1: Be sure you understand what you do. Please review scripts before using them (seriously).
ATTN2: Until datacoin-hp update you need non-hp version of datacoin for these scripts.
– Example for data storing costs.
Minimal tx fee is 0.05DTC => any tx will cost at least 0.05DTC
1Kb fee is also 0.05DTC => tx fee = tx size * 0.05DTC
“balance” : 31.83000000,
$ perl dtc_put_file.pl ubuntu-12.04.3-alternate-amd64.iso.torrent
“balance” : 30.33000000,
ubuntu-12.04.3-alternate-amd64.iso.torrent is 29Kb long
Total fee for 29Kb (+ some meta information added by scripts) is 1.50 DTC (30Kb * 0.05 = 1.50).