AV
Size: a a a
AV
CI
checklevel=12. Запустить кошелек перестройку индексов базы
addressindex=1
txindex=1
server=1
rpcuser=ПОЛЬЗОВАТЕЛЬ
rpcpassword=ПАРОЛЬ
rpcallowip=127.0.0.1
--reindex3. Дождаться завершения синхронизации
//Адреса которые нужно проверить на склейку
$addresses = [
'XuLHt4TN6CinfMM2zHfy7Rsb4terC1MRX5', //Адресс DashCoreGroup
];
//Логин и пароль прописанные в dash.conf
$user = "ПОЛЬЗОВАТЕЛЬ";
$password = "ПАРОЛЬ";
/**
* @method getaddresstxids(array $addresses)
* @method getrawtransaction(string $txId, bool $verbose)
*
*/
class DASHWrapper {
private $ch;
public function __construct(string $connection) {
$this->ch = curl_init($connection);
if (!$this->ch) {
throw new Exception('Не удалось подключиться к демону');
}
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']);
curl_setopt($this->ch, CURLOPT_POST, true);
}
public function __call($name, $arguments) {
$params = json_encode([
"jsonrpc" => "1.0",
"id" => "PHP-wrapper",
"method" => $name,
"params" => $arguments,
]);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($this->ch);
if (empty($result)) {
throw new Exception(curl_error($this->ch));
}
$response = json_decode($result, true);
return !empty($response['result']) ? $response['result'] : "{$response['error']['message']}\n";
}
}
$otherKeys = [];
try {
$dash = new DASHWrapper("http://{$user}:{$password}@127.0.0.1:9998/");
$txs = $dash->getaddresstxids(['addresses' => $addresses]);
foreach ($txs as $txId) {
$tx = $dash->getrawtransaction($txId, true);
$outputs = [];
$found = false;
foreach ($tx['vin'] as $in) {
if (empty($in['txid'])) {
continue;
}
$prevTx = $dash->getrawtransaction($in['txid'], true);
$out = $prevTx['vout'][$in['vout']];
$prevOuts = $out['scriptPubKey']['addresses'];
$outputs = array_merge($outputs, $prevOuts);
if (array_intersect($prevOuts, $addresses)) {
$found = true;
}
}
if ($found) {
$outputs = array_diff($outputs, $addresses);
if (!empty($outputs)) {
$otherKeys = array_replace_recursive($otherKeys, array_fill_keys($outputs, null));
}
}
}
print_r(array_keys($otherKeys));
} catch (Exception $exception) {
die($exception->getMessage() . "\n");
}
CI
AB
checklevel=12. Запустить кошелек перестройку индексов базы
addressindex=1
txindex=1
server=1
rpcuser=ПОЛЬЗОВАТЕЛЬ
rpcpassword=ПАРОЛЬ
rpcallowip=127.0.0.1
--reindex3. Дождаться завершения синхронизации
//Адреса которые нужно проверить на склейку
$addresses = [
'XuLHt4TN6CinfMM2zHfy7Rsb4terC1MRX5', //Адресс DashCoreGroup
];
//Логин и пароль прописанные в dash.conf
$user = "ПОЛЬЗОВАТЕЛЬ";
$password = "ПАРОЛЬ";
/**
* @method getaddresstxids(array $addresses)
* @method getrawtransaction(string $txId, bool $verbose)
*
*/
class DASHWrapper {
private $ch;
public function __construct(string $connection) {
$this->ch = curl_init($connection);
if (!$this->ch) {
throw new Exception('Не удалось подключиться к демону');
}
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']);
curl_setopt($this->ch, CURLOPT_POST, true);
}
public function __call($name, $arguments) {
$params = json_encode([
"jsonrpc" => "1.0",
"id" => "PHP-wrapper",
"method" => $name,
"params" => $arguments,
]);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($this->ch);
if (empty($result)) {
throw new Exception(curl_error($this->ch));
}
$response = json_decode($result, true);
return !empty($response['result']) ? $response['result'] : "{$response['error']['message']}\n";
}
}
$otherKeys = [];
try {
$dash = new DASHWrapper("http://{$user}:{$password}@127.0.0.1:9998/");
$txs = $dash->getaddresstxids(['addresses' => $addresses]);
foreach ($txs as $txId) {
$tx = $dash->getrawtransaction($txId, true);
$outputs = [];
$found = false;
foreach ($tx['vin'] as $in) {
if (empty($in['txid'])) {
continue;
}
$prevTx = $dash->getrawtransaction($in['txid'], true);
$out = $prevTx['vout'][$in['vout']];
$prevOuts = $out['scriptPubKey']['addresses'];
$outputs = array_merge($outputs, $prevOuts);
if (array_intersect($prevOuts, $addresses)) {
$found = true;
}
}
if ($found) {
$outputs = array_diff($outputs, $addresses);
if (!empty($outputs)) {
$otherKeys = array_replace_recursive($otherKeys, array_fill_keys($outputs, null));
}
}
}
print_r(array_keys($otherKeys));
} catch (Exception $exception) {
die($exception->getMessage() . "\n");
}
AB
AV
R
AV
R
AV
AB
AB
ДС
ДС
ДС
AG