Я хочу построить блокчейн, используя PHP - OOP.
мой код:
class Block {
public function __construct($timestamp, $transactions, $previousHash = null) {
$this->previousHash = $previousHash;
$this->timestamp = $timestamp;
$this->transactions = $transactions;
$this->nonce = 0;
$this->hash = $this->calculateHash();
$this->difficulty = 2;
}
/** Returns the SHA256 of this block (by processing all the data stored inside this block)*/
public function calculateHash() {
return hash("sha256", $this->previousHash.$this->timestamp.((string)$this->transactions).$this->nonce);
}
}
Это показывает мне эту ошибку:
PHP Notice: Array to string conversion in /home/istabraq/bctest/test2/a2.php on line 14
Любая идея, пожалуйста?