Whenever i am trying to commit the transaction. It gives an error that digest should be 32 bytes and i try to commit the binary value of digest then it gives an error that the commit digest does not match with the qldb (Ledger) Digest.
public function insert()
{
$client = AwsFacade::createClient('qldb-session');
$clientA = AwsFacade::createClient('qldb');
$result = $client->sendCommand([
'StartSession' => [
'LedgerName' => 'LawHq',
],
]);
$sessiontoken = ((object)$result->get('StartSession'))->SessionToken;
$result = $client->sendCommand([
'StartTransaction' =>
[],
'SessionToken' => $sessiontoken
]);
$transectiontoken = ((object)$result->get('StartTransaction'))->TransactionId;
$result = $client->sendCommand([
'ExecuteStatement' => [
'Statement' => 'INSERT INTO Employee {`Name`:`wow`,`Designation`:`ok`, `Address`:`hmm`}',
'TransactionId' => $transectiontoken,
],
'SessionToken' => $sessiontoken
]);
$result = $clientA->getDigest([
'Name' => 'LawHq',
]);
$digest = $result->get("Digest");
$diges = base64_encode($result->get("Digest"));
$result = $client->sendCommand([
'CommitTransaction' => [
'CommitDigest' => $digest,
'TransactionId' => $transectiontoken
],
'SessionToken' => $sessiontoken
]);
}