Hello everyone.
I have a problem that i dont solving. I can't call addBlock function by passing a parameter.
Error: Uncaught InvalidArgumentException: Please make sure you have put all function params and callback.
// Appeler la fonction addBlock du contrat pour ajouter le nouveau checksum
$contract->send('addBlock', [$new_checksum], [
'from' => '0x2d1CC832643188351fC408552D089FE692aFd14a', //accountadress
'gas' => '3000000', // Limite de gaz
'gasPrice' => '20000000000', // Prix du gaz
'value' => '0', // Montant à envoyer
'nonce' => '1', // Nombre d'utilisation de la clé privée
], function($err, $transactionHash) {
if ($err !== null) {
echo 'Erreur : ' . $err->getMessage();
} else {
echo 'Transaction envoyée avec succès, hash : ' . $transactionHash;
}
});
My solidity contract: // SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract Sasoma {
struct Block {
bytes32 previousHash;
string checksum; // Changement du type de checksum de int à string
bytes32 hash;
}
php: // Appeler la fonction addBlock du contrat pour ajouter le nouveau checksum
$contract->send('addBlock', [$new_checksum], [
'from' => '0x2d1CC832643188351fC408552D089FE692aFd14a', //accountadress
'gas' => '3000000', // Limite de gaz
'gasPrice' => '20000000000', // Prix du gaz
'value' => '0', // Montant à envoyer
'nonce' => '1', // Nombre d'utilisation de la clé privée
], function($err, $transactionHash) {
if ($err !== null) {
echo 'Erreur : ' . $err->getMessage();
} else {
echo 'Transaction envoyée avec succès, hash : ' . $transactionHash;
}
});
Hello everyone. I have a problem that i dont solving. I can't call addBlock function by passing a parameter. Error: Uncaught InvalidArgumentException: Please make sure you have put all function params and callback.
// Appeler la fonction addBlock du contrat pour ajouter le nouveau checksum $contract->send('addBlock', [$new_checksum], [ 'from' => '0x2d1CC832643188351fC408552D089FE692aFd14a', //accountadress 'gas' => '3000000', // Limite de gaz 'gasPrice' => '20000000000', // Prix du gaz 'value' => '0', // Montant à envoyer 'nonce' => '1', // Nombre d'utilisation de la clé privée ], function($err, $transactionHash) { if ($err !== null) { echo 'Erreur : ' . $err->getMessage(); } else { echo 'Transaction envoyée avec succès, hash : ' . $transactionHash; } }); My solidity contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.19;
contract Sasoma { struct Block { bytes32 previousHash; string checksum; // Changement du type de checksum de int à string bytes32 hash; }
}
php: // Appeler la fonction addBlock du contrat pour ajouter le nouveau checksum $contract->send('addBlock', [$new_checksum], [ 'from' => '0x2d1CC832643188351fC408552D089FE692aFd14a', //accountadress 'gas' => '3000000', // Limite de gaz 'gasPrice' => '20000000000', // Prix du gaz 'value' => '0', // Montant à envoyer 'nonce' => '1', // Nombre d'utilisation de la clé privée ], function($err, $transactionHash) { if ($err !== null) { echo 'Erreur : ' . $err->getMessage(); } else { echo 'Transaction envoyée avec succès, hash : ' . $transactionHash; } });
Thanks you for helping me !