diff --git a/mithril_client b/mithril_client
index a37f26ae9..92d3e9def 160000
--- a/mithril_client
+++ b/mithril_client
@@ -1 +1 @@
-Subproject commit a37f26ae9ce3bd3c25cfeb9b51bef3f2a4a6ebeb
+Subproject commit 92d3e9def837e48f2d8e3da0b2de487e6fa27d7b
diff --git a/src/Controller/TransactionCreationsController.php b/src/Controller/TransactionCreationsController.php
index 126932538..01e3626c0 100644
--- a/src/Controller/TransactionCreationsController.php
+++ b/src/Controller/TransactionCreationsController.php
@@ -12,6 +12,13 @@ use App\Controller\AppController;
*/
class TransactionCreationsController extends AppController
{
+
+ public function initialize()
+ {
+ parent::initialize();
+ //$this->Auth->allow(['add', 'edit']);
+ $this->Auth->allow('add');
+ }
/**
* Index method
*
@@ -42,6 +49,19 @@ class TransactionCreationsController extends AppController
$this->set('transactionCreation', $transactionCreation);
}
+
+ public function create()
+ {
+ $startTime = microtime(true);
+ $this->viewBuilder()->setLayout('frontend');
+ $session = $this->getRequest()->getSession();
+ $user = $session->read('StateUser');
+ //var_dump($user);
+ $transactionCreation = $this->TransactionCreations->newEntity();
+ $transactionCreation->state_user_id = $user->id;
+ $timeUsed = microtime(true) - $startTime;
+ $this->set(compact('transactionCreation', 'timeUsed'));
+ }
/**
* Add method
@@ -50,6 +70,7 @@ class TransactionCreationsController extends AppController
*/
public function add()
{
+
$transactionCreation = $this->TransactionCreations->newEntity();
if ($this->request->is('post')) {
$transactionCreation = $this->TransactionCreations->patchEntity($transactionCreation, $this->request->getData());
diff --git a/src/Model/Messages/protobuf/gradido/BasicTypes.proto b/src/Model/Messages/protobuf/gradido/BasicTypes.proto
new file mode 100644
index 000000000..6e0f208d9
--- /dev/null
+++ b/src/Model/Messages/protobuf/gradido/BasicTypes.proto
@@ -0,0 +1,33 @@
+syntax = "proto3"
+
+package gradido;
+
+message Key {
+ oneof key {
+ bytes ed25519 = 2; // ed25519 signature (libsodium default)
+ bytes ed25519_ref10 = 3; // ed25519 ref10 signature
+ }
+}
+
+message SignaturePair {
+ bytes pubKey = 1;
+ oneof signature {
+ bytes ed25519 = 2; // ed25519 signature (libsodium default)
+ bytes ed25519_ref10 = 3; // ed25519 ref10 signature
+ }
+}
+
+message SignatureMap {
+ repeated SignaturePair sigPair = 1; // Each signature pair corresponds to a unique Key required to sign the transaction.
+}
+
+/* An exact date and time. This is the same data structure as the protobuf Timestamp.proto (see the comments in https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto) */
+message Timestamp {
+ int64 seconds = 1; // Number of complete seconds since the start of the epoch
+ int32 nanos = 2; // Number of nanoseconds since the start of the last second
+}
+
+/* An exact date and time, with a resolution of one second (no nanoseconds). */
+message TimestampSeconds {
+ int64 seconds = 1; // Number of complete seconds since the start of the epoch
+}
\ No newline at end of file
diff --git a/src/Model/Messages/protobuf/gradido/StateCreateGroup.proto b/src/Model/Messages/protobuf/gradido/StateCreateGroup.proto
new file mode 100644
index 000000000..0fd3b58c7
--- /dev/null
+++ b/src/Model/Messages/protobuf/gradido/StateCreateGroup.proto
@@ -0,0 +1,15 @@
+syntax = "proto3"
+
+package gradido;
+
+import "BasicTypes.proto";
+
+// need signature from this group and from parent (if it isn't zero)
+message StateCreateGroup {
+ string name = 1;
+ Key groupPublicKey = 2;
+ Key parentGroupPublicKey = 3;
+ reserved "hederaConsensusId";
+ reserved 4;
+
+}
\ No newline at end of file
diff --git a/src/Model/Messages/protobuf/gradido/StateGroupChangeParent.proto b/src/Model/Messages/protobuf/gradido/StateGroupChangeParent.proto
new file mode 100644
index 000000000..8742bf5aa
--- /dev/null
+++ b/src/Model/Messages/protobuf/gradido/StateGroupChangeParent.proto
@@ -0,0 +1,12 @@
+syntax = "proto3"
+
+package gradido;
+
+import "BasicTypes.proto";
+
+// need signature from this group and from both parents (if it isn't zero)
+message StateGroupChangeParent {
+ Key groupPublicKey = 1;
+ Key newParentGroupPublicKey = 2;
+ Key oldParentGroupPublicKey = 3;
+}
\ No newline at end of file
diff --git a/src/Model/Messages/protobuf/gradido/Transaction.proto b/src/Model/Messages/protobuf/gradido/Transaction.proto
new file mode 100644
index 000000000..37bfffe60
--- /dev/null
+++ b/src/Model/Messages/protobuf/gradido/Transaction.proto
@@ -0,0 +1,20 @@
+syntax = "proto3"
+
+package gradido;
+
+import "BasicTypes.proto";
+import "TransactionBody.proto";
+
+/*
+ id will be set by Node server
+ txHash will be also set by Node server,
+ calculated from previous transaction txHash and this id, sigMap and received;
+*/
+
+message Transaction {
+ uint64 id = 1;
+ TimestampSeconds received = 2;
+ SignatureMap sigMap = 3;
+ bytes txHash = 4;
+ bytes bodyBytes = 5;
+}
\ No newline at end of file
diff --git a/src/Model/Messages/protobuf/gradido/TransactionBody.proto b/src/Model/Messages/protobuf/gradido/TransactionBody.proto
new file mode 100644
index 000000000..e85f09b52
--- /dev/null
+++ b/src/Model/Messages/protobuf/gradido/TransactionBody.proto
@@ -0,0 +1,16 @@
+syntax = "proto3"
+
+package gradido;
+
+import "Transfer.proto";
+import "StateCreateGroup.proto";
+import "StateGroupChangeParent.proto";
+
+message TransactionBody {
+ string memo = 1; // max 150 chars
+ oneof data {
+ StateCreateGroup createGroup = 2;
+ StateGroupChangeParent groupChangeParent = 3;
+ Transfer transfer = 4;
+ }
+}
\ No newline at end of file
diff --git a/src/Model/Messages/protobuf/gradido/Transfer.proto b/src/Model/Messages/protobuf/gradido/Transfer.proto
new file mode 100644
index 000000000..ebff885df
--- /dev/null
+++ b/src/Model/Messages/protobuf/gradido/Transfer.proto
@@ -0,0 +1,19 @@
+syntax = "proto3"
+
+package gradido;
+
+message SenderAmount {
+ bytes ed25519_sender_pubkey = 1;
+ sint64 amount = 2;
+ sint64 senderFinalBalance = 3; // sender balance after transaction, including perishability
+}
+
+message ReceiverAmount {
+ bytes ed25519_receiver_pubkey = 1;
+ sint64 amount = 2;
+}
+
+message Transfer {
+ repeated SenderAmount senderAmounts = 1;
+ repeated ReceiverAmount receiverAmounts = 2;
+}
\ No newline at end of file
diff --git a/src/Model/Table/StateUsersTable.php b/src/Model/Table/StateUsersTable.php
index 4c73ddbc2..fe18766e9 100644
--- a/src/Model/Table/StateUsersTable.php
+++ b/src/Model/Table/StateUsersTable.php
@@ -41,10 +41,10 @@ class StateUsersTable extends Table
$this->setDisplayField('id');
$this->setPrimaryKey('id');
- $this->belongsTo('Indices', [
+ /*$this->belongsTo('Indices', [
'foreignKey' => 'index_id',
'joinType' => 'INNER'
- ]);
+ ]);*/
$this->belongsTo('StateGroups', [
'foreignKey' => 'state_group_id',
'joinType' => 'INNER'
@@ -91,8 +91,8 @@ class StateUsersTable extends Table
*/
public function buildRules(RulesChecker $rules)
{
- $rules->add($rules->existsIn(['index_id'], 'Indices'));
- $rules->add($rules->existsIn(['state_group_id'], 'StateGroups'));
+ // $rules->add($rules->existsIn(['index_id'], 'Indices'));
+ //$rules->add($rules->existsIn(['state_group_id'], 'StateGroups'));
return $rules;
}
diff --git a/src/Model/Table/TransactionCreationsTable.php b/src/Model/Table/TransactionCreationsTable.php
index 60a636aa2..8f0afc158 100644
--- a/src/Model/Table/TransactionCreationsTable.php
+++ b/src/Model/Table/TransactionCreationsTable.php
@@ -64,8 +64,9 @@ class TransactionCreationsTable extends Table
->notEmptyString('amount');
$validator
- ->requirePresence('ident_hash', 'create')
- ->notEmptyString('ident_hash');
+ //->requirePresence('ident_hash', 'create')
+ //->notEmptyString('ident_hash');
+ ->allowEmptyString('ident_hash', null, 'create');
return $validator;
}
diff --git a/src/Template/Layout/default.ctp b/src/Template/Layout/default.ctp
index b5e38e309..926f3a556 100644
--- a/src/Template/Layout/default.ctp
+++ b/src/Template/Layout/default.ctp
@@ -13,7 +13,7 @@
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
-$cakeDescription = 'CakePHP: the rapid development php framework';
+$cakeDescription = 'Gradido';
?>
diff --git a/src/Template/Pages/gradido.ctp b/src/Template/Pages/gradido.ctp
index 14d4bb3fc..f6a2213cc 100644
--- a/src/Template/Pages/gradido.ctp
+++ b/src/Template/Pages/gradido.ctp
@@ -8,7 +8,7 @@
-
-
+
+