Post
Topic
Board Announcements (Altcoins)
Re: [ANN] Datacoin - Censorship-Free Data Storage
by
hamburger
on 23/04/2019, 09:49:50 UTC
Is it possible to add to this wallet: http://www.datacoin.tk/wallet - function of uploading files, we can currently do it, but only with DTC Browser, which is inconvenient and impossible for mobile users?
Dunno, how much effort it would need - DTC Browser is already working - but probably need some backend to do operations - https://github.com/j0nn9/DTCBrowser


@muf18

It should not be to much effort to implement the publishing of files to the Datacoin blockchain, or I rather hope so!

Anyway, the publishing of files to the Datacoin blockchain using PuTTY and WinSCP  is easy if you run a node on DigitalOcean or Vultr.

Just upload your file for publishing to any directory on the server i.e.

/var/tmp/filename.txt

Next login to the server with PuTTY and at the prompt type;

bzip2 -c -9 /var/tmp/filename.txt | base64 -w 0 | xargs -I XX datacoind senddata XX

and press enter.

The successful publishing of the file to the Datacoin blockchain will return a transaction id (txid) i.e.

3cf7b2efc185cc948261abd3d5d633e9dd3878a8315d579a9ebfd76638638ac1

To retrieve the publication, login to the server with PuTTY and at the prompt type;

datacoind getrawtransaction 3cf7b2efc185cc948261abd3d5d633e9dd3878a8315d579a9ebfd76638638ac1 | xargs -I XX datacoind decoderawtransaction XX | grep -E '"data"' | grep -E -o ': ".*"' | sed -E 's/[": ]//g' | base64 -d | bzip2 -d > /var/tmp/retrieve_filename.txt

The successful retrieval of the file from the Datacoin blockchain will return no visible output, however, you will find the file at your location entererdi.e.

/var/tmp/retrieve_filename.txt

Like I said, easy, very easy!

Now, I just recently started learning about executing a shell script from a PHP script and have not yet found a proper solution.

If someone out there know how to execute a shell file I should be able to implement the publishing of files to the Datacoin blockchain on http://www.datacoin.tk/wallet

i.e. getinfo.sh

Code:
#!/bin/sh

// Returns an object containing various state info.
datacoind getinfo

that will return;

Code:
{
    "version" : "v0.1.2.0dtc-hp11-unk-beta",
    "protocolversion" : 70001,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 2900817,
    "moneysupply" : 36483140.72783475,
    "timeoffset" : 0,
    "connections" : 23,
    "proxy" : "",
    "testnet" : false,
    "keypoololdest" : 1528975869,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "errors" : ""
}

Using a PHP file i.e. getinfo.php

Code:

echo exec("bash shell.sh 2>&1");

?>

or something like;

Code:

$command 
escapeshellcmd("bash shell.sh 2>&1");
$output shell_exec($command);
echo 
$output;

?>

H