Introduction
The edeXa Signing SDK implements the eTwin authenticity-proof flow: hash locally → sign → record on-chain. This page explains each step and what data it exposes.
What leaves your machine
| Data | Where it goes |
|---|---|
| Document bytes | Nowhere. They are only read to compute the hash. |
| Document hash | Into the signature result, and onto the blockchain if you record it on-chain. |
| Private key | Nowhere. It is used locally to sign hashes and, when recording on-chain, to sign the transaction before it is sent. |
| Signature | Returned to you. You decide where to store or share it. |
Hashing
hash_document() computes a SHA-256 hash of the bytes you pass in and returns it as a 64-character hex string.
- Hashing is deterministic: the same bytes always produce the same hash, and any change to the bytes produces a different one.
- The SDK does not add a salt. Two identical documents have identical hashes, and a short or predictable document (for example a one-line status message) could be matched by someone who guesses its content and hashes it themselves.
Signing
EdexaSigner.sign() signs the raw 32-byte hash with secp256k1 ECDSA.
- The signature is 65 bytes,
r (32) ‖ s (32) ‖ v (1), returned as 130 hex characters.vis27or28(0x1b/0x1c). - Signing is deterministic: the same key and hash always produce the same signature.
- The hash is signed directly. It is not an Ethereum
personal_sign(EIP-191) or EIP-712 signature, so tools that expect those formats will recover a different address. - Only the hash is signed. The
metadata,chain_idandcontract_addressyou pass tosign()are not part of the signature.
Signer addresses
Each key has an Ethereum-style address: 0x followed by the last 20 bytes of the Keccak-256 hash of the public key. The SDK returns addresses in lowercase, and address comparisons in verify_signature() are case-insensitive.
Verification
verify_signature() recovers the address that produced a signature over a hash and compares it with the address you expect. It needs only the hash, the signature and the address, and works fully offline. It returns False when the signature belongs to a different key or the hash has changed.
On-chain signing
EdexaChain.sign_document() records a document hash on the blockchain. It sends a transaction that calls the eTwin contract function:
function signDocument(bytes32 documentHash) external;- Only the 32-byte hash is written to the chain.
- The signature from
EdexaSigner.sign()is not sent. On-chain, the proof is that the account sending the transaction calledsignDocumentwith that hash. - The key you pass to
sign_document()signs the transaction and pays the gas, so its address needs a balance on that chain. - The call waits until the transaction is mined and returns its receipt.
Current scope
Version 0.1.0 covers single-document hashing, signing, verification and on-chain signing. It does not include:
- Salting of document hashes
- Merkle trees or batch submission. Each
sign_document()call records one hash in one transaction. - Admin or contract-management functions. The SDK only calls
signDocument(bytes32). - On-chain lookup. There is no function to check whether a hash has already been recorded on-chain.
- An async API.
sign_document()blocks until the transaction is mined.