Skip to main content
In this guide you add a second, non-root user to your organization and give it exactly one permission: sign Ethereum transactions to one allowlisted address. Everything runs from a script with released packages. Before you start:
1

Create an API-only user

Generate a keypair for the new user and register its public key. The user starts with no permissions.
2

Create the policy

Allow only this user, and only transactions whose recipient is <ALLOWED_ADDRESS> (lowercase).
condition is required. A missing, empty, or whitespace-only condition is rejected with HTTP 400; use "true" to match every activity.
3

Test the policy

Sign two transactions as the new user: one to the allowlisted address and one to any other address.
The transaction to the allowlisted address is ACTIVITY_STATUS_COMPLETED. The other one is ACTIVITY_STATUS_FAILED, because no policy allows it. You’ve set your first policy.
4

Clean up

Delete the policy with the root key. deletePolicies takes a list of IDs; deletePolicy takes one.
A policy ID that does not exist in the organization returns HTTP 404. Use getPolicies to list the current IDs.

Using plain HTTP

Every call above is a stamped POST. For example, the policy in step 2 as a raw request:
where $BODY is:
and $STAMP is your root API key’s signature over the exact bytes of $BODY; see Stamps. The other steps use create_users (ACTIVITY_TYPE_CREATE_USERS_V3), sign_transaction (ACTIVITY_TYPE_SIGN_TRANSACTION_V2) and delete_policies (ACTIVITY_TYPE_DELETE_POLICIES).

Next