From 1badd6fd298224693c28d13475b9be7d3acd1896 Mon Sep 17 00:00:00 2001
From: Vincent Texier <vit@free.fr>
Date: Fri, 2 Jul 2021 19:40:46 +0200
Subject: [PATCH] [enh] #175 rename timestamp and blockstamp
 attributes/arguments depending on the type (BBC)

timestamp is used for integer time in seconds
block_uid is used for blockUID instances
---
 duniterpy/documents/certification.py  | 38 ++++++++++++------------
 duniterpy/documents/identity.py       | 42 +++++++++++++--------------
 duniterpy/documents/membership.py     | 36 +++++++++++------------
 duniterpy/documents/peer.py           |  6 ++--
 duniterpy/documents/revocation.py     |  8 ++---
 duniterpy/documents/transaction.py    | 36 +++++++++++------------
 duniterpy/documents/ws2p/heads.py     | 14 ++++-----
 duniterpy/helpers/network.py          | 12 ++++----
 examples/request_available_nodes.py   |  2 +-
 examples/send_certification.py        |  4 +--
 examples/send_identity.py             |  8 ++---
 examples/send_membership.py           | 14 ++++-----
 examples/send_transaction.py          |  4 +--
 tests/documents/test_block.py         |  2 +-
 tests/documents/test_certification.py | 20 ++++++-------
 tests/documents/test_membership.py    | 27 +++++++++--------
 tests/documents/test_peer.py          |  4 +--
 tests/documents/test_transaction.py   |  8 ++---
 tests/documents/test_ws2p_heads.py    |  2 +-
 19 files changed, 145 insertions(+), 142 deletions(-)

diff --git a/duniterpy/documents/certification.py b/duniterpy/documents/certification.py
index b0c93bc5..960e2cd5 100644
--- a/duniterpy/documents/certification.py
+++ b/duniterpy/documents/certification.py
@@ -52,20 +52,20 @@ class Certification(Document):
     re_issuer = re.compile(
         "Issuer: ({pubkey_regex})\n".format(pubkey_regex=PUBKEY_REGEX)
     )
