Skip to main content
A role connects an authority to permissions on your wallet. This example gives a delegate a fixed native-currency allowance. The delegate gains spending permission without role-management permission. Use the wallet from Create a Wallet. Keep its root key in SIGNER_PRIVATE_KEY, and set ACCOUNT_ADDRESS to the returned config address. The manager role’s key signs and pays gas. Root role 0 is the default; to use another authorized manager role, select both its key and MANAGER_ROLE_ID.

Define the allowance

For example, LIMIT_WEI=100 permits a total spend of 100 wei. The maximum value is 18446744073709551615 (uint64). This is a spending cap, not a deposit: fund the wallet’s vault separately.

Add the role

The example waits for a successful transaction and reads roleId from its RoleAdded event. Use this returned ID as ROLE_ID. Read the mined event rather than predicting the ID: another role may have been created while your transaction was pending. The output also includes transactionHash. Next, read the role to inspect the authority before using the delegate key. Full examples: TypeScript, Rust, Python.