from notareum import Notareum
from eth_utils import keccak
ntm = Notareum(provider=w3, contracts=addresses, account=acct)
# 1. Create and sign a .nota file
nota = (
ntm.nota
.create(
type="address",
chain_name="ethereum",
chain_id=1,
identifier=acct.address,
alias="alice.eth",
)
.validate()
.sign(acct.key.hex())
)
# 2. Compute proof hash
proof_hash = "0x" + keccak(nota.serialize().encode()).hex()
# 3. Register on-chain
tx_hash = ntm.registry.register_resource(
resource_type=0,
chain_id=1,
identifier=acct.address,
proof_hash=proof_hash,
alias="alice.eth",
)
print("Registered:", tx_hash)
# 4. Later, anyone resolves the alias
resource_id = ntm.registry.resolve_alias("alice.eth")
info = ntm.registry.get_resource(resource_id)
print(info.owner, info.verification_level)