bytes ed25519 = 2;
* @return string
@@ -44,7 +44,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @param string $var
@@ -59,7 +59,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @return string
@@ -70,7 +70,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @param string $var
diff --git a/community_server/src/Model/Messages/Gradido/SenderAmount.php b/community_server/src/Model/Messages/Gradido/SenderAmount.php
index 9b423947e..52a41f71f 100644
--- a/community_server/src/Model/Messages/Gradido/SenderAmount.php
+++ b/community_server/src/Model/Messages/Gradido/SenderAmount.php
@@ -22,7 +22,7 @@ class SenderAmount extends \Google\Protobuf\Internal\Message
*/
private $amount = 0;
/**
- * sender balance after transaction, including perishability
+ * sender balance after transaction, including perishability
*
* Generated from protobuf field sint64 senderFinalBalance = 3;
*/
@@ -37,7 +37,7 @@ class SenderAmount extends \Google\Protobuf\Internal\Message
* @type string $ed25519_sender_pubkey
* @type int|string $amount
* @type int|string $senderFinalBalance
- * sender balance after transaction, including perishability
+ * sender balance after transaction, including perishability
* }
*/
public function __construct($data = NULL) {
@@ -90,7 +90,7 @@ class SenderAmount extends \Google\Protobuf\Internal\Message
}
/**
- * sender balance after transaction, including perishability
+ * sender balance after transaction, including perishability
*
* Generated from protobuf field sint64 senderFinalBalance = 3;
* @return int|string
@@ -101,7 +101,7 @@ class SenderAmount extends \Google\Protobuf\Internal\Message
}
/**
- * sender balance after transaction, including perishability
+ * sender balance after transaction, including perishability
*
* Generated from protobuf field sint64 senderFinalBalance = 3;
* @param int|string $var
diff --git a/community_server/src/Model/Messages/Gradido/SignatureMap.php b/community_server/src/Model/Messages/Gradido/SignatureMap.php
index ea6f16150..228282747 100644
--- a/community_server/src/Model/Messages/Gradido/SignatureMap.php
+++ b/community_server/src/Model/Messages/Gradido/SignatureMap.php
@@ -14,7 +14,7 @@ use Google\Protobuf\Internal\GPBUtil;
class SignatureMap extends \Google\Protobuf\Internal\Message
{
/**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field repeated .model.messages.gradido.SignaturePair sigPair = 1;
*/
@@ -27,7 +27,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type \Model\Messages\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $sigPair
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
* }
*/
public function __construct($data = NULL) {
@@ -36,7 +36,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
}
/**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field repeated .model.messages.gradido.SignaturePair sigPair = 1;
* @return \Google\Protobuf\Internal\RepeatedField
@@ -47,7 +47,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
}
/**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field repeated .model.messages.gradido.SignaturePair sigPair = 1;
* @param \Model\Messages\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $var
diff --git a/community_server/src/Model/Messages/Gradido/SignaturePair.php b/community_server/src/Model/Messages/Gradido/SignaturePair.php
index 4575a7d38..203eb5677 100644
--- a/community_server/src/Model/Messages/Gradido/SignaturePair.php
+++ b/community_server/src/Model/Messages/Gradido/SignaturePair.php
@@ -27,9 +27,9 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
*
* @type string $pubKey
* @type string $ed25519
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
* @type string $ed25519_ref10
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
* }
*/
public function __construct($data = NULL) {
@@ -60,7 +60,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @return string
@@ -71,7 +71,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @param string $var
@@ -86,7 +86,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @return string
@@ -97,7 +97,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @param string $var
diff --git a/community_server/src/Model/Messages/Gradido/StateCreateGroup.php b/community_server/src/Model/Messages/Gradido/StateCreateGroup.php
index dad246745..4273ef93d 100644
--- a/community_server/src/Model/Messages/Gradido/StateCreateGroup.php
+++ b/community_server/src/Model/Messages/Gradido/StateCreateGroup.php
@@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
- * need signature from this group and from parent (if it isn't zero)
+ * need signature from this group and from parent (if it isn't zero)
*
* Generated from protobuf message model.messages.gradido.StateCreateGroup
*/
diff --git a/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php b/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php
index 9cd15175a..c5371d76c 100644
--- a/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php
+++ b/community_server/src/Model/Messages/Gradido/StateGroupChangeParent.php
@@ -9,7 +9,7 @@ use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
- * need signature from this group and from both parents (if it isn't zero)
+ * need signature from this group and from both parents (if it isn't zero)
*
* Generated from protobuf message model.messages.gradido.StateGroupChangeParent
*/
diff --git a/community_server/src/Model/Messages/Gradido/Timestamp.php b/community_server/src/Model/Messages/Gradido/Timestamp.php
index 7b2316720..19721729b 100644
--- a/community_server/src/Model/Messages/Gradido/Timestamp.php
+++ b/community_server/src/Model/Messages/Gradido/Timestamp.php
@@ -16,13 +16,13 @@ use Google\Protobuf\Internal\GPBUtil;
class Timestamp extends \Google\Protobuf\Internal\Message
{
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
*/
private $seconds = 0;
/**
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
*
* Generated from protobuf field int32 nanos = 2;
*/
@@ -35,9 +35,9 @@ class Timestamp extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type int|string $seconds
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
* @type int $nanos
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
* }
*/
public function __construct($data = NULL) {
@@ -46,7 +46,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @return int|string
@@ -57,7 +57,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @param int|string $var
@@ -72,7 +72,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
*
* Generated from protobuf field int32 nanos = 2;
* @return int
@@ -83,7 +83,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
*
* Generated from protobuf field int32 nanos = 2;
* @param int $var
diff --git a/community_server/src/Model/Messages/Gradido/TimestampSeconds.php b/community_server/src/Model/Messages/Gradido/TimestampSeconds.php
index 2646a06c9..2a588a312 100644
--- a/community_server/src/Model/Messages/Gradido/TimestampSeconds.php
+++ b/community_server/src/Model/Messages/Gradido/TimestampSeconds.php
@@ -16,7 +16,7 @@ use Google\Protobuf\Internal\GPBUtil;
class TimestampSeconds extends \Google\Protobuf\Internal\Message
{
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
*/
@@ -29,7 +29,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type int|string $seconds
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
* }
*/
public function __construct($data = NULL) {
@@ -38,7 +38,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @return int|string
@@ -49,7 +49,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @param int|string $var
diff --git a/community_server/src/Model/Messages/Gradido/TransactionCreation.php b/community_server/src/Model/Messages/Gradido/TransactionCreation.php
index 1c8f33dba..ae5f86e07 100644
--- a/community_server/src/Model/Messages/Gradido/TransactionCreation.php
+++ b/community_server/src/Model/Messages/Gradido/TransactionCreation.php
@@ -9,27 +9,27 @@ use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
- * need signature from group admin or
- * percent of group users another than the receiver
+ * need signature from group admin or
+ * percent of group users another than the receiver
*
* Generated from protobuf message model.messages.gradido.TransactionCreation
*/
class TransactionCreation extends \Google\Protobuf\Internal\Message
{
/**
- * 40 Byte
+ * 40 Byte
*
* Generated from protobuf field .model.messages.gradido.ReceiverAmount receiverAmount = 1;
*/
private $receiverAmount = null;
/**
- * 4 Byte
+ * 4 Byte
*
* Generated from protobuf field sint32 ident_hash = 2;
*/
private $ident_hash = 0;
/**
- * 8 Byte
+ * 8 Byte
*
* Generated from protobuf field .model.messages.gradido.TimestampSeconds target_date = 3;
*/
@@ -42,11 +42,11 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type \Model\Messages\Gradido\ReceiverAmount $receiverAmount
- * 40 Byte
+ * 40 Byte
* @type int $ident_hash
- * 4 Byte
+ * 4 Byte
* @type \Model\Messages\Gradido\TimestampSeconds $target_date
- * 8 Byte
+ * 8 Byte
* }
*/
public function __construct($data = NULL) {
@@ -55,7 +55,7 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
}
/**
- * 40 Byte
+ * 40 Byte
*
* Generated from protobuf field .model.messages.gradido.ReceiverAmount receiverAmount = 1;
* @return \Model\Messages\Gradido\ReceiverAmount
@@ -66,7 +66,7 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
}
/**
- * 40 Byte
+ * 40 Byte
*
* Generated from protobuf field .model.messages.gradido.ReceiverAmount receiverAmount = 1;
* @param \Model\Messages\Gradido\ReceiverAmount $var
@@ -81,7 +81,7 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
}
/**
- * 4 Byte
+ * 4 Byte
*
* Generated from protobuf field sint32 ident_hash = 2;
* @return int
@@ -92,7 +92,7 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
}
/**
- * 4 Byte
+ * 4 Byte
*
* Generated from protobuf field sint32 ident_hash = 2;
* @param int $var
@@ -107,7 +107,7 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
}
/**
- * 8 Byte
+ * 8 Byte
*
* Generated from protobuf field .model.messages.gradido.TimestampSeconds target_date = 3;
* @return \Model\Messages\Gradido\TimestampSeconds
@@ -118,7 +118,7 @@ class TransactionCreation extends \Google\Protobuf\Internal\Message
}
/**
- * 8 Byte
+ * 8 Byte
*
* Generated from protobuf field .model.messages.gradido.TimestampSeconds target_date = 3;
* @param \Model\Messages\Gradido\TimestampSeconds $var
diff --git a/community_server/src/Model/Messages/Proto/Gradido/Key.php b/community_server/src/Model/Messages/Proto/Gradido/Key.php
index 4c32e0083..f18b49a27 100644
--- a/community_server/src/Model/Messages/Proto/Gradido/Key.php
+++ b/community_server/src/Model/Messages/Proto/Gradido/Key.php
@@ -22,9 +22,9 @@ class Key extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type string $ed25519
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
* @type string $ed25519_ref10
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
* }
*/
public function __construct($data = NULL) {
@@ -33,7 +33,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @return string
@@ -44,7 +44,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @param string $var
@@ -59,7 +59,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @return string
@@ -70,7 +70,7 @@ class Key extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @param string $var
diff --git a/community_server/src/Model/Messages/Proto/Gradido/SignatureMap.php b/community_server/src/Model/Messages/Proto/Gradido/SignatureMap.php
index 0977169d7..59b7d7549 100644
--- a/community_server/src/Model/Messages/Proto/Gradido/SignatureMap.php
+++ b/community_server/src/Model/Messages/Proto/Gradido/SignatureMap.php
@@ -14,7 +14,7 @@ use Google\Protobuf\Internal\GPBUtil;
class SignatureMap extends \Google\Protobuf\Internal\Message
{
/**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field repeated .proto.gradido.SignaturePair sigPair = 1;
*/
@@ -27,7 +27,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type \Proto\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $sigPair
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
* }
*/
public function __construct($data = NULL) {
@@ -36,7 +36,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
}
/**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field repeated .proto.gradido.SignaturePair sigPair = 1;
* @return \Google\Protobuf\Internal\RepeatedField
@@ -47,7 +47,7 @@ class SignatureMap extends \Google\Protobuf\Internal\Message
}
/**
- * Each signature pair corresponds to a unique Key required to sign the transaction.
+ * Each signature pair corresponds to a unique Key required to sign the transaction.
*
* Generated from protobuf field repeated .proto.gradido.SignaturePair sigPair = 1;
* @param \Proto\Gradido\SignaturePair[]|\Google\Protobuf\Internal\RepeatedField $var
diff --git a/community_server/src/Model/Messages/Proto/Gradido/SignaturePair.php b/community_server/src/Model/Messages/Proto/Gradido/SignaturePair.php
index 2ef0e81c5..986596e3c 100644
--- a/community_server/src/Model/Messages/Proto/Gradido/SignaturePair.php
+++ b/community_server/src/Model/Messages/Proto/Gradido/SignaturePair.php
@@ -27,9 +27,9 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
*
* @type string $pubKey
* @type string $ed25519
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
* @type string $ed25519_ref10
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
* }
*/
public function __construct($data = NULL) {
@@ -60,7 +60,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @return string
@@ -71,7 +71,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 signature (libsodium default)
+ * ed25519 signature (libsodium default)
*
* Generated from protobuf field bytes ed25519 = 2;
* @param string $var
@@ -86,7 +86,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @return string
@@ -97,7 +97,7 @@ class SignaturePair extends \Google\Protobuf\Internal\Message
}
/**
- * ed25519 ref10 signature
+ * ed25519 ref10 signature
*
* Generated from protobuf field bytes ed25519_ref10 = 3;
* @param string $var
diff --git a/community_server/src/Model/Messages/Proto/Gradido/Timestamp.php b/community_server/src/Model/Messages/Proto/Gradido/Timestamp.php
index ae3ecea0e..3d8d2ed7a 100644
--- a/community_server/src/Model/Messages/Proto/Gradido/Timestamp.php
+++ b/community_server/src/Model/Messages/Proto/Gradido/Timestamp.php
@@ -16,13 +16,13 @@ use Google\Protobuf\Internal\GPBUtil;
class Timestamp extends \Google\Protobuf\Internal\Message
{
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
*/
private $seconds = 0;
/**
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
*
* Generated from protobuf field int32 nanos = 2;
*/
@@ -35,9 +35,9 @@ class Timestamp extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type int|string $seconds
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
* @type int $nanos
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
* }
*/
public function __construct($data = NULL) {
@@ -46,7 +46,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @return int|string
@@ -57,7 +57,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @param int|string $var
@@ -72,7 +72,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
*
* Generated from protobuf field int32 nanos = 2;
* @return int
@@ -83,7 +83,7 @@ class Timestamp extends \Google\Protobuf\Internal\Message
}
/**
- * Number of nanoseconds since the start of the last second
+ * Number of nanoseconds since the start of the last second
*
* Generated from protobuf field int32 nanos = 2;
* @param int $var
diff --git a/community_server/src/Model/Messages/Proto/Gradido/TimestampSeconds.php b/community_server/src/Model/Messages/Proto/Gradido/TimestampSeconds.php
index d31aa40d2..dda39a858 100644
--- a/community_server/src/Model/Messages/Proto/Gradido/TimestampSeconds.php
+++ b/community_server/src/Model/Messages/Proto/Gradido/TimestampSeconds.php
@@ -16,7 +16,7 @@ use Google\Protobuf\Internal\GPBUtil;
class TimestampSeconds extends \Google\Protobuf\Internal\Message
{
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
*/
@@ -29,7 +29,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
* Optional. Data for populating the Message object.
*
* @type int|string $seconds
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
* }
*/
public function __construct($data = NULL) {
@@ -38,7 +38,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @return int|string
@@ -49,7 +49,7 @@ class TimestampSeconds extends \Google\Protobuf\Internal\Message
}
/**
- * Number of complete seconds since the start of the epoch
+ * Number of complete seconds since the start of the epoch
*
* Generated from protobuf field int64 seconds = 1;
* @param int|string $var
diff --git a/community_server/src/Model/Transactions/Record.php b/community_server/src/Model/Transactions/Record.php
index 862399af5..5572730ef 100644
--- a/community_server/src/Model/Transactions/Record.php
+++ b/community_server/src/Model/Transactions/Record.php
@@ -1,575 +1,575 @@
-signature = $signature;
- $this->publicKey = $pubkey;
- }
-
- public function finalize($transactionId)
- {
- $signaturesTable = TableRegistry::getTableLocator()->get('TransactionSignatures');
- $entity = $signaturesTable->newEntity();
- $entity->transaction_id = $transactionId;
- if(strlen($this->signature) != 128) {
- return ['state' => 'error', 'msg' => 'invalid signature size', 'details' => strlen($this->signature)];
- }
- if(strlen($this->publicKey) != 64) {
- return ['state' => 'error', 'msg' => 'invalid pubkey size', 'details' => strlen($this->publicKey)];
- }
- if(!preg_match('/^[0-9a-fA-F]*$/', $this->signature)) {
- return ['state' => 'error', 'msg' => 'signature isn\'t in hex format'];
- }
- if(!preg_match('/^[0-9a-fA-F]*$/', $this->publicKey)) {
- return ['state' => 'error', 'msg' => 'publicKey isn\'t in hex format'];
- }
- $entity->signature = hex2bin($this->signature);
- $entity->pubkey = hex2bin($this->publicKey);
-
- if(!$signaturesTable->save($entity)) {
- return ['state' => 'error', 'msg' => 'error saving signature', 'details' => $entity->getErrors()];
- }
- return true;
- }
-}
-
-
-
-class GradidoModifieUserBalance
-{
- private $state_users = [];
- private $user_balances = [];
-
- public function getUserId($userPublicKey)
- {
- $stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers');
-
- $stateUser = $stateUsersTable->find('all')->where(['public_key' => hex2bin($userPublicKey)]);
- if($stateUser->isEmpty()) {
- return ['state' => 'error', 'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key'];
- }
- $id = $stateUser->first()->id;
- if($id && is_int($id) && (int)$id > 0 && !in_array((int)$id, $this->state_users)) {
- array_push($this->state_users, (int)$id);
- }
- return $id;
- }
-
- public function updateBalance($newBalance, $recordDate, $userId)
- {
- $stateBalancesTable = TableRegistry::getTableLocator()->get('StateBalances');
- $state_balance_query = $stateBalancesTable->find()->where(['state_user_id' => $userId])->order(['record_date ASC']);
- $state_balance = null;
- if($state_balance_query->count() > 0) {
- $state_balance = $state_balance_query->last();
- } else {
- $state_balance = $stateBalancesTable->newEntity();
- $state_balance->state_user_id = $userId;
- }
- $state_balance->amount = $newBalance;
- $state_balance->record_date = $recordDate;
- $this->user_balances[$userId] = $state_balance;
- $stateBalancesTable->save($state_balance);
- return true;
- //$this->user_balances[$userId] = ['balance' => $newBalance, '']
- //
- //return $stateBalancesTable->updateBalanceWithTransaction($newBalance, $recordDate, $userId);
-
- /*$first_of_month = new Time("$year-$month-01 00:00");
- $stateBalanceQuery = $stateBalancesTable
- ->find('all')
- ->where(['state_user_id' => $userId])
- ->order(['record_date' => 'DESC'])
- ->limit(1);
- $entity = null;
-
- if(!$stateBalanceQuery->isEmpty()) {
- $entity = $stateBalanceQuery->first();
- if($entity->record_date != NULL &&
- ($entity->record_date > $recordDate || $entity->record_date->day == 1)) {
- return false;
- }
- } else {
- $entity = $stateBalancesTable->newEntity();
- $entity->state_user_id = $userId;
- }
- $entity->record_date = $recordDate;
- $entity->amount = $newBalance;
- /*if(!$stateBalancesTable->save($entity)) {
- return ['state' => 'error', 'msg' => 'error saving state balance', 'details' => $entity->getErrors()];
- }*/
- //return true;
- }
-
- public function getAllStateUsers()
- {
- return $this->state_users;
- }
- public function getAllStateUserBalances()
- {
- return $this->user_balances;
- }
-}
-
-class ManageNodeGroupAdd extends GradidoModifieUserBalance
-{
- /*
- "add_user": {
- "user\": " << user << ",
- },
- OR
-
- "move_user_inbound|move_user_outbound": {
- "user": " << user << ",
- "other_group": " << other_group << ",
- "paired_transaction_id": {
- "seconds": << ts.seconds <<,
- "nanos": << ts.nanos
- }
- },
-
- */
-
- private $user_pubkey;
- private $other_group = '';
- private $remove_from_group = false;
-
- public function __construct($data)
- {
- $this->user_pubkey = $data['user'];
- if(isset($data['other_group'])) {
- $this->other_group = $data['other_group'];
- }
- }
-
- public function finalize($transactionId, $received)
- {
- $transactionGroupAddadressTable = TableRegistry::getTableLocator()->get('TransactionGroupAddaddress');
- $stateGroupAddresses = TableRegistry::getTableLocator()->get('StateGroupAddresses');
- $transactionGroupEntity = $transactionGroupAddadressTable->newEntity();
- if(!is_int($transactionId)) {
- return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] transaction id is not int', 'details' => $transactionId];
- }
- $transactionGroupEntity->transaction_id = $transactionId;
- $transactionGroupEntity->address_type_id = 1;
- if(strlen($this->user_pubkey) != 64) {
- return ['state' => 'error', 'msg' => 'invalid size user pubkey', 'details' => strlen($this->user_pubkey)];
- }
- if(!preg_match('/^[0-9a-fA-F]*$/', $this->user_pubkey)) {
- return ['state' => 'error', 'msg' => 'user_pubkey isn\'t in hex format'];
- }
-
- $userPubkeyBin = hex2bin($this->user_pubkey);
-
- $transactionGroupEntity->public_key = $userPubkeyBin;
- $user_id = $this->getUserId($this->user_pubkey);
- if(!is_int($user_id)) {
- return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] user id is not int', 'details' => $user_id];
- }
- $transactionGroupEntity->state_user_id = $user_id;
- $transactionGroupEntity->remove_from_group = $this->remove_from_group;
- if(!$transactionGroupAddadressTable->save($transactionGroupEntity)) {
- return ['state' => 'error', 'msg' => 'error saving TransactionGroupAddaddress Entity', 'details' => $transactionGroupEntity->getErrors()];
- }
-
-
- if($this->remove_from_group) {
- $stateGroup_query = $stateGroupAddresses->find('all')->where(['public_key' => hex2bin($this->user_pubkey)]);
- if(!$stateGroup_query->isEmpty()) {
- $stateGroupAddresses->delete($stateGroup_query->first());
- }
- } else {
- $stateGroupAddressesEntity = $stateGroupAddresses->newEntity();
- $stateGroupAddressesEntity->group_id = 1;
- $stateGroupAddressesEntity->public_key = $userPubkeyBin;
- $stateGroupAddressesEntity->address_type_id = 1;
- if(!$stateGroupAddresses->save($stateGroupAddressesEntity)) {
- return ['state' => 'error', 'msg' => 'error saving state group addresses entity', 'details' => $stateGroupAddressesEntity->getErrors()];
- }
- }
-
- return true;
- }
-
- public function setRemoveFromGroup($removeFromGroup) {
- $this->remove_from_group = $removeFromGroup;
- }
-}
-
-
-class GradidoCreation extends GradidoModifieUserBalance
-{
- /*
- * "gradido_creation": {
- "user": " << user << ",
- "new_balance": << v.new_balance << ,
- "prev_transfer_rec_num": << v.prev_transfer_rec_num <<,
- "amount": << v.amount <<
- }
- */
- private $userPubkey;
- private $amount;
- private $targetDate; // seems currently not in node server implementet, use hedera date until it is implemented
- private $new_balance;
-
-
- public function __construct($data)
- {
- $this->userPubkey = $data['user'];
- $this->amount = $data['amount']['amount'];
- $this->new_balance = $data['new_balance']['amount'];
- //$this->targetDate = $received;
- }
-
- public function finalize($transactionId, $received)
- {
- // TODO: don't use, after node server transmit correct date
- $this->targetDate = $received;
-
- $transactionCreationTable = TableRegistry::getTableLocator()->get('TransactionCreations');
-
-
- $state_user_id = $this->getUserId($this->userPubkey);
- if(!is_int($state_user_id)) {
- return $state_user_id;
- }
-
- $entity = $transactionCreationTable->newEntity();
- $entity->transaction_id = $transactionId;
- $entity->amount = $this->amount;
- $entity->target_date = $this->targetDate;
- $entity->state_user_id = $state_user_id;
-
- if(!$transactionCreationTable->save($entity)) {
- return ['state' => 'error', 'msg' => 'error saving create transaction', 'details' => $entity->getErrors()];
- }
-
- $balance_result = $this->updateBalance($this->new_balance, $received, $state_user_id);
- if(is_array($balance_result)) {
- return $balance_result;
- }
-
- return true;
- }
-
-
-
-}
-
-class GradidoTransfer extends GradidoModifieUserBalance
-{
- /*
- "local_transfer|inbound_transfer|outbound_transfer": {
- "sender": {
- "user": " << sender << ",
- "new_balance": << tt.sender.new_balance << ,
- "prev_transfer_rec_num": << tt.sender.prev_transfer_rec_num <<
- },
- "receiver": {
- "user": " << receiver << ",
- "new_balance": << tt.receiver.new_balance << ,
- "prev_transfer_rec_num": << tt.receiver.prev_transfer_rec_num <<
- },
- "amount": << tt.amount <<
- },
- * */
- private $amount;
- private $sender_new_balance = null;
- private $sender_pubkey;
-
- private $receiver_pubkey;
- private $receiver_new_balance = null;
-
-
- public function __construct($data)
- {
- $this->amount = $data['amount']['amount'];
-
- $sender = $data['sender'];
- $this->sender_pubkey = $sender['user'];
- if(isset($sender['new_balance'])) {
- $this->sender_new_balance = $sender['new_balance']['amount'];
- }
-
- $receiver = $data['receiver'];
- $this->receiver_pubkey = $receiver['user'];
- if(isset($receiver['new_balance'])) {
- $this->receiver_new_balance = $receiver['new_balance']['amount'];
- }
-
- }
-
- public function finalize($transactionId, $received)
- {
- $transactionTransferTable = TableRegistry::getTableLocator()->get('TransactionSendCoins');
- if(strlen($this->sender_pubkey) != 64) {
- return ['state' => 'error', 'msg' => 'invalid size sender pubkey', 'details' => strlen($this->user_pubkey)];
- }
- if(!preg_match('/^[0-9a-fA-F]*$/', $this->sender_pubkey)) {
- return ['state' => 'error', 'msg' => 'sender_pubkey isn\'t in hex format'];
- }
- if(strlen($this->receiver_pubkey) != 64) {
- return ['state' => 'error', 'msg' => 'invalid size receiver pubkey', 'details' => strlen($this->user_pubkey)];
- }
- if(!preg_match('/^[0-9a-fA-F]*$/', $this->receiver_pubkey)) {
- return ['state' => 'error', 'msg' => 'receiver_pubkey isn\'t in hex format'];
- }
-
- $sender_id = $this->getUserId($this->sender_pubkey);
- $receiver_id = $this->getUserId($this->receiver_pubkey);
- if(is_array($sender_id) && is_array($receiver_id)) {
- return ['state' => 'error', 'msg' => 'neither sender or receiver known'];
- }
- $transferEntity = $transactionTransferTable->newEntity();
- $transferEntity->transaction_id = $transactionId;
- $transferEntity->sender_public_key = hex2bin($this->sender_pubkey);
- $transferEntity->receiver_public_key = hex2bin($this->receiver_pubkey);
- $transferEntity->amount = $this->amount;
- if($this->sender_new_balance != null) {
- $transferEntity->sender_final_balance = $this->sender_new_balance;
-
- if(is_int($sender_id) && $sender_id > 0) {
- $transferEntity->state_user_id = $sender_id;
- $balance_result = $this->updateBalance($this->sender_new_balance, $received, $sender_id);
- if(is_array($balance_result)) {
- return $balance_result;
- }
- }
- }
- if($this->receiver_new_balance != null && is_int($receiver_id) && $receiver_id > 0) {
- $transferEntity->receiver_user_id = $receiver_id;
- $balance_result = $this->updateBalance($this->receiver_new_balance, $received, $receiver_id);
- if(is_array($balance_result)) {
- return $balance_result;
- }
- }
-
- if(!$transactionTransferTable->save($transferEntity)) {
- return ['state' => 'error', 'msg' => 'error saving transaction send coins entity', 'details' => $transferEntity->getErrors()];
- }
-
- return true;
- }
-
-}
-
-
-
-
-class Record
-{
- private $sequenceNumber = 0;
- private $runningHash = null;
- private $transactionType = '';
- private $memo = '';
- private $signatures = [];
- private $received;
- private $transactionObj = null;
- private $result;
- private $partCount = 0;
-
- public function __construct()
- {
-
- }
-
-
- public function parseRecord($json) {
- if(!isset($json['record_type'])) {
- return false;
- }
- //var_dump($json);
- switch($json['record_type']) {
- case 'GRADIDO_TRANSACTION':
- return $this->parseTransaction($json['transaction']);
- case 'MEMO':
- $this->memo .= $json['memo'];
- return true;
- case 'SIGNATURES':
- return $this->parseSignatures($json['signature']);
- case 'STRUCTURALLY_BAD_MESSAGE':
- case 'RAW_MESSAGE':
- case 'BLANK':
- return false;
- }
- }
-
- /*!
- * \brief save data parts in db
- */
- public function finalize()
- {
- $transactionTypesTable = TableRegistry::getTableLocator()->get('TransactionTypes');
- $transactionsTable = TableRegistry::getTableLocator()->get('Transactions');
- $stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions');
-
- $transactionTypeName = $this->nodeTransactionTypeToDBTransactionType($this->transactionType);
- $transactionTypeResults = $transactionTypesTable->find('all')->where(['name' => $transactionTypeName]);
- if($transactionTypeResults->isEmpty()) {
- return [
- 'state' => 'error', 'msg' => 'transaction type not found',
- 'details' => ['nodeType' => $this->transactionType, 'dbType' => $transactionTypeName]
- ];
- }
- if(!$this->transactionObj) {
- return ['state' => 'error', 'msg' => 'transaction obj is null'];
- }
- if($this->sequenceNumber <= 0) {
- return ['state' => 'error', 'msg' => 'sequence number invalid', 'details' => $this->sequenceNumber];
- }
- $transactionExistResult = $transactionsTable->find('all')->where(['id' => intval($this->sequenceNumber)]);
- if(!$transactionExistResult->isEmpty()) {
- return ['state' => 'warning', 'msg' => 'transaction already exist in db', 'details' => $this->sequenceNumber];
- }
- $newTransaction = $transactionsTable->newEntity();
- $newTransaction->id = $this->sequenceNumber;
- $newTransaction->transaction_type_id = $transactionTypeResults->first()->id;
- $newTransaction->memo = $this->memo;
- if($this->runningHash != '' && strlen($this->runningHash) % 2 == 0) {
- $newTransaction->tx_hash = hex2bin($this->runningHash);
- }
- $newTransaction->received = $this->received;
-
- //! TODO change into transaction, if at least one fail, rollback
- /*
- // In a controller.
- $articles->getConnection()->transactional(function () use ($articles, $entities) {
- foreach ($entities as $entity) {
- $articles->save($entity, ['atomic' => false]);
- }
- });
- */
- if(!$transactionsTable->save($newTransaction)) {
- return ['state' => 'error', 'msg' => 'error saving transaction', 'details' => $newTransaction->getErrors()];
- }
-
- foreach($this->signatures as $sign) {
- $sign_result = $sign->finalize($this->sequenceNumber);
- if($sign_result !== true) {
- return ['state' => 'error', 'msg', 'error finalizing signature', 'details' => $sign_result];
- }
- }
- $transaction_obj_result = $this->transactionObj->finalize($newTransaction->id, $this->received);
- if($transaction_obj_result !== true) {
- return ['state' => 'error', 'msg' => 'error finalizing transaction object', 'details' => $transaction_obj_result];
- }
- $state_users = $this->transactionObj->getAllStateUsers();
- $sut_entities = [];
- $state_user_balances = $this->transactionObj->getAllStateUserBalances();
- foreach($state_users as $state_user_id) {
- $entity = $stateUserTransactionsTable->newEntity();
- $entity->state_user_id = $state_user_id;
- $entity->transaction_id = $newTransaction->id;
- $entity->transaction_type_id = $newTransaction->transaction_type_id;
- $entity->balance = $state_user_balances[$state_user_id]->amount;
- $entity->balance_date = $state_user_balances[$state_user_id]->record_date;
- $sut_entities[] = $entity;
- }
- $sut_results = $stateUserTransactionsTable->saveMany($sut_entities);
- foreach($sut_results as $i => $result) {
- if(false == $result) {
- return ['state' => 'error', 'msg' => 'error saving state_user_transaction', 'details' => $sut_entities[$i]->getErrors()];
- }
- }
-
- return true;
-
- }
-
- private function nodeTransactionTypeToDBTransactionType($nodeTransactionType)
- {
- switch($nodeTransactionType) {
- case 'GRADIDO_CREATION':
- return 'creation';
-
- case 'MOVE_USER_INBOUND':
- case 'ADD_USER':
- return 'group add member';
-
- case 'MOVE_USER_OUTBOUND':
- return 'group remove member';
-
- case 'LOCAL_TRANSFER':
- case 'INBOUND_TRANSFER':
- case 'OUTBOUND_TRANSFER':
- return 'transfer';
- }
- return 'unknown';
- }
-
- private function parseSignatures($signaturesArray)
- {
- foreach($signaturesArray as $sign) {
- $this->signatures[] = new Signature($sign['signature'], $sign['pubkey']);
- }
- return true;
- }
-
- private function parseTransaction($data)
- {
- $this->transactionType = $data['transaction_type'];
- $sign = $data['signature'];
- $this->signatures[] = new Signature($sign['signature'], $sign['pubkey']);
-
- $hedera = $data['hedera_transaction'];
- $this->sequenceNumber = $hedera['sequenceNumber'];
- $this->runningHash = $hedera['runningHash'];
- $this->received = Time::createFromTimestamp($hedera['consensusTimestamp']['seconds']);
-
- $field_index = '';
- $class_name = '';
-
- $removeFromGroup = false;
- switch($this->transactionType)
- {
- case 'GRADIDO_CREATION': $field_index = 'gradido_creation'; $class_name = 'GradidoCreation'; break;
- case 'ADD_USER': $field_index = 'add_user'; $class_name = 'ManageNodeGroupAdd'; break;
- case 'MOVE_USER_INBOUND': $field_index = 'move_user_inbound'; $class_name = 'ManageNodeGroupAdd'; break;
- case 'MOVE_USER_OUTBOUND': $field_index = 'move_user_outbound'; $class_name = 'ManageNodeGroupAdd'; $removeFromGroup = true; break;
- case 'LOCAL_TRANSFER': $field_index = 'local_transfer'; $class_name = 'GradidoTransfer'; break;
- case 'INBOUND_TRANSFER': $field_index = 'inbound_transfer'; $class_name = 'GradidoTransfer'; break;
- case 'OUTBOUND_TRANSFER': $field_index = 'outbound_transfer'; $class_name = 'GradidoTransfer'; break;
- }
- if($class_name == '' || $field_index == '') {
- return ['state' => 'error', 'msg' => 'node transaction type unknown', 'details' => $this->transactionType];
- }
- $class_name = 'Model\\Transactions\\' . $class_name;
- $this->transactionObj = new $class_name($data[$field_index]);
- if($class_name == 'ManageNodeGroupAdd') {
- $this->transactionObj->setRemoveFromGroup($removeFromGroup);
- }
-
- $this->result = $data['result'];
- $this->partCount = intval($data['parts']);
- $this->memo = $data['memo'];
- return true;
- }
-
- public function getSequenceNumber() {
- return $this->sequenceNumber;
- }
- public function getPartCount() {
- return $this->partCount;
- }
-
+signature = $signature;
+ $this->publicKey = $pubkey;
+ }
+
+ public function finalize($transactionId)
+ {
+ $signaturesTable = TableRegistry::getTableLocator()->get('TransactionSignatures');
+ $entity = $signaturesTable->newEntity();
+ $entity->transaction_id = $transactionId;
+ if(strlen($this->signature) != 128) {
+ return ['state' => 'error', 'msg' => 'invalid signature size', 'details' => strlen($this->signature)];
+ }
+ if(strlen($this->publicKey) != 64) {
+ return ['state' => 'error', 'msg' => 'invalid pubkey size', 'details' => strlen($this->publicKey)];
+ }
+ if(!preg_match('/^[0-9a-fA-F]*$/', $this->signature)) {
+ return ['state' => 'error', 'msg' => 'signature isn\'t in hex format'];
+ }
+ if(!preg_match('/^[0-9a-fA-F]*$/', $this->publicKey)) {
+ return ['state' => 'error', 'msg' => 'publicKey isn\'t in hex format'];
+ }
+ $entity->signature = hex2bin($this->signature);
+ $entity->pubkey = hex2bin($this->publicKey);
+
+ if(!$signaturesTable->save($entity)) {
+ return ['state' => 'error', 'msg' => 'error saving signature', 'details' => $entity->getErrors()];
+ }
+ return true;
+ }
+}
+
+
+
+class GradidoModifieUserBalance
+{
+ private $state_users = [];
+ private $user_balances = [];
+
+ public function getUserId($userPublicKey)
+ {
+ $stateUsersTable = TableRegistry::getTableLocator()->get('StateUsers');
+
+ $stateUser = $stateUsersTable->find('all')->where(['public_key' => hex2bin($userPublicKey)]);
+ if($stateUser->isEmpty()) {
+ return ['state' => 'error', 'msg' => '[GradidoModifieUserBalance::getUserId] couldn\'t find user via public key'];
+ }
+ $id = $stateUser->first()->id;
+ if($id && is_int($id) && (int)$id > 0 && !in_array((int)$id, $this->state_users)) {
+ array_push($this->state_users, (int)$id);
+ }
+ return $id;
+ }
+
+ public function updateBalance($newBalance, $recordDate, $userId)
+ {
+ $stateBalancesTable = TableRegistry::getTableLocator()->get('StateBalances');
+ $state_balance_query = $stateBalancesTable->find()->where(['state_user_id' => $userId])->order(['record_date ASC']);
+ $state_balance = null;
+ if($state_balance_query->count() > 0) {
+ $state_balance = $state_balance_query->last();
+ } else {
+ $state_balance = $stateBalancesTable->newEntity();
+ $state_balance->state_user_id = $userId;
+ }
+ $state_balance->amount = $newBalance;
+ $state_balance->record_date = $recordDate;
+ $this->user_balances[$userId] = $state_balance;
+ $stateBalancesTable->save($state_balance);
+ return true;
+ //$this->user_balances[$userId] = ['balance' => $newBalance, '']
+ //
+ //return $stateBalancesTable->updateBalanceWithTransaction($newBalance, $recordDate, $userId);
+
+ /*$first_of_month = new Time("$year-$month-01 00:00");
+ $stateBalanceQuery = $stateBalancesTable
+ ->find('all')
+ ->where(['state_user_id' => $userId])
+ ->order(['record_date' => 'DESC'])
+ ->limit(1);
+ $entity = null;
+
+ if(!$stateBalanceQuery->isEmpty()) {
+ $entity = $stateBalanceQuery->first();
+ if($entity->record_date != NULL &&
+ ($entity->record_date > $recordDate || $entity->record_date->day == 1)) {
+ return false;
+ }
+ } else {
+ $entity = $stateBalancesTable->newEntity();
+ $entity->state_user_id = $userId;
+ }
+ $entity->record_date = $recordDate;
+ $entity->amount = $newBalance;
+ /*if(!$stateBalancesTable->save($entity)) {
+ return ['state' => 'error', 'msg' => 'error saving state balance', 'details' => $entity->getErrors()];
+ }*/
+ //return true;
+ }
+
+ public function getAllStateUsers()
+ {
+ return $this->state_users;
+ }
+ public function getAllStateUserBalances()
+ {
+ return $this->user_balances;
+ }
+}
+
+class ManageNodeGroupAdd extends GradidoModifieUserBalance
+{
+ /*
+ "add_user": {
+ "user\": " << user << ",
+ },
+ OR
+
+ "move_user_inbound|move_user_outbound": {
+ "user": " << user << ",
+ "other_group": " << other_group << ",
+ "paired_transaction_id": {
+ "seconds": << ts.seconds <<,
+ "nanos": << ts.nanos
+ }
+ },
+
+ */
+
+ private $user_pubkey;
+ private $other_group = '';
+ private $remove_from_group = false;
+
+ public function __construct($data)
+ {
+ $this->user_pubkey = $data['user'];
+ if(isset($data['other_group'])) {
+ $this->other_group = $data['other_group'];
+ }
+ }
+
+ public function finalize($transactionId, $received)
+ {
+ $transactionGroupAddadressTable = TableRegistry::getTableLocator()->get('TransactionGroupAddaddress');
+ $stateGroupAddresses = TableRegistry::getTableLocator()->get('StateGroupAddresses');
+ $transactionGroupEntity = $transactionGroupAddadressTable->newEntity();
+ if(!is_int($transactionId)) {
+ return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] transaction id is not int', 'details' => $transactionId];
+ }
+ $transactionGroupEntity->transaction_id = $transactionId;
+ $transactionGroupEntity->address_type_id = 1;
+ if(strlen($this->user_pubkey) != 64) {
+ return ['state' => 'error', 'msg' => 'invalid size user pubkey', 'details' => strlen($this->user_pubkey)];
+ }
+ if(!preg_match('/^[0-9a-fA-F]*$/', $this->user_pubkey)) {
+ return ['state' => 'error', 'msg' => 'user_pubkey isn\'t in hex format'];
+ }
+
+ $userPubkeyBin = hex2bin($this->user_pubkey);
+
+ $transactionGroupEntity->public_key = $userPubkeyBin;
+ $user_id = $this->getUserId($this->user_pubkey);
+ if(!is_int($user_id)) {
+ return ['state' => 'error', 'msg' => '[ManageNodeGroupAdd::finalize] user id is not int', 'details' => $user_id];
+ }
+ $transactionGroupEntity->state_user_id = $user_id;
+ $transactionGroupEntity->remove_from_group = $this->remove_from_group;
+ if(!$transactionGroupAddadressTable->save($transactionGroupEntity)) {
+ return ['state' => 'error', 'msg' => 'error saving TransactionGroupAddaddress Entity', 'details' => $transactionGroupEntity->getErrors()];
+ }
+
+
+ if($this->remove_from_group) {
+ $stateGroup_query = $stateGroupAddresses->find('all')->where(['public_key' => hex2bin($this->user_pubkey)]);
+ if(!$stateGroup_query->isEmpty()) {
+ $stateGroupAddresses->delete($stateGroup_query->first());
+ }
+ } else {
+ $stateGroupAddressesEntity = $stateGroupAddresses->newEntity();
+ $stateGroupAddressesEntity->group_id = 1;
+ $stateGroupAddressesEntity->public_key = $userPubkeyBin;
+ $stateGroupAddressesEntity->address_type_id = 1;
+ if(!$stateGroupAddresses->save($stateGroupAddressesEntity)) {
+ return ['state' => 'error', 'msg' => 'error saving state group addresses entity', 'details' => $stateGroupAddressesEntity->getErrors()];
+ }
+ }
+
+ return true;
+ }
+
+ public function setRemoveFromGroup($removeFromGroup) {
+ $this->remove_from_group = $removeFromGroup;
+ }
+}
+
+
+class GradidoCreation extends GradidoModifieUserBalance
+{
+ /*
+ * "gradido_creation": {
+ "user": " << user << ",
+ "new_balance": << v.new_balance << ,
+ "prev_transfer_rec_num": << v.prev_transfer_rec_num <<,
+ "amount": << v.amount <<
+ }
+ */
+ private $userPubkey;
+ private $amount;
+ private $targetDate; // seems currently not in node server implementet, use hedera date until it is implemented
+ private $new_balance;
+
+
+ public function __construct($data)
+ {
+ $this->userPubkey = $data['user'];
+ $this->amount = $data['amount']['amount'];
+ $this->new_balance = $data['new_balance']['amount'];
+ //$this->targetDate = $received;
+ }
+
+ public function finalize($transactionId, $received)
+ {
+ // TODO: don't use, after node server transmit correct date
+ $this->targetDate = $received;
+
+ $transactionCreationTable = TableRegistry::getTableLocator()->get('TransactionCreations');
+
+
+ $state_user_id = $this->getUserId($this->userPubkey);
+ if(!is_int($state_user_id)) {
+ return $state_user_id;
+ }
+
+ $entity = $transactionCreationTable->newEntity();
+ $entity->transaction_id = $transactionId;
+ $entity->amount = $this->amount;
+ $entity->target_date = $this->targetDate;
+ $entity->state_user_id = $state_user_id;
+
+ if(!$transactionCreationTable->save($entity)) {
+ return ['state' => 'error', 'msg' => 'error saving create transaction', 'details' => $entity->getErrors()];
+ }
+
+ $balance_result = $this->updateBalance($this->new_balance, $received, $state_user_id);
+ if(is_array($balance_result)) {
+ return $balance_result;
+ }
+
+ return true;
+ }
+
+
+
+}
+
+class GradidoTransfer extends GradidoModifieUserBalance
+{
+ /*
+ "local_transfer|inbound_transfer|outbound_transfer": {
+ "sender": {
+ "user": " << sender << ",
+ "new_balance": << tt.sender.new_balance << ,
+ "prev_transfer_rec_num": << tt.sender.prev_transfer_rec_num <<
+ },
+ "receiver": {
+ "user": " << receiver << ",
+ "new_balance": << tt.receiver.new_balance << ,
+ "prev_transfer_rec_num": << tt.receiver.prev_transfer_rec_num <<
+ },
+ "amount": << tt.amount <<
+ },
+ * */
+ private $amount;
+ private $sender_new_balance = null;
+ private $sender_pubkey;
+
+ private $receiver_pubkey;
+ private $receiver_new_balance = null;
+
+
+ public function __construct($data)
+ {
+ $this->amount = $data['amount']['amount'];
+
+ $sender = $data['sender'];
+ $this->sender_pubkey = $sender['user'];
+ if(isset($sender['new_balance'])) {
+ $this->sender_new_balance = $sender['new_balance']['amount'];
+ }
+
+ $receiver = $data['receiver'];
+ $this->receiver_pubkey = $receiver['user'];
+ if(isset($receiver['new_balance'])) {
+ $this->receiver_new_balance = $receiver['new_balance']['amount'];
+ }
+
+ }
+
+ public function finalize($transactionId, $received)
+ {
+ $transactionTransferTable = TableRegistry::getTableLocator()->get('TransactionSendCoins');
+ if(strlen($this->sender_pubkey) != 64) {
+ return ['state' => 'error', 'msg' => 'invalid size sender pubkey', 'details' => strlen($this->user_pubkey)];
+ }
+ if(!preg_match('/^[0-9a-fA-F]*$/', $this->sender_pubkey)) {
+ return ['state' => 'error', 'msg' => 'sender_pubkey isn\'t in hex format'];
+ }
+ if(strlen($this->receiver_pubkey) != 64) {
+ return ['state' => 'error', 'msg' => 'invalid size receiver pubkey', 'details' => strlen($this->user_pubkey)];
+ }
+ if(!preg_match('/^[0-9a-fA-F]*$/', $this->receiver_pubkey)) {
+ return ['state' => 'error', 'msg' => 'receiver_pubkey isn\'t in hex format'];
+ }
+
+ $sender_id = $this->getUserId($this->sender_pubkey);
+ $receiver_id = $this->getUserId($this->receiver_pubkey);
+ if(is_array($sender_id) && is_array($receiver_id)) {
+ return ['state' => 'error', 'msg' => 'neither sender or receiver known'];
+ }
+ $transferEntity = $transactionTransferTable->newEntity();
+ $transferEntity->transaction_id = $transactionId;
+ $transferEntity->sender_public_key = hex2bin($this->sender_pubkey);
+ $transferEntity->receiver_public_key = hex2bin($this->receiver_pubkey);
+ $transferEntity->amount = $this->amount;
+ if($this->sender_new_balance != null) {
+ $transferEntity->sender_final_balance = $this->sender_new_balance;
+
+ if(is_int($sender_id) && $sender_id > 0) {
+ $transferEntity->state_user_id = $sender_id;
+ $balance_result = $this->updateBalance($this->sender_new_balance, $received, $sender_id);
+ if(is_array($balance_result)) {
+ return $balance_result;
+ }
+ }
+ }
+ if($this->receiver_new_balance != null && is_int($receiver_id) && $receiver_id > 0) {
+ $transferEntity->receiver_user_id = $receiver_id;
+ $balance_result = $this->updateBalance($this->receiver_new_balance, $received, $receiver_id);
+ if(is_array($balance_result)) {
+ return $balance_result;
+ }
+ }
+
+ if(!$transactionTransferTable->save($transferEntity)) {
+ return ['state' => 'error', 'msg' => 'error saving transaction send coins entity', 'details' => $transferEntity->getErrors()];
+ }
+
+ return true;
+ }
+
+}
+
+
+
+
+class Record
+{
+ private $sequenceNumber = 0;
+ private $runningHash = null;
+ private $transactionType = '';
+ private $memo = '';
+ private $signatures = [];
+ private $received;
+ private $transactionObj = null;
+ private $result;
+ private $partCount = 0;
+
+ public function __construct()
+ {
+
+ }
+
+
+ public function parseRecord($json) {
+ if(!isset($json['record_type'])) {
+ return false;
+ }
+ //var_dump($json);
+ switch($json['record_type']) {
+ case 'GRADIDO_TRANSACTION':
+ return $this->parseTransaction($json['transaction']);
+ case 'MEMO':
+ $this->memo .= $json['memo'];
+ return true;
+ case 'SIGNATURES':
+ return $this->parseSignatures($json['signature']);
+ case 'STRUCTURALLY_BAD_MESSAGE':
+ case 'RAW_MESSAGE':
+ case 'BLANK':
+ return false;
+ }
+ }
+
+ /*!
+ * \brief save data parts in db
+ */
+ public function finalize()
+ {
+ $transactionTypesTable = TableRegistry::getTableLocator()->get('TransactionTypes');
+ $transactionsTable = TableRegistry::getTableLocator()->get('Transactions');
+ $stateUserTransactionsTable = TableRegistry::getTableLocator()->get('StateUserTransactions');
+
+ $transactionTypeName = $this->nodeTransactionTypeToDBTransactionType($this->transactionType);
+ $transactionTypeResults = $transactionTypesTable->find('all')->where(['name' => $transactionTypeName]);
+ if($transactionTypeResults->isEmpty()) {
+ return [
+ 'state' => 'error', 'msg' => 'transaction type not found',
+ 'details' => ['nodeType' => $this->transactionType, 'dbType' => $transactionTypeName]
+ ];
+ }
+ if(!$this->transactionObj) {
+ return ['state' => 'error', 'msg' => 'transaction obj is null'];
+ }
+ if($this->sequenceNumber <= 0) {
+ return ['state' => 'error', 'msg' => 'sequence number invalid', 'details' => $this->sequenceNumber];
+ }
+ $transactionExistResult = $transactionsTable->find('all')->where(['id' => intval($this->sequenceNumber)]);
+ if(!$transactionExistResult->isEmpty()) {
+ return ['state' => 'warning', 'msg' => 'transaction already exist in db', 'details' => $this->sequenceNumber];
+ }
+ $newTransaction = $transactionsTable->newEntity();
+ $newTransaction->id = $this->sequenceNumber;
+ $newTransaction->transaction_type_id = $transactionTypeResults->first()->id;
+ $newTransaction->memo = $this->memo;
+ if($this->runningHash != '' && strlen($this->runningHash) % 2 == 0) {
+ $newTransaction->tx_hash = hex2bin($this->runningHash);
+ }
+ $newTransaction->received = $this->received;
+
+ //! TODO change into transaction, if at least one fail, rollback
+ /*
+ // In a controller.
+ $articles->getConnection()->transactional(function () use ($articles, $entities) {
+ foreach ($entities as $entity) {
+ $articles->save($entity, ['atomic' => false]);
+ }
+ });
+ */
+ if(!$transactionsTable->save($newTransaction)) {
+ return ['state' => 'error', 'msg' => 'error saving transaction', 'details' => $newTransaction->getErrors()];
+ }
+
+ foreach($this->signatures as $sign) {
+ $sign_result = $sign->finalize($this->sequenceNumber);
+ if($sign_result !== true) {
+ return ['state' => 'error', 'msg', 'error finalizing signature', 'details' => $sign_result];
+ }
+ }
+ $transaction_obj_result = $this->transactionObj->finalize($newTransaction->id, $this->received);
+ if($transaction_obj_result !== true) {
+ return ['state' => 'error', 'msg' => 'error finalizing transaction object', 'details' => $transaction_obj_result];
+ }
+ $state_users = $this->transactionObj->getAllStateUsers();
+ $sut_entities = [];
+ $state_user_balances = $this->transactionObj->getAllStateUserBalances();
+ foreach($state_users as $state_user_id) {
+ $entity = $stateUserTransactionsTable->newEntity();
+ $entity->state_user_id = $state_user_id;
+ $entity->transaction_id = $newTransaction->id;
+ $entity->transaction_type_id = $newTransaction->transaction_type_id;
+ $entity->balance = $state_user_balances[$state_user_id]->amount;
+ $entity->balance_date = $state_user_balances[$state_user_id]->record_date;
+ $sut_entities[] = $entity;
+ }
+ $sut_results = $stateUserTransactionsTable->saveMany($sut_entities);
+ foreach($sut_results as $i => $result) {
+ if(false == $result) {
+ return ['state' => 'error', 'msg' => 'error saving state_user_transaction', 'details' => $sut_entities[$i]->getErrors()];
+ }
+ }
+
+ return true;
+
+ }
+
+ private function nodeTransactionTypeToDBTransactionType($nodeTransactionType)
+ {
+ switch($nodeTransactionType) {
+ case 'GRADIDO_CREATION':
+ return 'creation';
+
+ case 'MOVE_USER_INBOUND':
+ case 'ADD_USER':
+ return 'group add member';
+
+ case 'MOVE_USER_OUTBOUND':
+ return 'group remove member';
+
+ case 'LOCAL_TRANSFER':
+ case 'INBOUND_TRANSFER':
+ case 'OUTBOUND_TRANSFER':
+ return 'transfer';
+ }
+ return 'unknown';
+ }
+
+ private function parseSignatures($signaturesArray)
+ {
+ foreach($signaturesArray as $sign) {
+ $this->signatures[] = new Signature($sign['signature'], $sign['pubkey']);
+ }
+ return true;
+ }
+
+ private function parseTransaction($data)
+ {
+ $this->transactionType = $data['transaction_type'];
+ $sign = $data['signature'];
+ $this->signatures[] = new Signature($sign['signature'], $sign['pubkey']);
+
+ $hedera = $data['hedera_transaction'];
+ $this->sequenceNumber = $hedera['sequenceNumber'];
+ $this->runningHash = $hedera['runningHash'];
+ $this->received = Time::createFromTimestamp($hedera['consensusTimestamp']['seconds']);
+
+ $field_index = '';
+ $class_name = '';
+
+ $removeFromGroup = false;
+ switch($this->transactionType)
+ {
+ case 'GRADIDO_CREATION': $field_index = 'gradido_creation'; $class_name = 'GradidoCreation'; break;
+ case 'ADD_USER': $field_index = 'add_user'; $class_name = 'ManageNodeGroupAdd'; break;
+ case 'MOVE_USER_INBOUND': $field_index = 'move_user_inbound'; $class_name = 'ManageNodeGroupAdd'; break;
+ case 'MOVE_USER_OUTBOUND': $field_index = 'move_user_outbound'; $class_name = 'ManageNodeGroupAdd'; $removeFromGroup = true; break;
+ case 'LOCAL_TRANSFER': $field_index = 'local_transfer'; $class_name = 'GradidoTransfer'; break;
+ case 'INBOUND_TRANSFER': $field_index = 'inbound_transfer'; $class_name = 'GradidoTransfer'; break;
+ case 'OUTBOUND_TRANSFER': $field_index = 'outbound_transfer'; $class_name = 'GradidoTransfer'; break;
+ }
+ if($class_name == '' || $field_index == '') {
+ return ['state' => 'error', 'msg' => 'node transaction type unknown', 'details' => $this->transactionType];
+ }
+ $class_name = 'Model\\Transactions\\' . $class_name;
+ $this->transactionObj = new $class_name($data[$field_index]);
+ if($class_name == 'ManageNodeGroupAdd') {
+ $this->transactionObj->setRemoveFromGroup($removeFromGroup);
+ }
+
+ $this->result = $data['result'];
+ $this->partCount = intval($data['parts']);
+ $this->memo = $data['memo'];
+ return true;
+ }
+
+ public function getSequenceNumber() {
+ return $this->sequenceNumber;
+ }
+ public function getPartCount() {
+ return $this->partCount;
+ }
+
}
\ No newline at end of file
diff --git a/community_server/src/Model/Transactions/Transaction.php b/community_server/src/Model/Transactions/Transaction.php
index 76353595a..99bd5fae7 100644
--- a/community_server/src/Model/Transactions/Transaction.php
+++ b/community_server/src/Model/Transactions/Transaction.php
@@ -1,269 +1,269 @@
-mProtoTransaction = $base64Data;
- $this->mTransactionBody = new TransactionBody($this->mProtoTransaction->getBodyBytes());
- return;
- }
-
- try {
- $transactionBin = sodium_base642bin($base64Data, SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING);
- } catch(\SodiumException $e) {
- //$this->addError('Transaction', $e->getMessage());// . ' ' . $base64Data);
- //return;
- $transactionBin = base64_decode($base64Data, true);
- if($transactionBin == false) {
- $this->addError('Transaction', $e->getMessage());// . ' ' . $base64Data);
- return;
- }
- }
- //*/}
-
- if($transactionBin == false) {
- //$this->addError('base64 decode failed');
- $this->addError('Transaction', 'base64 decode error: ' . $base64Data);
- } else {
- //var_dump($transactionBin);
- $this->mProtoTransaction = new \Model\Messages\Gradido\Transaction();
- try {
- $this->mProtoTransaction->mergeFromString($transactionBin);
- //var_dump($this->mProtoTransaction);
- // cannot catch Exception with cakePHP, I don't know why
- } catch(\Google\Protobuf\Internal\GPBDecodeException $e) {
- //var_dump($e);
- $this->addError('Transaction', $e->getMessage());
- return;
- }//*/
-
- //echo 'serialize to json: 1. Create three new accounts and show user public keys for comparisation:
\n"; - responseStream << "\t\t\t"; -#line 217 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - Profiler time2; - auto group_id = hedera_topic->getModel()->getGroupId(); - auto group_id2 = hedera_topic2->getModel()->getGroupId(); - auto user_group = controller::Group::load(group_id); - auto user_group2 = controller::Group::load(group_id2); - auto mnemonic_type = ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER; - - std::string password1 = "hsaj(2askaslASlllak3wjjeudsaj"; - auto user_1 = controller::User::create("testEmail@google.de", "Max", "Mustermann", group_id); - auto passphrase_1 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); - auto gradido_key_pair_1 = KeyPairEd25519::create(passphrase_1); - user_1->setGradidoKeyPair(gradido_key_pair_1); - user_1->login(password1); - - std::string password2 = "uweia8saiSale,dsasA"; - auto user_2 = controller::User::create("testEmail2@google.de", "MJax", "Mustrermann", group_id); - auto passphrase_2 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); - auto gradido_key_pair_2 = KeyPairEd25519::create(passphrase_2); - user_2->setGradidoKeyPair(gradido_key_pair_2); - user_2->login(password2); - - std::string password3 = "jaue_skaiellasealaK"; - auto user_3 = controller::User::create("testEmail3@gmail.com", "Morpheus", "Miaufull", group_id2); - auto passphrase_3 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); - auto gradido_key_pair_3 = KeyPairEd25519::create(passphrase_3); - user_3->setGradidoKeyPair(gradido_key_pair_3); - user_3->login(password3); - responseStream << "\t\t\t\n"; - responseStream << "\t\t\t\n"; - responseStream << "\t\t\t\n"; - responseStream << "\t\t\tTime: "; -#line 253 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "\n"; - responseStream << "\t\t
2. Send a add-member transaction to hedera topic with one signature (first user)
\n"; - responseStream << "\t\t\t"; -#line 257 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - time2.reset(); - if(!steps[0]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 261 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto transaction1 = model::gradido::Transaction::createGroupMemberUpdate(user_1, user_group); - transaction1->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); - transaction1->sign(user_1); - auto transaction1_json = transaction1->getTransactionAsJson(true); - responseStream << "\n"; - responseStream << "\t\t\t"; -#line 267 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction1_json) ); - responseStream << "
\n"; - responseStream << "\t\t\t"; -#line 268 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\tTime: "; -#line 269 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "\n"; - responseStream << "\t\t
3. Send a add-member transaction to hedera topic with two signatures (first user and second user)
\n"; - responseStream << "\t\t\t"; -#line 273 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - time2.reset(); - if(!steps[1]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 277 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto transaction2 = model::gradido::Transaction::createGroupMemberUpdate(user_2, user_group); - transaction2->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(2); - transaction2->sign(user_2); - // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction2->sign(user_1); - auto transaction2_json = transaction2->getTransactionAsJson(true); - responseStream << "\n"; - responseStream << "\t\t\t"; -#line 286 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction2_json) ); - responseStream << "
\n"; - responseStream << "\t\t\t"; -#line 287 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\tTime: "; -#line 288 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "\n"; - responseStream << "\t\t
4. Send a creation transaction to second user, signed by first user
\n"; - responseStream << "\t\t\t"; -#line 292 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - time2.reset(); - if(!steps[2]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 296 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto transaction3 = model::gradido::Transaction::createCreation(user_2, 10000000, Poco::DateTime(), "Test Creation"); - // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction3->sign(user_1); - auto transaction3_json = transaction3->getTransactionAsJson(true); - responseStream << "\n"; - responseStream << "\t\t\t"; -#line 303 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction3_json) ); - responseStream << "
\n"; - responseStream << "\t\t\t"; -#line 304 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\tTime: "; -#line 305 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "
\n"; - responseStream << "\t\t5. Send a transfer transaction from second user to first user signed by second user
\n"; - responseStream << "\t\t\t"; -#line 309 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - time2.reset(); - if(!steps[3]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 313 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto user_1_pubkey = user_1->getModel()->getPublicKeyCopy(); - auto transaction4 = model::gradido::Transaction::createTransfer(user_2, user_1_pubkey, user_group, 5000000, "Test Transfer"); - // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction4[0]->sign(user_2); - auto transaction4_json = transaction4[0]->getTransactionAsJson(true); - responseStream << "\n"; - responseStream << "\t\t\t"; -#line 321 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction4_json) ); - responseStream << "
\n"; - responseStream << "\t\t\t"; -#line 322 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\tTime: "; -#line 323 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "
\n"; - responseStream << "\t\t6. Send a add-member transaction to hedera topic 2 with one signature (third user)
\n"; - responseStream << "\t\t\t"; -#line 327 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - time2.reset(); - if(!steps[4]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 331 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto transaction5 = model::gradido::Transaction::createGroupMemberUpdate(user_3, user_group2); - transaction5->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction5->sign(user_3); - auto transaction5_json = transaction5->getTransactionAsJson(true); - responseStream << "\n"; - responseStream << "\t\t\t"; -#line 338 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction5_json) ); - responseStream << "
\n"; - responseStream << "\t\t\t"; -#line 339 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\tTime: "; -#line 340 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "
\n"; - responseStream << "\t\t7. Send a cross group transfer from second user to third user signed by second user
\n"; - responseStream << "\t\t\t"; -#line 344 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - time2.reset(); - if(!steps[5]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 348 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto user_3_pubkey = user_3->getModel()->getPublicKeyCopy(); - auto transaction6 = model::gradido::Transaction::createTransfer(user_2, user_3_pubkey, user_group2, 4000000, "Test Group Transfer", false); - if(!transaction6.size()) { - responseStream << "\n"; - responseStream << "\t\t\t\t"; -#line 364 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction6_json) ); - responseStream << "
\t\t\n"; - responseStream << "\t\t\t\t\t"; -#line 365 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - if(!paired_transaction.isNull()) { - auto transaction6_2_json = paired_transaction->getTransactionAsJson(true); - responseStream << ""; -#line 367 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction6_2_json) ); - responseStream << "
\n"; - responseStream << "\t\t\t\t\t"; -#line 368 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\t\t"; -#line 369 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\t\t"; -#line 370 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << " \n"; - responseStream << "\t\t\tTime: "; -#line 371 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "
\n"; - responseStream << "\t\t8. Wait "; -#line 374 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( hedera_timeout ); - responseStream << " seconds to give hedera time to process transactions
\n"; - responseStream << "\t\t\t"; -#line 375 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - if(!steps[6]) { responseStream << "\n"; - responseStream << "\t\t\t\tskipped
\n"; - responseStream << "\t\t\t"; -#line 377 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - Poco::Thread::sleep(hedera_timeout * 1000); - } responseStream << "\n"; - responseStream << "\t\t9. Ask choosen node for transaction and print result
\n"; - responseStream << "\t\t\t"; -#line 383 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - time2.reset(); - if(!steps[7] || node_server.isNull()) { - responseStream << "skipped
\n"; - responseStream << "\t\t\t"; -#line 386 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } else { - auto node_server_model = node_server->getModel(); - JsonRPCRequest jsonrpc(node_server_model->getUrl(), node_server_model->getPort()); - Poco::JSON::Object params; - params.set("groupAlias", user_group->getModel()->getAlias()); - params.set("lastKnownSequenceNumber", 0); - auto gn_answear = jsonrpc.request("getTransactions", params); - if(!gn_answear.isNull()) { - std::stringstream ss; - Poco::JSON::Stringifier::stringify(gn_answear, ss, 4, -1, Poco::JSON_PRESERVE_KEY_ORDER); - std::string answear_string = ss.str(); responseStream << "\n"; - responseStream << "\t\t\t\t\t"; -#line 397 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( DataTypeConverter::replaceNewLineWithBr(answear_string) ); -#line 397 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - - } - } responseStream << "\n"; - responseStream << "\t\t\tTime: "; -#line 400 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time2.string() ); - responseStream << "
\n"; - responseStream << "\t\tTime: "; -#line 419 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - responseStream << ( time3.string() ); - responseStream << "
\n"; - responseStream << "\t"; -#line 420 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" - } responseStream << "\n"; - responseStream << "\t\n"; - responseStream << "Copyright © Gradido 2020
\n"; - responseStream << "Login Server in Entwicklung
\n"; - responseStream << "Alpha "; -#line 10 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\footer.cpsp" - responseStream << ( ServerConfig::g_versionString ); - responseStream << "
\n"; - responseStream << "1. Create three new accounts and show user public keys for comparisation:
\n"; + responseStream << "\t\t\t"; +#line 217 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + Profiler time2; + auto group_id = hedera_topic->getModel()->getGroupId(); + auto group_id2 = hedera_topic2->getModel()->getGroupId(); + auto user_group = controller::Group::load(group_id); + auto user_group2 = controller::Group::load(group_id2); + auto mnemonic_type = ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER; + + std::string password1 = "hsaj(2askaslASlllak3wjjeudsaj"; + auto user_1 = controller::User::create("testEmail@google.de", "Max", "Mustermann", group_id); + auto passphrase_1 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); + auto gradido_key_pair_1 = KeyPairEd25519::create(passphrase_1); + user_1->setGradidoKeyPair(gradido_key_pair_1); + user_1->login(password1); + + std::string password2 = "uweia8saiSale,dsasA"; + auto user_2 = controller::User::create("testEmail2@google.de", "MJax", "Mustrermann", group_id); + auto passphrase_2 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); + auto gradido_key_pair_2 = KeyPairEd25519::create(passphrase_2); + user_2->setGradidoKeyPair(gradido_key_pair_2); + user_2->login(password2); + + std::string password3 = "jaue_skaiellasealaK"; + auto user_3 = controller::User::create("testEmail3@gmail.com", "Morpheus", "Miaufull", group_id2); + auto passphrase_3 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); + auto gradido_key_pair_3 = KeyPairEd25519::create(passphrase_3); + user_3->setGradidoKeyPair(gradido_key_pair_3); + user_3->login(password3); + responseStream << "\t\t\t\n"; + responseStream << "\t\t\t\n"; + responseStream << "\t\t\t\n"; + responseStream << "\t\t\tTime: "; +#line 253 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "\n"; + responseStream << "\t\t
2. Send a add-member transaction to hedera topic with one signature (first user)
\n"; + responseStream << "\t\t\t"; +#line 257 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + time2.reset(); + if(!steps[0]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 261 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto transaction1 = model::gradido::Transaction::createGroupMemberUpdate(user_1, user_group); + transaction1->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); + transaction1->sign(user_1); + auto transaction1_json = transaction1->getTransactionAsJson(true); + responseStream << "\n"; + responseStream << "\t\t\t"; +#line 267 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction1_json) ); + responseStream << "
\n"; + responseStream << "\t\t\t"; +#line 268 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\tTime: "; +#line 269 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "\n"; + responseStream << "\t\t
3. Send a add-member transaction to hedera topic with two signatures (first user and second user)
\n"; + responseStream << "\t\t\t"; +#line 273 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + time2.reset(); + if(!steps[1]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 277 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto transaction2 = model::gradido::Transaction::createGroupMemberUpdate(user_2, user_group); + transaction2->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(2); + transaction2->sign(user_2); + // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction2->sign(user_1); + auto transaction2_json = transaction2->getTransactionAsJson(true); + responseStream << "\n"; + responseStream << "\t\t\t"; +#line 286 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction2_json) ); + responseStream << "
\n"; + responseStream << "\t\t\t"; +#line 287 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\tTime: "; +#line 288 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "\n"; + responseStream << "\t\t
4. Send a creation transaction to second user, signed by first user
\n"; + responseStream << "\t\t\t"; +#line 292 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + time2.reset(); + if(!steps[2]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 296 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto transaction3 = model::gradido::Transaction::createCreation(user_2, 10000000, Poco::DateTime(), "Test Creation"); + // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction3->sign(user_1); + auto transaction3_json = transaction3->getTransactionAsJson(true); + responseStream << "\n"; + responseStream << "\t\t\t"; +#line 303 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction3_json) ); + responseStream << "
\n"; + responseStream << "\t\t\t"; +#line 304 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\tTime: "; +#line 305 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "
\n"; + responseStream << "\t\t5. Send a transfer transaction from second user to first user signed by second user
\n"; + responseStream << "\t\t\t"; +#line 309 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + time2.reset(); + if(!steps[3]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 313 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto user_1_pubkey = user_1->getModel()->getPublicKeyCopy(); + auto transaction4 = model::gradido::Transaction::createTransfer(user_2, user_1_pubkey, user_group, 5000000, "Test Transfer"); + // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction4[0]->sign(user_2); + auto transaction4_json = transaction4[0]->getTransactionAsJson(true); + responseStream << "\n"; + responseStream << "\t\t\t"; +#line 321 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction4_json) ); + responseStream << "
\n"; + responseStream << "\t\t\t"; +#line 322 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\tTime: "; +#line 323 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "
\n"; + responseStream << "\t\t6. Send a add-member transaction to hedera topic 2 with one signature (third user)
\n"; + responseStream << "\t\t\t"; +#line 327 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + time2.reset(); + if(!steps[4]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 331 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto transaction5 = model::gradido::Transaction::createGroupMemberUpdate(user_3, user_group2); + transaction5->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction5->sign(user_3); + auto transaction5_json = transaction5->getTransactionAsJson(true); + responseStream << "\n"; + responseStream << "\t\t\t"; +#line 338 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction5_json) ); + responseStream << "
\n"; + responseStream << "\t\t\t"; +#line 339 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\tTime: "; +#line 340 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "
\n"; + responseStream << "\t\t7. Send a cross group transfer from second user to third user signed by second user
\n"; + responseStream << "\t\t\t"; +#line 344 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + time2.reset(); + if(!steps[5]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 348 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto user_3_pubkey = user_3->getModel()->getPublicKeyCopy(); + auto transaction6 = model::gradido::Transaction::createTransfer(user_2, user_3_pubkey, user_group2, 4000000, "Test Group Transfer", false); + if(!transaction6.size()) { + responseStream << "\n"; + responseStream << "\t\t\t\t"; +#line 364 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction6_json) ); + responseStream << "
\t\t\n"; + responseStream << "\t\t\t\t\t"; +#line 365 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + if(!paired_transaction.isNull()) { + auto transaction6_2_json = paired_transaction->getTransactionAsJson(true); + responseStream << ""; +#line 367 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(transaction6_2_json) ); + responseStream << "
\n"; + responseStream << "\t\t\t\t\t"; +#line 368 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\t\t"; +#line 369 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\t\t"; +#line 370 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << " \n"; + responseStream << "\t\t\tTime: "; +#line 371 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "
\n"; + responseStream << "\t\t8. Wait "; +#line 374 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( hedera_timeout ); + responseStream << " seconds to give hedera time to process transactions
\n"; + responseStream << "\t\t\t"; +#line 375 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + if(!steps[6]) { responseStream << "\n"; + responseStream << "\t\t\t\tskipped
\n"; + responseStream << "\t\t\t"; +#line 377 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + Poco::Thread::sleep(hedera_timeout * 1000); + } responseStream << "\n"; + responseStream << "\t\t9. Ask choosen node for transaction and print result
\n"; + responseStream << "\t\t\t"; +#line 383 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + time2.reset(); + if(!steps[7] || node_server.isNull()) { + responseStream << "skipped
\n"; + responseStream << "\t\t\t"; +#line 386 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } else { + auto node_server_model = node_server->getModel(); + JsonRPCRequest jsonrpc(node_server_model->getUrl(), node_server_model->getPort()); + Poco::JSON::Object params; + params.set("groupAlias", user_group->getModel()->getAlias()); + params.set("lastKnownSequenceNumber", 0); + auto gn_answear = jsonrpc.request("getTransactions", params); + if(!gn_answear.isNull()) { + std::stringstream ss; + Poco::JSON::Stringifier::stringify(gn_answear, ss, 4, -1, Poco::JSON_PRESERVE_KEY_ORDER); + std::string answear_string = ss.str(); responseStream << "\n"; + responseStream << "\t\t\t\t\t"; +#line 397 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( DataTypeConverter::replaceNewLineWithBr(answear_string) ); +#line 397 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + + } + } responseStream << "\n"; + responseStream << "\t\t\tTime: "; +#line 400 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time2.string() ); + responseStream << "
\n"; + responseStream << "\t\tTime: "; +#line 419 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + responseStream << ( time3.string() ); + responseStream << "
\n"; + responseStream << "\t"; +#line 420 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\adminNodeServerTest.cpsp" + } responseStream << "\n"; + responseStream << "\t\n"; + responseStream << "Copyright © Gradido 2020
\n"; + responseStream << "Login Server in Entwicklung
\n"; + responseStream << "Alpha "; +#line 10 "F:\\Gradido\\gradido_login_server\\src\\cpsp\\footer.cpsp" + responseStream << ( ServerConfig::g_versionString ); + responseStream << "
\n"; + responseStream << "1. Create three new accounts and show user public keys for comparisation:
- <% - Profiler time2; - auto group_id = hedera_topic->getModel()->getGroupId(); - auto group_id2 = hedera_topic2->getModel()->getGroupId(); - auto user_group = controller::Group::load(group_id); - auto user_group2 = controller::Group::load(group_id2); - auto mnemonic_type = ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER; - - std::string password1 = "hsaj(2askaslASlllak3wjjeudsaj"; - auto user_1 = controller::User::create("testEmail@google.de", "Max", "Mustermann", group_id); - auto passphrase_1 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); - auto gradido_key_pair_1 = KeyPairEd25519::create(passphrase_1); - user_1->setGradidoKeyPair(gradido_key_pair_1); - user_1->login(password1); - - std::string password2 = "uweia8saiSale,dsasA"; - auto user_2 = controller::User::create("testEmail2@google.de", "MJax", "Mustrermann", group_id); - auto passphrase_2 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); - auto gradido_key_pair_2 = KeyPairEd25519::create(passphrase_2); - user_2->setGradidoKeyPair(gradido_key_pair_2); - user_2->login(password2); - - std::string password3 = "jaue_skaiellasealaK"; - auto user_3 = controller::User::create("testEmail3@gmail.com", "Morpheus", "Miaufull", group_id2); - auto passphrase_3 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); - auto gradido_key_pair_3 = KeyPairEd25519::create(passphrase_3); - user_3->setGradidoKeyPair(gradido_key_pair_3); - user_3->login(password3); - %> - - -Time: <%= time2.string() %> -
2. Send a add-member transaction to hedera topic with one signature (first user)
- <% - time2.reset(); - if(!steps[0]) { %> -skipped
- <% } else { - auto transaction1 = model::gradido::Transaction::createGroupMemberUpdate(user_1, user_group); - transaction1->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); - transaction1->sign(user_1); - auto transaction1_json = transaction1->getTransactionAsJson(true); - %> -<%= DataTypeConverter::replaceNewLineWithBr(transaction1_json) %>
- <% } %> -Time: <%= time2.string() %> -
3. Send a add-member transaction to hedera topic with two signatures (first user and second user)
- <% - time2.reset(); - if(!steps[1]) { %> -skipped
- <% } else { - auto transaction2 = model::gradido::Transaction::createGroupMemberUpdate(user_2, user_group); - transaction2->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(2); - transaction2->sign(user_2); - // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction2->sign(user_1); - auto transaction2_json = transaction2->getTransactionAsJson(true); - %> -<%= DataTypeConverter::replaceNewLineWithBr(transaction2_json) %>
- <% } %> -Time: <%= time2.string() %> -
4. Send a creation transaction to second user, signed by first user
- <% - time2.reset(); - if(!steps[2]) { %> -skipped
- <% } else { - auto transaction3 = model::gradido::Transaction::createCreation(user_2, 10000000, Poco::DateTime(), "Test Creation"); - // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction3->sign(user_1); - auto transaction3_json = transaction3->getTransactionAsJson(true); - %> -<%= DataTypeConverter::replaceNewLineWithBr(transaction3_json) %>
- <% } %> -Time: <%= time2.string() %>
-5. Send a transfer transaction from second user to first user signed by second user
- <% - time2.reset(); - if(!steps[3]) { %> -skipped
- <% } else { - auto user_1_pubkey = user_1->getModel()->getPublicKeyCopy(); - auto transaction4 = model::gradido::Transaction::createTransfer(user_2, user_1_pubkey, user_group, 5000000, "Test Transfer"); - // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction4[0]->sign(user_2); - auto transaction4_json = transaction4[0]->getTransactionAsJson(true); - %> -<%= DataTypeConverter::replaceNewLineWithBr(transaction4_json) %>
- <% } %> -Time: <%= time2.string() %>
-6. Send a add-member transaction to hedera topic 2 with one signature (third user)
- <% - time2.reset(); - if(!steps[4]) { %> -skipped
- <% } else { - auto transaction5 = model::gradido::Transaction::createGroupMemberUpdate(user_3, user_group2); - transaction5->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); - Poco::Thread::sleep(sleep_ms_between_transactions); - transaction5->sign(user_3); - auto transaction5_json = transaction5->getTransactionAsJson(true); - %> -<%= DataTypeConverter::replaceNewLineWithBr(transaction5_json) %>
- <% } %> -Time: <%= time2.string() %>
-7. Send a cross group transfer from second user to third user signed by second user
- <% - time2.reset(); - if(!steps[5]) { %> -skipped
- <% } else { - auto user_3_pubkey = user_3->getModel()->getPublicKeyCopy(); - auto transaction6 = model::gradido::Transaction::createTransfer(user_2, user_3_pubkey, user_group2, 4000000, "Test Group Transfer", false); - if(!transaction6.size()) { - %> -<%= DataTypeConverter::replaceNewLineWithBr(transaction6_json) %>
- <% if(!paired_transaction.isNull()) { - auto transaction6_2_json = paired_transaction->getTransactionAsJson(true); - %><%= DataTypeConverter::replaceNewLineWithBr(transaction6_2_json) %>
- <% } %> - <% } %> - <% } %> -Time: <%= time2.string() %>
-8. Wait <%= hedera_timeout %> seconds to give hedera time to process transactions
- <% if(!steps[6]) { %> -skipped
- <% } else { - Poco::Thread::sleep(hedera_timeout * 1000); - } %> -9. Ask choosen node for transaction and print result
- <% time2.reset(); - if(!steps[7] || node_server.isNull()) { - %>skipped
- <% } else { - auto node_server_model = node_server->getModel(); - JsonRPCRequest jsonrpc(node_server_model->getUrl(), node_server_model->getPort()); - Poco::JSON::Object params; - params.set("groupAlias", user_group->getModel()->getAlias()); - params.set("lastKnownSequenceNumber", 0); - auto gn_answear = jsonrpc.request("getTransactions", params); - if(!gn_answear.isNull()) { - std::stringstream ss; - Poco::JSON::Stringifier::stringify(gn_answear, ss, 4, -1, Poco::JSON_PRESERVE_KEY_ORDER); - std::string answear_string = ss.str(); %> - <%= DataTypeConverter::replaceNewLineWithBr(answear_string) %><% - } - } %> -Time: <%= time2.string() %>
-Time: <%= time3.string() %>
- <% } %> - -1. Create three new accounts and show user public keys for comparisation:
+ <% + Profiler time2; + auto group_id = hedera_topic->getModel()->getGroupId(); + auto group_id2 = hedera_topic2->getModel()->getGroupId(); + auto user_group = controller::Group::load(group_id); + auto user_group2 = controller::Group::load(group_id2); + auto mnemonic_type = ServerConfig::MNEMONIC_BIP0039_SORTED_ORDER; + + std::string password1 = "hsaj(2askaslASlllak3wjjeudsaj"; + auto user_1 = controller::User::create("testEmail@google.de", "Max", "Mustermann", group_id); + auto passphrase_1 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); + auto gradido_key_pair_1 = KeyPairEd25519::create(passphrase_1); + user_1->setGradidoKeyPair(gradido_key_pair_1); + user_1->login(password1); + + std::string password2 = "uweia8saiSale,dsasA"; + auto user_2 = controller::User::create("testEmail2@google.de", "MJax", "Mustrermann", group_id); + auto passphrase_2 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); + auto gradido_key_pair_2 = KeyPairEd25519::create(passphrase_2); + user_2->setGradidoKeyPair(gradido_key_pair_2); + user_2->login(password2); + + std::string password3 = "jaue_skaiellasealaK"; + auto user_3 = controller::User::create("testEmail3@gmail.com", "Morpheus", "Miaufull", group_id2); + auto passphrase_3 = Passphrase::generate(&ServerConfig::g_Mnemonic_WordLists[mnemonic_type]); + auto gradido_key_pair_3 = KeyPairEd25519::create(passphrase_3); + user_3->setGradidoKeyPair(gradido_key_pair_3); + user_3->login(password3); + %> + + +Time: <%= time2.string() %> +
2. Send a add-member transaction to hedera topic with one signature (first user)
+ <% + time2.reset(); + if(!steps[0]) { %> +skipped
+ <% } else { + auto transaction1 = model::gradido::Transaction::createGroupMemberUpdate(user_1, user_group); + transaction1->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); + transaction1->sign(user_1); + auto transaction1_json = transaction1->getTransactionAsJson(true); + %> +<%= DataTypeConverter::replaceNewLineWithBr(transaction1_json) %>
+ <% } %> +Time: <%= time2.string() %> +
3. Send a add-member transaction to hedera topic with two signatures (first user and second user)
+ <% + time2.reset(); + if(!steps[1]) { %> +skipped
+ <% } else { + auto transaction2 = model::gradido::Transaction::createGroupMemberUpdate(user_2, user_group); + transaction2->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(2); + transaction2->sign(user_2); + // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction2->sign(user_1); + auto transaction2_json = transaction2->getTransactionAsJson(true); + %> +<%= DataTypeConverter::replaceNewLineWithBr(transaction2_json) %>
+ <% } %> +Time: <%= time2.string() %> +
4. Send a creation transaction to second user, signed by first user
+ <% + time2.reset(); + if(!steps[2]) { %> +skipped
+ <% } else { + auto transaction3 = model::gradido::Transaction::createCreation(user_2, 10000000, Poco::DateTime(), "Test Creation"); + // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction3->sign(user_1); + auto transaction3_json = transaction3->getTransactionAsJson(true); + %> +<%= DataTypeConverter::replaceNewLineWithBr(transaction3_json) %>
+ <% } %> +Time: <%= time2.string() %>
+5. Send a transfer transaction from second user to first user signed by second user
+ <% + time2.reset(); + if(!steps[3]) { %> +skipped
+ <% } else { + auto user_1_pubkey = user_1->getModel()->getPublicKeyCopy(); + auto transaction4 = model::gradido::Transaction::createTransfer(user_2, user_1_pubkey, user_group, 5000000, "Test Transfer"); + // wait before sending fourth transaction, gn seems to crash by more than 3 transaction at nearly the same time + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction4[0]->sign(user_2); + auto transaction4_json = transaction4[0]->getTransactionAsJson(true); + %> +<%= DataTypeConverter::replaceNewLineWithBr(transaction4_json) %>
+ <% } %> +Time: <%= time2.string() %>
+6. Send a add-member transaction to hedera topic 2 with one signature (third user)
+ <% + time2.reset(); + if(!steps[4]) { %> +skipped
+ <% } else { + auto transaction5 = model::gradido::Transaction::createGroupMemberUpdate(user_3, user_group2); + transaction5->getTransactionBody()->getGroupMemberUpdate()->setMinSignatureCount(1); + Poco::Thread::sleep(sleep_ms_between_transactions); + transaction5->sign(user_3); + auto transaction5_json = transaction5->getTransactionAsJson(true); + %> +<%= DataTypeConverter::replaceNewLineWithBr(transaction5_json) %>
+ <% } %> +Time: <%= time2.string() %>
+7. Send a cross group transfer from second user to third user signed by second user
+ <% + time2.reset(); + if(!steps[5]) { %> +skipped
+ <% } else { + auto user_3_pubkey = user_3->getModel()->getPublicKeyCopy(); + auto transaction6 = model::gradido::Transaction::createTransfer(user_2, user_3_pubkey, user_group2, 4000000, "Test Group Transfer", false); + if(!transaction6.size()) { + %> +<%= DataTypeConverter::replaceNewLineWithBr(transaction6_json) %>
+ <% if(!paired_transaction.isNull()) { + auto transaction6_2_json = paired_transaction->getTransactionAsJson(true); + %><%= DataTypeConverter::replaceNewLineWithBr(transaction6_2_json) %>
+ <% } %> + <% } %> + <% } %> +Time: <%= time2.string() %>
+8. Wait <%= hedera_timeout %> seconds to give hedera time to process transactions
+ <% if(!steps[6]) { %> +skipped
+ <% } else { + Poco::Thread::sleep(hedera_timeout * 1000); + } %> +9. Ask choosen node for transaction and print result
+ <% time2.reset(); + if(!steps[7] || node_server.isNull()) { + %>skipped
+ <% } else { + auto node_server_model = node_server->getModel(); + JsonRPCRequest jsonrpc(node_server_model->getUrl(), node_server_model->getPort()); + Poco::JSON::Object params; + params.set("groupAlias", user_group->getModel()->getAlias()); + params.set("lastKnownSequenceNumber", 0); + auto gn_answear = jsonrpc.request("getTransactions", params); + if(!gn_answear.isNull()) { + std::stringstream ss; + Poco::JSON::Stringifier::stringify(gn_answear, ss, 4, -1, Poco::JSON_PRESERVE_KEY_ORDER); + std::string answear_string = ss.str(); %> + <%= DataTypeConverter::replaceNewLineWithBr(answear_string) %><% + } + } %> +Time: <%= time2.string() %>
+Time: <%= time3.string() %>
+ <% } %> + +