Skip to content

Commit

Permalink
Merge pull request #372 from aeternity/PT-167060729-allow_signing_of_…
Browse files Browse the repository at this point in the history
…just_tx_hash

Update protocol with possibility to sign just the Tx Hash
  • Loading branch information
lucafavatella authored Aug 14, 2019
2 parents 896c2f9 + 1bfa61f commit 65e1793
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions consensus/consensus.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,28 @@ account to smart contracts.

### Transaction signature

We sign serialized transaction prefixed with the id of the network.
See [serialization](../serializations.md#binary-serialization) definition for details.
We sign serialized transaction (or the hash of the serialized transaction -
from Lima hard-fork) prefixed with the id of the network. See
[serialization](../serializations.md#binary-serialization) definition for
details.

```
NetworkId :: binary()
SerializedObject :: binary()
Signature :: binary()
Signature = sign(NetworkId + SerializedObject)
or Signature = sign(NetworkId + Blake2b(SerializedObject))
```

Prefix defaults to ``ae_mainnet`` (``binary()``) and it is configurable via node config.
The prefix is not part of a serialized transaction. We add it only for signature.
Consider changing the id in case of forking the blockchain network,
in order to lower danger of replay attacks.

**Note:** Post Lima hard-fork it is allowed to sign either the full serialized object, or
the hash of the serialized object; prefixed with the network id in either case.

### Proof of Work

[Cuckoo Cycle](https://github.com/tromp/cuckoo) is the algorithm used for proof of work.
Expand Down
2 changes: 1 addition & 1 deletion serializations.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ for:

* Hashing (e.g., block hash)
* Insertion in the Merkle Patricia Tree (e.g., state trees, transaction trees).
* Signing transactions (i.e., the serialized form is signed).
* Signing transactions (i.e., the (hash of the) serialized form is signed).

Other formats may be used for communication between nodes or for the
user API.
Expand Down

0 comments on commit 65e1793

Please sign in to comment.