【实例简介】可以发行自己的货币

【实例截图】

354bc693ad6cbd9a9ca0514bdf6036e5.png

【核心代码】

class block{

private $index;

private $timestamp;

private $data;

private $previous_hash;

private $random_str;

private $hash;

public function __construct($index,$timestamp,$data,$random_str,$previous_hash)

{

$this->index=$index;

$this->timestamp=$timestamp;

$this->data=$data;

$this->previous_hash=$previous_hash;

$this->random_str=$random_str;

$this->hash=$this->hash_block();

}

public function __get($name){

return $this->$name;

}

private function hash_block(){

$str=$this->index.$this->timestamp.$this->data.$this->random_str.$this->previous_hash;

return hash("sha256",$str);

}

}

Logo

一站式 AI 云服务平台

更多推荐