-    re_cert_timestamp = re.compile(
+    re_cert_block_uid = re.compile(
         "CertTimestamp: ({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
 
     fields_parsers = {
         **Document.fields_parsers,
-        **{"Type": re_type, "Issuer": re_issuer, "CertTimestamp": re_cert_timestamp},
+        **{"Type": re_type, "Issuer": re_issuer, "CertTimestamp": re_cert_block_uid},
     }
 
     def __init__(
         self,
         pubkey_from: str,
         identity: Union[Identity, str],
-        timestamp: BlockUID,
+        block_uid: BlockUID,
         signing_key: SigningKey = None,
         version: int = VERSION,
         currency: str = G1_CURRENCY_CODENAME,
@@ -75,7 +75,7 @@ class Certification(Document):
 
         :param pubkey_from: Pubkey of the certifier
         :param identity: Document instance of the certified identity or identity pubkey string
-        :param timestamp: the blockuid
+        :param block_uid: the blockuid
         :param signing_key: SigningKey instance to sign the document (default=None)
         :param version: Document version (default=certification.VERSION)
         :param currency: Currency codename (default=constants.CURRENCY_CODENAME_G1)
@@ -84,7 +84,7 @@ class Certification(Document):
         self.pubkey_from = pubkey_from
         self.identity = identity if isinstance(identity, Identity) else None
         self.pubkey_to = identity.pubkey if isinstance(identity, Identity) else identity
-        self.timestamp = timestamp
+        self.block_uid = block_uid
 
         if signing_key is not None:
             self.sign(signing_key)
@@ -114,7 +114,7 @@ class Certification(Document):
         pubkey_from = Certification.parse_field("Issuer", lines[n])
         n += 5
 
-        timestamp = BlockUID.from_str(
+        block_uid = BlockUID.from_str(
             Certification.parse_field("CertTimestamp", lines[n])
         )
         n += 1
@@ -124,7 +124,7 @@ class Certification(Document):
         identity = Identity.from_certification_raw(signed_raw)
 
         certification = cls(
-            pubkey_from, identity, timestamp, version=version, currency=currency
+            pubkey_from, identity, block_uid, version=version, currency=currency
         )
 
         # return certification with signature
@@ -134,7 +134,7 @@ class Certification(Document):
     @classmethod
     def from_inline(
         cls: Type[CertificationType],
-        blockhash: Optional[str],
+        block_hash: Optional[str],
         inline: str,
         version: int = VERSION,
         currency: str = G1_CURRENCY_CODENAME,
@@ -145,7 +145,7 @@ class Certification(Document):
         Only self.pubkey_to is populated.
         You must populate self.identity with an Identity instance to use raw/sign/signed_raw methods
 
-        :param blockhash: Hash of the block
+        :param block_hash: Hash of the block
         :param inline: Inline document
         :param version: Document version (default=certification.VERSION)
         :param currency: Currency codename (default=constants.CURRENCY_CODENAME_G1)
@@ -156,15 +156,15 @@ class Certification(Document):
             raise MalformedDocumentError("Certification ({0})".format(inline))
         pubkey_from = cert_data.group(1)
         pubkey_to = cert_data.group(2)
-        blockid = int(cert_data.group(3))
-        if blockid == 0 or blockhash is None:
-            timestamp = BlockUID.empty()
+        block_number = int(cert_data.group(3))
+        if block_number == 0 or block_hash is None:
+            block_uid = BlockUID.empty()
         else:
-            timestamp = BlockUID(blockid, blockhash)
+            block_uid = BlockUID(block_number, block_hash)
 
         signature = cert_data.group(4)
         certification = cls(
-            pubkey_from, pubkey_to, timestamp, version=version, currency=currency
+            pubkey_from, pubkey_to, block_uid, version=version, currency=currency
         )
 
         # return certification with signature
@@ -186,18 +186,18 @@ Currency: {currency}
 Issuer: {issuer}
 IdtyIssuer: {certified_pubkey}
 IdtyUniqueID: {certified_uid}
-IdtyTimestamp: {certified_ts}
+IdtyTimestamp: {certified_block_uid}
 IdtySignature: {certified_signature}
-CertTimestamp: {timestamp}
+CertTimestamp: {block_uid}
 """.format(
             version=self.version,
             currency=self.currency,
             issuer=self.pubkey_from,
             certified_pubkey=self.identity.pubkey,
             certified_uid=self.identity.uid,
-            certified_ts=self.identity.timestamp,
+            certified_block_uid=self.identity.block_uid,
             certified_signature=self.identity.signature,
-            timestamp=self.timestamp,
+            block_uid=self.block_uid,
         )
 
     def sign(self, key: SigningKey) -> None:
@@ -236,5 +236,5 @@ CertTimestamp: {timestamp}
         :return:
         """
         return "{0}:{1}:{2}:{3}".format(
-            self.pubkey_from, self.pubkey_to, self.timestamp.number, self.signature
+            self.pubkey_from, self.pubkey_to, self.block_uid.number, self.signature
         )
diff --git a/duniterpy/documents/identity.py b/duniterpy/documents/identity.py
index 6cf3007c..c437f083 100644
--- a/duniterpy/documents/identity.py
+++ b/duniterpy/documents/identity.py
@@ -55,7 +55,7 @@ class Identity(Document):
     re_meta_ts = re.compile(
         "META:TS:({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
-    re_timestamp = re.compile(
+    re_block_uid = re.compile(
         "Timestamp: ({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
 
@@ -65,7 +65,7 @@ class Identity(Document):
     re_idty_unique_id = re.compile(
         "IdtyUniqueID: ({uid_regex})\n".format(uid_regex=UID_REGEX)
     )
-    re_idty_timestamp = re.compile(
+    re_idty_block_uid = re.compile(
         "IdtyTimestamp: ({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
     re_idty_signature = re.compile(
@@ -78,10 +78,10 @@ class Identity(Document):
             "Type": re_type,
             "UniqueID": re_unique_id,
             "Issuer": re_issuer,
-            "Timestamp": re_timestamp,
+            "Timestamp": re_block_uid,
             "IdtyIssuer": re_idty_issuer,
             "IdtyUniqueID": re_idty_unique_id,
-            "IdtyTimestamp": re_idty_timestamp,
+            "IdtyTimestamp": re_idty_block_uid,
             "IdtySignature": re_idty_signature,
         },
     }
@@ -90,7 +90,7 @@ class Identity(Document):
         self,
         pubkey: str,
         uid: str,
-        timestamp: BlockUID,
+        block_uid: BlockUID,
         signing_key: SigningKey = None,
         version: int = VERSION,
         currency: str = G1_CURRENCY_CODENAME,
@@ -100,7 +100,7 @@ class Identity(Document):
 
         :param pubkey:  Public key of the account linked to the identity
         :param uid: Unique identifier
-        :param timestamp: BlockUID instance
+        :param block_uid: BlockUID instance
         :param signing_key: SigningKey instance to sign the document (default=None)
         :param version: Document version (default=identity.VERSION)
         :param currency: Currency codename (default=constants.CURRENCY_CODENAME_G1)
@@ -108,7 +108,7 @@ class Identity(Document):
         super().__init__(version, currency)
 
         self.pubkey = pubkey
-        self.timestamp = timestamp
+        self.block_uid = block_uid
         self.uid = uid
 
         if signing_key is not None:
@@ -134,10 +134,10 @@ class Identity(Document):
             raise MalformedDocumentError("Inline self certification")
         pubkey = selfcert_data.group(1)
         signature = selfcert_data.group(2)
-        timestamp = BlockUID.from_str(selfcert_data.group(3))
+        block_uid = BlockUID.from_str(selfcert_data.group(3))
         uid = selfcert_data.group(4)
 
-        identity = cls(pubkey, uid, timestamp, version=version, currency=currency)
+        identity = cls(pubkey, uid, block_uid, version=version, currency=currency)
 
         # return identity with signature
         identity.signature = signature
@@ -169,12 +169,12 @@ class Identity(Document):
         uid = Identity.parse_field("UniqueID", lines[n])
         n += 1
 
-        timestamp = BlockUID.from_str(Identity.parse_field("Timestamp", lines[n]))
+        block_uid = BlockUID.from_str(Identity.parse_field("Timestamp", lines[n]))
         n += 1
 
         signature = Identity.parse_field("Signature", lines[n])
 
-        identity = cls(pubkey, uid, timestamp, version=version, currency=currency)
+        identity = cls(pubkey, uid, block_uid, version=version, currency=currency)
 
         # return identity with signature
         identity.signature = signature
@@ -191,13 +191,13 @@ Type: Identity
 Currency: {currency}
 Issuer: {pubkey}
 UniqueID: {uid}
-Timestamp: {timestamp}
+Timestamp: {block_uid}
 """.format(
             version=self.version,
             currency=self.currency,
             pubkey=self.pubkey,
             uid=self.uid,
-            timestamp=self.timestamp,
+            block_uid=self.block_uid,
         )
 
     def inline(self) -> str:
@@ -206,10 +206,10 @@ Timestamp: {timestamp}
 
         :return:
         """
-        return "{pubkey}:{signature}:{timestamp}:{uid}".format(
+        return "{pubkey}:{signature}:{block_uid}:{uid}".format(
             pubkey=self.pubkey,
             signature=self.signature,
-            timestamp=self.timestamp,
+            block_uid=self.block_uid,
             uid=self.uid,
         )
 
@@ -237,12 +237,12 @@ Timestamp: {timestamp}
         uid = Identity.parse_field("IdtyUniqueID", lines[n])
 
         n += 1
-        timestamp = BlockUID.from_str(Identity.parse_field("IdtyTimestamp", lines[n]))
+        block_uid = BlockUID.from_str(Identity.parse_field("IdtyTimestamp", lines[n]))
 
         n += 1
         signature = Identity.parse_field("IdtySignature", lines[n])
 
-        identity = cls(issuer, uid, timestamp, version=version, currency=currency)
+        identity = cls(issuer, uid, block_uid, version=version, currency=currency)
         identity.signature = signature
 
         return identity
@@ -271,12 +271,12 @@ Timestamp: {timestamp}
         uid = Identity.parse_field("IdtyUniqueID", lines[n])
 
         n += 1
-        timestamp = BlockUID.from_str(Identity.parse_field("IdtyTimestamp", lines[n]))
+        block_uid = BlockUID.from_str(Identity.parse_field("IdtyTimestamp", lines[n]))
 
         n += 1
         signature = Identity.parse_field("IdtySignature", lines[n])
 
-        identity = cls(issuer, uid, timestamp, version=version, currency=currency)
+        identity = cls(issuer, uid, block_uid, version=version, currency=currency)
         identity.signature = signature
 
         return identity
@@ -305,7 +305,7 @@ Timestamp: {timestamp}
                 uids = result["uids"]
                 uid_data = uids[0]
                 # capture data
-                timestamp = BlockUID.from_str(uid_data["meta"]["timestamp"])
+                block_uid = BlockUID.from_str(uid_data["meta"]["timestamp"])
                 uid = uid_data["uid"]  # type: str
                 signature = uid_data["self"]  # type: str
 
@@ -313,7 +313,7 @@ Timestamp: {timestamp}
                 identity = cls(
                     pubkey=pubkey,
                     uid=uid,
-                    timestamp=timestamp,
+                    block_uid=block_uid,
                     version=version,
                     currency=currency,
                 )
diff --git a/duniterpy/documents/membership.py b/duniterpy/documents/membership.py
index 3c966357..6eb48807 100644
--- a/duniterpy/documents/membership.py
+++ b/duniterpy/documents/membership.py
@@ -85,9 +85,9 @@ class Membership(Document):
     def __init__(
         self,
         issuer: str,
-        membership_ts: BlockUID,
+        membership_block_uid: BlockUID,
         uid: str,
-        identity_ts: BlockUID,
+        identity_block_uid: BlockUID,
         signing_key: SigningKey = None,
         version: int = VERSION,
         currency: str = G1_CURRENCY_CODENAME,
@@ -97,9 +97,9 @@ class Membership(Document):
         Create a membership document
 
         :param issuer: Public key of the issuer
-        :param membership_ts: BlockUID of this membership
+        :param membership_block_uid: BlockUID of this membership
         :param uid: Unique identifier of the identity
-        :param identity_ts:  BlockUID of the identity
+        :param identity_block_uid:  BlockUID of the identity
         :param signing_key: SigningKey instance to sign the document (default=None)
         :param version: Document version (default=membership.VERSION)
         :param currency: Currency codename (default=constants.CURRENCY_CODENAME_G1)
@@ -108,10 +108,10 @@ class Membership(Document):
         super().__init__(version, currency)
 
         self.issuer = issuer
-        self.membership_ts = membership_ts
+        self.membership_block_uid = membership_block_uid
         self.membership_type = membership_type
         self.uid = uid
-        self.identity_ts = identity_ts
+        self.identity_block_uid = identity_block_uid
 
         if signing_key is not None:
             self.sign(signing_key)
@@ -138,14 +138,14 @@ class Membership(Document):
             raise MalformedDocumentError("Inline membership ({0})".format(inline))
         issuer = data.group(1)
         signature = data.group(2)
-        membership_blockstamp = BlockUID.from_str(data.group(3))
-        identity_blockstamp = BlockUID.from_str(data.group(4))
+        membership_block_uid = BlockUID.from_str(data.group(3))
+        identity_block_uid = BlockUID.from_str(data.group(4))
         uid = data.group(5)
         membership = cls(
             issuer,
-            membership_blockstamp,
+            membership_block_uid,
             uid,
-            identity_blockstamp,
+            identity_block_uid,
             version=version,
             currency=currency,
             membership_type=membership_type,
@@ -178,7 +178,7 @@ class Membership(Document):
         issuer = Membership.parse_field("Issuer", lines[n])
         n += 1
 
-        membership_blockstamp = BlockUID.from_str(
+        membership_block_uid = BlockUID.from_str(
             Membership.parse_field("Block", lines[n])
         )
         n += 1
@@ -189,7 +189,7 @@ class Membership(Document):
         uid = Membership.parse_field("UserID", lines[n])
         n += 1
 
-        identity_blockstamp = BlockUID.from_str(
+        identity_block_uid = BlockUID.from_str(
             Membership.parse_field("CertTS", lines[n])
         )
         n += 1
@@ -199,9 +199,9 @@ class Membership(Document):
 
         membership = cls(
             issuer,
-            membership_blockstamp,
+            membership_block_uid,
             uid,
-            identity_blockstamp,
+            identity_block_uid,
             version=version,
             currency=currency,
             membership_type=membership_type,
@@ -229,10 +229,10 @@ CertTS: {6}
             self.version,
             self.currency,
             self.issuer,
-            self.membership_ts,
+            self.membership_block_uid,
             self.membership_type,
             self.uid,
-            self.identity_ts,
+            self.identity_block_uid,
         )
 
     def inline(self) -> str:
@@ -243,7 +243,7 @@ CertTS: {6}
         return "{0}:{1}:{2}:{3}:{4}".format(
             self.issuer,
             self.signature,
-            self.membership_ts,
-            self.identity_ts,
+            self.membership_block_uid,
+            self.identity_block_uid,
             self.uid,
         )
diff --git a/duniterpy/documents/peer.py b/duniterpy/documents/peer.py
index 7df979ab..89da758d 100644
--- a/duniterpy/documents/peer.py
+++ b/duniterpy/documents/peer.py
@@ -79,7 +79,7 @@ class Peer(Document):
         Init Peer instance
 
         :param pubkey: Public key of the issuer
-        :param block_uid: BlockUID instance timestamp
+        :param block_uid: BlockUID instance
         :param endpoints: List of endpoints string
         :param signing_key: SigningKey instance to sign the document (default=None)
         :param version: Document version (default=peer.VERSION)
@@ -88,7 +88,7 @@ class Peer(Document):
         super().__init__(version, currency)
 
         self.pubkey = pubkey
-        self.blockUID = block_uid
+        self.block_uid = block_uid
         self.endpoints: List[Endpoint] = endpoints
 
         if signing_key is not None:
@@ -152,7 +152,7 @@ PublicKey: {2}
 Block: {3}
 Endpoints:
 """.format(
-            self.version, self.currency, self.pubkey, self.blockUID
+            self.version, self.currency, self.pubkey, self.block_uid
         )
 
         for _endpoint in self.endpoints:
diff --git a/duniterpy/documents/revocation.py b/duniterpy/documents/revocation.py
index 0bb43542..4da0d646 100644
--- a/duniterpy/documents/revocation.py
+++ b/duniterpy/documents/revocation.py
@@ -49,7 +49,7 @@ class Revocation(Document):
         "Issuer: ({pubkey_regex})\n".format(pubkey_regex=PUBKEY_REGEX)
     )
     re_uniqueid = re.compile("IdtyUniqueID: ([^\n]+)\n")
-    re_timestamp = re.compile(
+    re_block_uid = re.compile(
         "IdtyTimestamp: ({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
     re_idtysignature = re.compile(
@@ -62,7 +62,7 @@ class Revocation(Document):
             "Type": re_type,
             "Issuer": re_issuer,
             "IdtyUniqueID": re_uniqueid,
-            "IdtyTimestamp": re_timestamp,
+            "IdtyTimestamp": re_block_uid,
             "IdtySignature": re_idtysignature,
         },
     }
@@ -183,14 +183,14 @@ Type: Revocation
 Currency: {currency}
 Issuer: {pubkey}
 IdtyUniqueID: {uid}
-IdtyTimestamp: {timestamp}
+IdtyTimestamp: {block_uid}
 IdtySignature: {signature}
 """.format(
             version=self.version,
             currency=self.currency,
             pubkey=self.identity.pubkey,
             uid=self.identity.uid,
-            timestamp=self.identity.timestamp,
+            block_uid=self.identity.block_uid,
             signature=self.identity.signature,
         )
 
diff --git a/duniterpy/documents/transaction.py b/duniterpy/documents/transaction.py
index 21e4ba10..dfbf84d6 100644
--- a/duniterpy/documents/transaction.py
+++ b/duniterpy/documents/transaction.py
@@ -506,10 +506,10 @@ class Transaction(Document):
     re_header = re.compile(
         "TX:([0-9]+):([0-9]+):([0-9]+):([0-9]+):([0-9]+):([01]):([0-9]+)\n"
     )
-    re_compact_blockstamp = re.compile(
+    re_compact_block_uid = re.compile(
         "({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
-    re_blockstamp = re.compile(
+    re_block_uid = re.compile(
         "Blockstamp: ({block_uid_regex})\n".format(block_uid_regex=BLOCK_UID_REGEX)
     )
     re_locktime = re.compile("Locktime: ([0-9]+)\n")
@@ -525,8 +525,8 @@ class Transaction(Document):
         **Document.fields_parsers,
         **{
             "Type": re_type,
-            "Blockstamp": re_blockstamp,
-            "CompactBlockstamp": re_compact_blockstamp,
+            "Blockstamp": re_block_uid,
+            "CompactBlockstamp": re_compact_block_uid,
             "Locktime": re_locktime,
             "TX": re_header,
             "Issuers": re_issuers,
@@ -541,7 +541,7 @@ class Transaction(Document):
 
     def __init__(
         self,
-        blockstamp: Optional[BlockUID],
+        block_uid: Optional[BlockUID],
         locktime: int,
         issuers: List[str],
         inputs: List[InputSource],
@@ -556,7 +556,7 @@ class Transaction(Document):
         """
         Init Transaction instance
 
-        :param blockstamp: BlockUID timestamp of the block
+        :param block_uid: BlockUID instance
         :param locktime: Lock time in seconds
         :param issuers: List of issuers public key
         :param inputs: List of InputSource instances
@@ -569,7 +569,7 @@ class Transaction(Document):
         :param currency: Currency codename (default=constants.CURRENCY_CODENAME_G1)
         """
         super().__init__(version, currency)
-        self.blockstamp = blockstamp
+        self.block_uid = block_uid
         self.locktime = locktime
         self.issuers = issuers
         self.inputs = inputs
@@ -592,7 +592,7 @@ class Transaction(Document):
             self.version == other.version
             and self.currency == other.currency
             and self.signatures == other.signatures
-            and self.blockstamp == other.blockstamp
+            and self.block_uid == other.block_uid
             and self.locktime == other.locktime
             and self.issuers == other.issuers
             and self.inputs == other.inputs
@@ -608,7 +608,7 @@ class Transaction(Document):
                 self.version,
                 self.currency,
                 self.signatures,
-                self.blockstamp,
+                self.block_uid,
                 self.locktime,
                 self.issuers,
                 self.inputs,
@@ -682,7 +682,7 @@ Comment: {comment}
         locktime = int(header_data.group(7))
         n += 1
 
-        blockstamp = BlockUID.from_str(
+        block_uid = BlockUID.from_str(
             Transaction.parse_field("CompactBlockstamp", lines[n])
         )
         n += 1
@@ -730,7 +730,7 @@ Comment: {comment}
                 raise MalformedDocumentError("Compact TX Signatures")
 
         transaction = cls(
-            blockstamp,
+            block_uid,
             locktime,
             issuers,
             inputs,
@@ -769,7 +769,7 @@ Comment: {comment}
         currency = Transaction.parse_field("Currency", lines[n])
         n += 1
 
-        blockstamp = BlockUID.from_str(Transaction.parse_field("Blockstamp", lines[n]))
+        block_uid = BlockUID.from_str(Transaction.parse_field("Blockstamp", lines[n]))
         n += 1
 
         locktime = Transaction.parse_field("Locktime", lines[n])
@@ -819,7 +819,7 @@ Comment: {comment}
                 n += 1
 
         transaction = cls(
-            blockstamp,
+            block_uid,
             locktime,
             issuers,
             inputs,
@@ -848,7 +848,7 @@ Currency: {1}
             self.version, self.currency
         )
 
-        doc += "Blockstamp: {0}\n".format(self.blockstamp)
+        doc += "Blockstamp: {0}\n".format(self.block_uid)
 
         doc += "Locktime: {0}\n".format(self.locktime)
 
@@ -896,7 +896,7 @@ Currency: {1}
             "1" if self.comment != "" else "0",
             self.locktime,
         )
-        doc += "{0}\n".format(self.blockstamp)
+        doc += "{0}\n".format(self.block_uid)
 
         for pubkey in self.issuers:
             doc += "{0}\n".format(pubkey)
@@ -983,7 +983,7 @@ class SimpleTransaction(Transaction):
 
     def __init__(
         self,
-        blockstamp: BlockUID,
+        block_uid: BlockUID,
         locktime: int,
         issuer: str,
         single_input: InputSource,
@@ -998,7 +998,7 @@ class SimpleTransaction(Transaction):
         """
         Init instance
 
-        :param blockstamp: BlockUID timestamp
+        :param block_uid: BlockUID instance
         :param locktime: Lock time in seconds
         :param issuer: Issuer public key
         :param single_input: InputSource instance
@@ -1011,7 +1011,7 @@ class SimpleTransaction(Transaction):
         :param currency: Currency codename (default=constants.CURRENCY_CODENAME_G1)
         """
         super().__init__(
-            blockstamp,
+            block_uid,
             locktime,
             [issuer],
             [single_input],
diff --git a/duniterpy/documents/ws2p/heads.py b/duniterpy/documents/ws2p/heads.py
index c2ec8b58..69fbab19 100644
--- a/duniterpy/documents/ws2p/heads.py
+++ b/duniterpy/documents/ws2p/heads.py
@@ -82,15 +82,15 @@ class HeadV0(Head):
     api = attr.ib(type=API)
     head = attr.ib(type=Head)
     pubkey = attr.ib(type=str)
-    blockstamp = attr.ib(type=BlockUID)
+    block_uid = attr.ib(type=BlockUID)
 
     re_inline = re.compile(
-        "^(WS2P(?:{ws2p_private})?(?:{ws2p_public})?):({head}):({pubkey}):({blockstamp})(?::)?(.*)".format(
+        "^(WS2P(?:{ws2p_private})?(?:{ws2p_public})?):({head}):({pubkey}):({block_uid})(?::)?(.*)".format(
             ws2p_private=WS2P_PRIVATE_PREFIX_REGEX,
             ws2p_public=WS2P_PUBLIC_PREFIX_REGEX,
             head=WS2P_HEAD_REGEX,
             pubkey=PUBKEY_REGEX,
-            blockstamp=BLOCK_UID_REGEX,
+            block_uid=BLOCK_UID_REGEX,
         )
     )
 
@@ -105,9 +105,9 @@ class HeadV0(Head):
             api = API.from_inline(data.group(1))
             head = Head.from_inline(data.group(2), "")
             pubkey = data.group(3)
-            blockstamp = BlockUID.from_str(data.group(4))
+            block_uid = BlockUID.from_str(data.group(4))
             offload = data.group(5)
-            return cls(head.version, signature, api, head, pubkey, blockstamp), offload
+            return cls(head.version, signature, api, head, pubkey, block_uid), offload
         except AttributeError:
             raise MalformedDocumentError("HeadV0") from AttributeError
 
@@ -173,7 +173,7 @@ class HeadV1(HeadV0):
                     v0.api,
                     v0.head,
                     v0.pubkey,
-                    v0.blockstamp,
+                    v0.block_uid,
                     ws2pid,
                     software,
                     software_version,
@@ -212,7 +212,7 @@ class HeadV2(HeadV1):
                     v1.api,
                     v1.head,
                     v1.pubkey,
-                    v1.blockstamp,
+                    v1.block_uid,
                     v1.ws2pid,
                     v1.software,
                     v1.software_version,
diff --git a/duniterpy/helpers/network.py b/duniterpy/helpers/network.py
index e268303b..e7b5bb51 100644
--- a/duniterpy/helpers/network.py
+++ b/duniterpy/helpers/network.py
@@ -24,9 +24,9 @@ from duniterpy.documents.ws2p.heads import HeadV2
 
 def get_available_nodes(client: Client) -> List[List[Dict[str, Any]]]:
     """
-    Get available nodes grouped and sorted by descending blockstamp
+    Get available nodes grouped and sorted by descending block_uid
 
-    Each entry is a list of nodes (HeadV2 instance, inline endpoint list) sharing the same blockstamp:
+    Each entry is a list of nodes (HeadV2 instance, inline endpoint list) sharing the same block_uid:
 
         [
             [{"head": HeadV2, "endpoints": [str, ...]}, ...],
@@ -57,12 +57,12 @@ def get_available_nodes(client: Client) -> List[List[Dict[str, Any]]]:
         head, _ = HeadV2.from_inline(entry["messageV2"], entry["sigV2"])
         heads.append(head)
 
-    # sort by blockstamp by descending order
-    heads = sorted(heads, key=lambda x: x.blockstamp, reverse=True)
+    # sort by block_uid by descending order
+    heads = sorted(heads, key=lambda x: x.block_uid, reverse=True)
 
-    # group heads by blockstamp
+    # group heads by block_uid
     groups = []
-    for _, group in groupby(heads, key=lambda x: x.blockstamp):
+    for _, group in groupby(heads, key=lambda x: x.block_uid):
         nodes = []
         for head in list(group):
 
diff --git a/examples/request_available_nodes.py b/examples/request_available_nodes.py
index 958d8101..b70d87a3 100644
--- a/examples/request_available_nodes.py
+++ b/examples/request_available_nodes.py
@@ -36,7 +36,7 @@ def request_available_nodes():
 
     groups = network.get_available_nodes(client)
     for group in groups:
-        block = group[0]["head"].blockstamp
+        block = group[0]["head"].block_uid
         print(f"block {block} shared by {len(group)} nodes")
 
     print("\nAvailable endpoints:")
diff --git a/examples/send_certification.py b/examples/send_certification.py
index c0143425..39089840 100644
--- a/examples/send_certification.py
+++ b/examples/send_certification.py
@@ -68,7 +68,7 @@ def get_certification_document(
     return Certification(
         pubkey_from=signing_key.pubkey,
         identity=identity,
-        timestamp=BlockUID(current_block["number"], current_block["hash"]),
+        block_uid=BlockUID(current_block["number"], current_block["hash"]),
         signing_key=signing_key,
         currency=current_block["currency"],
     )
@@ -97,7 +97,7 @@ def send_certification():
     # prompt entry
     pubkey_to = input("Enter pubkey to certify: ")
 
-    # capture current block to get version and currency and blockstamp
+    # capture current block to get version and currency and block_uid
     current_block = client(bma.blockchain.current)
 
     # create our Identity document to sign the Certification document
diff --git a/examples/send_identity.py b/examples/send_identity.py
index 3f805c13..ca161983 100644
--- a/examples/send_identity.py
+++ b/examples/send_identity.py
@@ -47,14 +47,14 @@ def get_identity_document(
     :rtype: Identity
     """
 
-    # get current block BlockStamp
-    timestamp = BlockUID(current_block["number"], current_block["hash"])
+    # get current blockUID
+    block_uid = BlockUID(current_block["number"], current_block["hash"])
 
     # create identity document
     identity = Identity(
         pubkey=key.pubkey,
         uid=uid,
-        timestamp=timestamp,
+        block_uid=block_uid,
         signing_key=key,
         currency=current_block["currency"],
     )
@@ -73,7 +73,7 @@ def send_identity():
     response = client(bma.node.summary)
     print(response)
 
-    # capture current block to get version and currency and blockstamp
+    # capture current block to get version and currency and block_uid
     current_block = client(bma.blockchain.current)
 
     # prompt entry
diff --git a/examples/send_membership.py b/examples/send_membership.py
index dfb69f83..727bda41 100644
--- a/examples/send_membership.py
+++ b/examples/send_membership.py
@@ -49,19 +49,19 @@ def get_membership_document(
     :rtype: Membership
     """
 
-    # get current block BlockStamp
-    timestamp = BlockUID(current_block["number"], current_block["hash"])
+    # get current blockUID
+    block_uid = BlockUID(current_block["number"], current_block["hash"])
 
-    # get the uid and the timestamp of the corresponding identity
+    # get the uid and the block_uid of the corresponding identity
     uid = identity["uids"][0]["uid"]
-    identity_timestamp = identity["uids"][0]["meta"]["timestamp"]
+    identity_block_uid = identity["uids"][0]["meta"]["timestamp"]
 
     # create membership document
     membership = Membership(
         issuer=key.pubkey,
-        membership_ts=timestamp,
+        membership_block_uid=block_uid,
         uid=uid,
-        identity_ts=identity_timestamp,
+        identity_block_uid=identity_block_uid,
         signing_key=key,
         currency=current_block["currency"],
         membership_type=membership_type,
@@ -81,7 +81,7 @@ def send_membership():
     response = client(bma.node.summary)
     print(response)
 
-    # capture current block to get version and currency and blockstamp
+    # capture current block to get version and currency and block_uid
     current_block = client(bma.blockchain.current)
 
     # prompt hidden user entry
diff --git a/examples/send_transaction.py b/examples/send_transaction.py
index 1ddf631b..de355317 100644
--- a/examples/send_transaction.py
+++ b/examples/send_transaction.py
@@ -90,7 +90,7 @@ def get_transaction_document(
     ]
 
     transaction = Transaction(
-        blockstamp=BlockUID(current_block["number"], current_block["hash"]),
+        block_uid=BlockUID(current_block["number"], current_block["hash"]),
         locktime=0,
         issuers=issuers,
         inputs=inputs,
@@ -128,7 +128,7 @@ def send_transaction():
     # prompt entry
     pubkey_to = input("Enter recipient pubkey: ")
 
-    # capture current block to get version and currency and blockstamp
+    # capture current block to get version and currency and block_uid
     current_block = client(bma.blockchain.current)
 
     # capture sources of account
diff --git a/tests/documents/test_block.py b/tests/documents/test_block.py
index b2639e20..46d56750 100644
--- a/tests/documents/test_block.py
+++ b/tests/documents/test_block.py
@@ -1969,7 +1969,7 @@ AywstQpC0S5iaA/YQvbz2alpP6zTYG3tjkWpxy1jgeCo028Te2V327bBZbfDGDzsjxOrF4UVmEBiGsgb
         parsed_json_block = json.loads(json_block_250004)
         block = Block.from_parsed_json(parsed_json_block)
         self.assertEqual(len(block.transactions), 8)
-        self.assertEqual(block.transactions[5].blockstamp.number, 250002)
+        self.assertEqual(block.transactions[5].block_uid.number, 250002)
         self.assertEqual(
             block.transactions[5].comment, "Merci pour la farine de chataigne"
         )
diff --git a/tests/documents/test_certification.py b/tests/documents/test_certification.py
index a4f6b40e..e32c786f 100644
--- a/tests/documents/test_certification.py
+++ b/tests/documents/test_certification.py
@@ -56,7 +56,7 @@ class TestCertification(unittest.TestCase):
             "h/H8tDIEbfA4yxMQcvfOXVDQhi1sUa9qYtPKrM59Bulv97ouwbAvAsEkC1Uyit1IOpeAV+CQQs4IaAyjE8F1Cw==",
         )
         self.assertEqual(
-            str(selfcert.timestamp), "32-DB30D958EE5CB75186972286ED3F4686B8A1C2CD"
+            str(selfcert.block_uid), "32-DB30D958EE5CB75186972286ED3F4686B8A1C2CD"
         )
         self.assertEqual(selfcert.uid, "lolcat")
 
@@ -69,7 +69,7 @@ class TestCertification(unittest.TestCase):
             "Ah55O8cvdkGS4at6AGOKUjy+wrFwAq8iKRJ5xLIb6Xdi3M8WfGOUdMjwZA6GlSkdtlMgEhQPm+r2PMebxKrCBg==",
         )
         self.assertEqual(
-            str(selfcert.timestamp), "36-1076F10A7397715D2BEE82579861999EA1F274AC"
+            str(selfcert.block_uid), "36-1076F10A7397715D2BEE82579861999EA1F274AC"
         )
         self.assertEqual(selfcert.uid, "lolmouse")
 
@@ -78,10 +78,10 @@ class TestCertification(unittest.TestCase):
         currency = "beta_brousouf"
         issuer = "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd"
         uid = "lolcat"
-        timestamp = BlockUID(32, "DB30D958EE5CB75186972286ED3F4686B8A1C2CD")
+        block_uid = BlockUID(32, "DB30D958EE5CB75186972286ED3F4686B8A1C2CD")
         signature = "J3G9oM5AKYZNLAB5Wx499w61NuUoS57JVccTShUbGpCMjCqj9yXXqNq7dyZpDWA6BxipsiaMZhujMeBfCznzyci"
 
-        selfcert = Identity(issuer, uid, timestamp, version=version, currency=currency)
+        selfcert = Identity(issuer, uid, block_uid, version=version, currency=currency)
         selfcert.signature = signature
 
         result = """Version: 2
@@ -105,8 +105,8 @@ J3G9oM5AKYZNLAB5Wx499w61NuUoS57JVccTShUbGpCMjCqj9yXXqNq7dyZpDWA6BxipsiaMZhujMeBf
             cert.pubkey_from, "8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU"
         )
         self.assertEqual(cert.pubkey_to, "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk")
-        self.assertEqual(cert.timestamp.number, 0)
-        self.assertEqual(cert.timestamp.sha_hash, EMPTY_HASH)
+        self.assertEqual(cert.block_uid.number, 0)
+        self.assertEqual(cert.block_uid.sha_hash, EMPTY_HASH)
         self.assertEqual(
             cert.signature,
             "TgmDuMxZdyutroj9jiLJA8tQp/389JIzDKuxW5+h7GIfjDu1ZbwI7HNm5rlUDhR2KreaV/QJjEaItT4Cf75rCQ==",
@@ -122,9 +122,9 @@ J3G9oM5AKYZNLAB5Wx499w61NuUoS57JVccTShUbGpCMjCqj9yXXqNq7dyZpDWA6BxipsiaMZhujMeBf
             cert.pubkey_from, "9fx25FmeBDJcikZLWxK5HuzKNbY6MaWYXoK1ajteE42Y"
         )
         self.assertEqual(cert.pubkey_to, "8Fi1VSTbjkXguwThF4v2ZxC5whK7pwG2vcGTkPUPjPGU")
-        self.assertEqual(cert.timestamp.number, 12)
+        self.assertEqual(cert.block_uid.number, 12)
         self.assertEqual(
-            cert.timestamp.sha_hash, "DB30D958EE5CB75186972286ED3F4686B8A1C2CD"
+            cert.block_uid.sha_hash, "DB30D958EE5CB75186972286ED3F4686B8A1C2CD"
         )
         self.assertEqual(
             cert.signature,
@@ -136,7 +136,7 @@ J3G9oM5AKYZNLAB5Wx499w61NuUoS57JVccTShUbGpCMjCqj9yXXqNq7dyZpDWA6BxipsiaMZhujMeBf
         currency = "beta_brousouf"
         pubkey_from = "DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV"
         pubkey_to = "HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd"
-        timestamp = BlockUID(36, "1076F10A7397715D2BEE82579861999EA1F274AC")
+        block_uid = BlockUID(36, "1076F10A7397715D2BEE82579861999EA1F274AC")
         signature = "SoKwoa8PFfCDJWZ6dNCv7XstezHcc2BbKiJgVDXv82R5zYR83nis9dShLgWJ5w48noVUHimdngzYQneNYSMV3rk"
         identity = Identity(
             pubkey_to,
@@ -148,7 +148,7 @@ J3G9oM5AKYZNLAB5Wx499w61NuUoS57JVccTShUbGpCMjCqj9yXXqNq7dyZpDWA6BxipsiaMZhujMeBf
         identity.signature = "J3G9oM5AKYZNLAB5Wx499w61NuUoS57JVccTShUbGpCMjCqj9yXXqNq7dyZpDWA6BxipsiaMZhujMeBfCznzyci"
 
         certification = Certification(
-            pubkey_from, identity, timestamp, version=version, currency=currency
+            pubkey_from, identity, block_uid, version=version, currency=currency
         )
         certification.signature = signature
 
diff --git a/tests/documents/test_membership.py b/tests/documents/test_membership.py
index 12b50e14..4203e43d 100644
--- a/tests/documents/test_membership.py
+++ b/tests/documents/test_membership.py
@@ -41,14 +41,15 @@ class TestMembership(unittest.TestCase):
         self.assertEqual(
             membership.issuer, "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk"
         )
-        self.assertEqual(membership.membership_ts.number, 0)
+        self.assertEqual(membership.membership_block_uid.number, 0)
         self.assertEqual(
-            membership.membership_ts.sha_hash,
+            membership.membership_block_uid.sha_hash,
             "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
         )
-        self.assertEqual(membership.identity_ts.number, 0)
+        self.assertEqual(membership.identity_block_uid.number, 0)
         self.assertEqual(
-            membership.identity_ts.sha_hash, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
+            membership.identity_block_uid.sha_hash,
+            "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
         )
         self.assertEqual(membership.uid, "cgeek")
         self.assertEqual(
@@ -62,14 +63,15 @@ class TestMembership(unittest.TestCase):
         self.assertEqual(
             membership.issuer, "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk"
         )
-        self.assertEqual(membership.membership_ts.number, 0)
+        self.assertEqual(membership.membership_block_uid.number, 0)
         self.assertEqual(
-            membership.membership_ts.sha_hash,
+            membership.membership_block_uid.sha_hash,
             "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
         )
-        self.assertEqual(membership.identity_ts.number, 0)
+        self.assertEqual(membership.identity_block_uid.number, 0)
         self.assertEqual(
-            membership.identity_ts.sha_hash, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
+            membership.identity_block_uid.sha_hash,
+            "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
         )
         self.assertEqual(membership.uid, "cgeek")
         self.assertEqual(
@@ -86,14 +88,15 @@ class TestMembership(unittest.TestCase):
             from_rendered_membership.issuer,
             "HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk",
         )
-        self.assertEqual(from_rendered_membership.membership_ts.number, 0)
+        self.assertEqual(from_rendered_membership.membership_block_uid.number, 0)
         self.assertEqual(
-            from_rendered_membership.membership_ts.sha_hash,
+            from_rendered_membership.membership_block_uid.sha_hash,
             "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
         )
-        self.assertEqual(membership.identity_ts.number, 0)
+        self.assertEqual(membership.identity_block_uid.number, 0)
         self.assertEqual(
-            membership.identity_ts.sha_hash, "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709"
+            membership.identity_block_uid.sha_hash,
+            "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709",
         )
         self.assertEqual(from_rendered_membership.uid, "cgeek")
         self.assertEqual(
diff --git a/tests/documents/test_peer.py b/tests/documents/test_peer.py
index 62374b34..86c9dd4a 100644
--- a/tests/documents/test_peer.py
+++ b/tests/documents/test_peer.py
@@ -49,7 +49,7 @@ class TestPeer(unittest.TestCase):
         self.assertEqual(peer.currency, "beta_brousouf")
         self.assertEqual(peer.pubkey, "HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY")
         self.assertEqual(
-            str(peer.blockUID), "8-1922C324ABC4AF7EF7656734A31F5197888DDD52"
+            str(peer.block_uid), "8-1922C324ABC4AF7EF7656734A31F5197888DDD52"
         )
         self.assertEqual(len(peer.endpoints), 4)
         self.assertIsInstance(peer.endpoints[0], BMAEndpoint)
@@ -86,7 +86,7 @@ class TestPeer(unittest.TestCase):
             from_rendered_peer.pubkey, "HsLShAtzXTVxeUtQd7yi5Z5Zh4zNvbu8sTEZ53nfKcqY"
         )
         self.assertEqual(
-            str(from_rendered_peer.blockUID),
+            str(from_rendered_peer.block_uid),
             "8-1922C324ABC4AF7EF7656734A31F5197888DDD52",
         )
         self.assertEqual(len(peer.endpoints), 4)
diff --git a/tests/documents/test_transaction.py b/tests/documents/test_transaction.py
index 4cf2ead0..2b7d04c1 100644
--- a/tests/documents/test_transaction.py
+++ b/tests/documents/test_transaction.py
@@ -301,9 +301,9 @@ class TestTransaction(unittest.TestCase):
 
         self.assertEqual(tx.version, 10)
         self.assertEqual(tx.currency, "beta_brousouf")
-        self.assertEqual(tx.blockstamp.number, 32)
+        self.assertEqual(tx.block_uid.number, 32)
         self.assertEqual(
-            tx.blockstamp.sha_hash, "DB30D958EE5CB75186972286ED3F4686B8A1C2CD"
+            tx.block_uid.sha_hash, "DB30D958EE5CB75186972286ED3F4686B8A1C2CD"
         )
         self.assertEqual(len(tx.issuers), 3)
         self.assertEqual(len(tx.inputs), 6)
@@ -465,7 +465,7 @@ class TestTransaction(unittest.TestCase):
 
     def test_transaction_document_generation(self):
         transaction = Transaction(
-            blockstamp=BlockUID(
+            block_uid=BlockUID(
                 8979, "000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC"
             ),
             locktime=0,
@@ -498,7 +498,7 @@ class TestTransaction(unittest.TestCase):
         ]
 
         transaction = Transaction(
-            blockstamp=BlockUID(
+            block_uid=BlockUID(
                 8979, "000041DF0CCA173F09B5FBA48F619D4BC934F12ADF1D0B798639EB2149C4A8CC"
             ),
             locktime=0,
diff --git a/tests/documents/test_ws2p_heads.py b/tests/documents/test_ws2p_heads.py
index 8b79ac15..57b2d2c0 100644
--- a/tests/documents/test_ws2p_heads.py
+++ b/tests/documents/test_ws2p_heads.py
@@ -35,7 +35,7 @@ class TestWS2PHeads(unittest.TestCase):
         self.assertEqual(headv0.head.version, 0)
         self.assertEqual(headv0.pubkey, "3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj")
         self.assertEqual(
-            headv0.blockstamp,
+            headv0.block_uid,
             BlockUID.from_str(
                 "54813-00000A24802B33B71A91B6E990038C145A4815A45C71E57B2F2EF393183C7E2C"
             ),
-- 
GitLab