<?php

// ---
// --- La config globale
// ---
require_once '../global/inc/config.php';

// ---
// --- External dependances
// ---
require TOPISTO_PATH.'/ressources/vendor/autoload.php';

// ---
// --- Internal dependances
// ---
require_once APP_PATH.'/blockchain/inc/block.php';

// ---
// --- Par défaut on cherche le dernier block
// --- Le cas échéant, on cherche block passé en argument
// ---
$block_hash = 'LAST';
if (isset($argv[1])) $block_hash = $argv[1];

$the_block = blockchain::getBlockWithHash($block_hash);
if ($the_block === FALSE) die();

echo $the_block->nonce;

?>
