Configuration
The SDK has no configuration file, global settings object or environment variables of its own. Every setting is passed as an argument to the class or method that uses it.
Network settings
Recording hashes on-chain needs three values, passed to EdexaChain:
| Argument | Description | Sepolia value used in the SDK’s examples |
|---|---|---|
rpc_url | JSON-RPC endpoint of the EVM chain | https://ethereum-sepolia-rpc.publicnode.com |
contract_address | Address of the eTwin contract that exposes signDocument(bytes32) | 0x56Bf299f4316483Ee0128b1a8F0473ADD219D475 |
chain_id | EIP-155 chain ID | 11155111 (Sepolia) |
import edexa_signing as sdk
chain = sdk.EdexaChain(
"https://ethereum-sepolia-rpc.publicnode.com",
"0x56Bf299f4316483Ee0128b1a8F0473ADD219D475",
11155111,
)Using environment variables
The SDK repository’s .env.example and example scripts use the following variable names. The SDK does not read them itself, so load them in your own code:
| Variable | Maps to |
|---|---|
EDEXA_RPC_URL | rpc_url |
EDEXA_CONTRACT_ADDRESS | contract_address |
EDEXA_CHAIN_ID | chain_id |
import os
import edexa_signing as sdk
chain = sdk.EdexaChain(
os.environ.get("EDEXA_RPC_URL", "https://ethereum-sepolia-rpc.publicnode.com"),
os.environ.get("EDEXA_CONTRACT_ADDRESS", "0x56Bf299f4316483Ee0128b1a8F0473ADD219D475"),
int(os.environ.get("EDEXA_CHAIN_ID", "11155111")),
)Signing keys
A signer is a secp256k1 key pair. Create one in either of two ways:
import edexa_signing as sdk
# Generate a new random key
signer = sdk.EdexaSigner.generate()
print(signer.address()) # 0x... (42 characters)
print(signer.private_key()) # 0x... (66 characters) - store this securely
# Load an existing 32-byte key, as hex with or without the 0x prefix
signer = sdk.EdexaSigner("0x<64 hex characters>")- The private key is passed as an argument. The SDK does not read it from the environment or from a file.
- Keep private keys out of source control and logs. Anyone with the key can sign as your address and spend its funds.
- To record hashes on-chain, the key you pass to
sign_document()must hold enough of the chain’s native currency to pay for gas. On Sepolia, that means test ETH.
Values passed to sign()
EdexaSigner.sign() requires chain_id and contract_address, and accepts optional metadata_json. In version 0.1.0 these values are not part of the signature: only the document hash is signed. chain_id and contract_address are also not included in the returned result, so record them yourself if you need them later.
Because metadata is not signed, anyone can change it without invalidating the signature. Don’t rely on it as proof of anything.