Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

Turnkey Overview

An application that transfers 0.01 ETH from a company wallet receives a request from an operator, selects an eligible source account, and checks the recipient and amount. Signing the approved details with the asset's private key produces a transaction that can be broadcast to the network. Integrating transfers into an application means connecting the logic that selects a recipient with the authorization and key usage required to send funds to that recipient.

Turnkey is a wallet infrastructure platform that authenticates application requests, evaluates them against configured authorization rules, and uses asset keys in an isolated execution environment. The application determines the transfer details and proves them using the requester's credentials. Because Turnkey verifies both the requester and the operation's conditions before signing, the application can integrate transfers without copying the asset's private key to its server.

The same division of responsibilities applies to applications used by company operators and applications in which users authenticate with passkeys on their devices. For autonomous agents, the logic that decides what to execute can likewise be separated from the logic that determines whether an asset key may be used. The users and wallets registered in an organization, together with its authorization policies, determine whose requests can be associated with which assets.

The original diagrams in this article are retained and contain Japanese labels.

Division of responsibilities between the application and the signing infrastructure

Wallets and Permissions

To transfer 0.01 ETH, first prepare the source address and its corresponding key. A Turnkey wallet uses a hierarchical structure that derives multiple keys from a single secret. The original secret used for key derivation is called a seed. Each account records the settings used to derive its key and address.

For example, an Ethereum source account can be created with the following settings. The curve determines how the key is computed, while the derivation path selects a key from the shared seed.

Setting Value What it determines for this account
Curve CURVE_SECP256K1 The type of key used for Ethereum signatures
Derivation scheme PATH_FORMAT_BIP32 How keys are derived through the hierarchy
Derivation path m/44'/60'/0'/0/0 The position of the key derived from the seed
Address format ADDRESS_FORMAT_ETHEREUM The format of the address generated from the derived key

The address obtained from this account serves as the source of the company's 0.01 ETH transfer. Changing the final component of the path derives a different key and address from the same wallet. For another chain, choose the curve and address format appropriate to that chain.

A wallet ID identifies a collection of accounts sharing a seed. The specific signing account can be selected by its address. Separate accounts still share the same seed, so create separate wallets when independence from the original secret is required.

Operators who use the assets are registered as users independently of the accounts. Users are associated with authentication public keys or passkeys, while policies record the conditions under which they may use company accounts. Separating the requesting user from the signing account allows different operations to be authorized for different operators using the same assets.

An organization is the administrative boundary that groups users, wallets, and policies. An application that separates assets and permissions by customer can create sub-organizations for Customer A and Customer B under a parent organization. Each sub-organization has its own users and policies, so its credentials establish which customer's signing request is being made.

Relationship between requesters and derived signing accounts within the same organization

A parent organization's read access and consolidated billing are distinct from the authority to operate a sub-organization's assets. To request a signature from a sub-organization, use credentials recognized by that sub-organization. Simply specifying its ID while authenticating with the parent organization's key does not grant authority to sign for the child's assets.

Authentication Keys and Signing Keys

When an operator's server requests a transfer, it uses an authentication key pair to submit requests. The public key is registered to the operator's user in the organization, and the server submitting the requests retains the corresponding private key. The asset signing key resides in the wallet; the server's authentication key is used to prove to Turnkey who requested what.

The server includes the signing target and the organization in the request body. The values bound to the request serve different purposes.

Value Role in the request
Operation type Specifies the requested operation, such as signing or wallet creation
organizationId Selects the organization against which credentials and policies are checked
timestampMs Includes the time the request was created in the signed data
Operation parameters Specifies the operation's inputs, such as the signing account and the data to sign

The server signs the entire body with its authentication key to produce a Stamp, which serves as proof of the request. When using an API authentication key, the public key, signature, and signature scheme are sent in the X-Stamp header. Turnkey identifies the user from the public key registered in the target organization and verifies the signature over the body with that key.

If an intermediary server changes only the amount, the original Stamp will no longer pass signature verification. The request timestamp is covered by the same signature, so replaying an old request must also pass the timestamp check. Knowing an operator's public key is not sufficient to approve a different body on that operator's behalf.

Applications with a user interface can also use passkeys or one-time codes for authentication. With a passkey, a value derived from the request body is bound to the challenge signed by the authenticator. WebAuthn is the mechanism that invokes the authenticator from the browser; the resulting proof can be used to verify the user's request.

Authentication using one-time email or SMS codes, or OAuth login with an external account, likewise connects identity verification to proof of the request. A key pair is generated on the client, and its public key is bound to the identity verification result. For example, a one-time code verification token includes the verified contact information and the client's public key.

The client signs the request body with the private key corresponding to that public key. The header also contains proof of the binding between the identity and the public key, allowing the identity verification result to be associated with the actual approved request body. Even after a user has successfully logged in, asset usage is evaluated separately against policies.

SDKs are development libraries for constructing calls from an application. Client SDKs assist with login, session management, and Stamp generation. Server SDKs can construct requests using API authentication keys and perform administrative operations. Both assist with authentication on the requester's side; asset signing is performed by Turnkey's isolated processes.

Difference between proving the request body and signing the asset transaction

Turnkey verifies the signature produced by the authentication key. The subsequent signature produced by the asset key is used to verify the source address and transaction contents. Because the signed data and the party verifying it are different, holding the request authentication key does not give the application access to the asset's private key.

Authorization of Signing Requests

Successful authentication identifies the operator who submitted the request. Policies stored in the organization determine whether that user may use the company account. Separating authentication from authorization makes it possible to restrict recipients and amounts even for registered operators.

A policy uses separate expressions for the people who approve requests and the operations to which it applies. The same policy specifies whether matching requests are allowed or denied.

Field What it evaluates
consensus Conditions for the users approving the request
condition Conditions for the operation type and signing target
effect Whether to allow or deny the request when the conditions are met

For example, allow an operator to transfer no more than 0.01 ETH from the company wallet to a designated recipient. Specify the operator in the approver condition, and bind the target wallet and recipient to the operation condition. Adding conditions for the chain, amount, and empty calldata restricts the rule to simple ETH transfers.

The amount condition can be expressed as eth.tx.value <= 10000000000000000. The amount is denominated in wei, the smallest unit of ETH, so 0.01 ETH is compared as the integer 10000000000000000. The condition for Ethereum mainnet is eth.tx.chain_id == 1.

A transfer of 0.01 ETH to the designated recipient satisfies the amount limit and chain condition. A different recipient or a transfer of 0.02 ETH will not pass the same allow rule. Contract calls and token transfers also have different inputs from an ETH transfer with empty calldata, so define separate conditions for these operations.

The recipient and amount used in the evaluation are extracted by parsing the unsigned transaction that will be signed. The isolated process performing this parsing is the Parser, which signs the extracted metadata with its own Quorum Key. A Quorum Key is an infrastructure-side key used to attest to the output of an isolated process.

The Policy Engine, which evaluates request authentication and authorization, has the Parser's Quorum public key embedded in it. It verifies the metadata signature with that public key before passing the recipient and amount to the eth.tx conditions. If an external coordinator changes 0.02 ETH to 0.01 ETH, the signature will no longer match. This prevents a transfer from being authorized as a small payment based solely on the application's description.

Binding parsed transaction bytes and approvers to the same request

In normal policy evaluation, explicit denial takes precedence over allowance, and a request is also denied if no allow rule matches. If both the operator and a reviewer are designated as approvers, submission by the operator alone is insufficient; the reviewer must also approve. Authorization for signing arbitrary raw data is also distinguished from authorization that applies conditions to a parsed transaction.

Condition expressions use fields and operators supported by Turnkey's policy language. When combining && and ||, use parentheses to make the grouping explicit. The language design draws inspiration from CEL, a language for evaluating conditional expressions. Consult Turnkey's language documentation for the supported syntax and evaluation rules.

Normal Operations and Root Authority

Immediately after an organization is created, there are no policies authorizing normal users' operations. For initial configuration or recovery from overly restrictive policies, designate approvers who can act without relying on those policies. This highest-level set of users and its required approval threshold is the root quorum.

For example, if three users are registered as root users and the threshold is two, requests approved by any two of them can be executed. Requests reaching the threshold bypass normal policy restrictions, so configuration can be corrected regardless of ordinary deny conditions. Approval from only one of the three users, however, does not activate this bypass.

Normal policy and root quorum authorization paths

Delegate routine 0.01 ETH transfers to an operator registered as a normal user, and have the approvers responsible for configuration and recovery retain the root credentials. This preserves separate recovery authority even if the authentication key used for transfers is rotated. If an agent is the only root user and the threshold is one, its own request is sufficient to bypass policies.

Adding deny policies to that configuration does not impose the same restrictions as applying those conditions to a normal user. The root quorum configuration determines which approvers can operate the organization beyond the normal transfer conditions and how many approvals are required.

Signing Execution

An authorized 0.01 ETH request ultimately reaches the signing process that uses the asset key. The process checks the details submitted by the operator against the authorization decision for those details. While an authorized request is being routed to the signing process, mechanisms also check whether organization user data or evaluation results have been altered.

In Turnkey, the Policy Engine, which evaluates authentication and authorization, and the Signer, which generates keys and signs, run as separate isolated processes. A TEE is an execution environment isolated from the general-purpose host, where key decryption and critical verification take place. A coordinator outside the isolated processes carries requests and verification proofs between them.

The database storing organization data is also outside the isolated environment. Because organization data includes user credentials and policies, its integrity is verified before it is used for authorization. The Notarizer is the process that signs organization data and verifies updates to it.

The Notarizer attests to the contents of organization data together with a timestamp. The receiving isolated process checks the attestation and its freshness before using the data. For example, bringing in stale organization data that contains a deleted operator's authentication key does not allow an old attestation to be used indefinitely.

After receiving this organization data and the request accompanied by a Stamp, the Policy Engine authenticates the user and evaluates the operation conditions. The decision is also bound to information identifying the request to which it applies. This signed decision is called a Ruling.

The contents of the organization data used in the decision are checked using a hash. This value is a digest; if the organization data changes, the value being checked changes as well.

Data bound to the Ruling What the signing process can verify
Organization ID and data digest Which organization's data, and which contents, were used in the decision
Allow or deny decision Whether the operation may be executed
Operation type and inputs Which request was authorized
Timestamp When the decision was made

These bindings allow the signing process to verify that the organization data it receives matches the data used to make the authorization decision. The request details are also bound to the same Ruling, preventing authorization for a 0.01 ETH transfer from being reused for a 0.02 ETH request.

The Signer verifies the signature on the received Ruling and the attestation attached to the organization data. It selects the account corresponding to the verified request, decrypts its asset key inside the isolated environment, and signs. Wallet seeds and asset keys are encrypted when generated and returned to organization data, so external storage does not need to retain plaintext keys.

Two verifiable proofs required to reach the key usage process

An external coordinator returning only the string "allowed" cannot pass proof verification. Each isolated process holds the public keys needed to verify results signed by other processes. The coordinator transfers results between them; the isolated processes do not communicate directly.

The code running inside the isolated environment is also verified at startup. Remote attestation uses signed evidence of measurements of the execution environment to verify that the expected code has started. During Turnkey's startup procedure, after this verification, service keys are reconstructed inside the isolated environment from key shares supplied by multiple holders.

Each isolated process's Quorum Key is an infrastructure-side key used to attest to its outputs or protect keys. Its role differs both from that of asset transaction signing keys and from the root quorum, which specifies the number of root approvals required within an organization. Signing combines key protection with verification of the request for which the key is being used.

Signing and Broadcasting Flow

When transferring 0.01 ETH from the company's source account to the designated recipient, the application constructs an unsigned transaction. In addition to the recipient and amount, it includes the target chain, a nonce indicating the source account's transaction sequence, and gas parameters. For a simple ETH transfer, set the value to 10000000000000000 wei and use empty calldata.

For an operation that requests only a signature from Turnkey, the application supplies the serialized transaction. Serialization converts the fields into an ordered representation and format that the signing process can accept. The main inputs and result of the signing request are as follows.

Field Input or result
signWith Address of the signing account
unsignedTransaction Serialized unsigned transaction
type TRANSACTION_TYPE_ETHEREUM
signedTransaction Signed transaction returned after the operation completes

After the operator authenticates and sends this body, Turnkey verifies the authentication and the recipient and amount conditions. The Signer verifies the authorization decision and organization data attestation, signs, and the application receives the resulting signedTransaction. The application submits it to an RPC endpoint, the network interface for broadcasting transactions and querying their status.

Receiving the signature does not mean the transaction has been broadcast; that step remains. If transaction construction and broadcasting are also delegated to Turnkey, the application can use ethSendTransaction. The following request inputs specify a single transfer of 0.01 ETH with gas paid by the source account.

json
{
  "from": "<送付元アカウントのアドレス>",
  "caip2": "eip155:1",
  "sponsor": false,
  "calls": [
    {
      "to": "<許可した受取先のアドレス>",
      "value": "10000000000000000",
      "data": "0x"
    }
  ]
}

calls is an array of calls to execute; this request contains a single ETH transfer. value is the transfer amount in wei, and data set to 0x denotes empty calldata. The inputs that determine how the transaction is sent are as follows.

Field How it is used when sending
from Source account whose asset key is used for signing
caip2 Ethereum mainnet, identified by eip155:1
sponsor If false, the source account pays gas
calls[0].to Recipient of the ETH

For this request, Turnkey's transaction sending functionality obtains or estimates the omitted nonce and gas parameters. The amount in calls is the amount of ETH itself being transferred, distinct from token transfer amounts or the total payment including gas. Because its inputs and operation type differ from a signing-only request, the authorizing policy must correspond to the conditions available for this sending operation.

Turnkey records operations such as signing and broadcasting as an Activity, allowing status and results to be tracked after acceptance. The V2 sending operation returns a sendTransactionStatusId for tracking the sending status. The application passes that value and organizationId to getSendTransactionStatus to retrieve the sending progress.

In the response, txStatus indicates the sending status, and the Ethereum transaction hash is obtained from eth.txHash. If sending or confirmation fails, txError can be used to investigate the cause. Once the application has confirmed completion of the Activity, it uses the returned result to verify that the transfer itself succeeded.

Separating Activity completion from the transaction result

Once the transaction hash is known, query the RPC endpoint for the same network using eth_getTransactionReceipt. The returned receipt shows the execution result within a block: a status of 0x1 indicates success, while 0x0 indicates failure. The application's display of the 0.01 ETH transfer is updated after checking this result.

If the receipt is null and has not yet been found, continue querying the same hash rather than treating it as a failure. Distinguish successful execution within a block from the finality conditions required by the business. Mapping the application's request ID to the Activity ID, the sending status ID, and the transaction hash allows the result to be tracked as a single transfer.

Pending Approvals and Retries

Under a policy requiring a reviewer's approval, a request submitted by an operator may not be signed immediately. Read the Activity response to distinguish insufficient approvals from ongoing processing. The application handles the main statuses as follows.

Status Application behavior
ACTIVITY_STATUS_CONSENSUS_NEEDED Collect reviewer approvals for the same operation
ACTIVITY_STATUS_PENDING Wait for the operation result
ACTIVITY_STATUS_COMPLETED Use the result returned by the operation
ACTIVITY_STATUS_FAILED Investigate the reason for failure

Approval votes are valid for 24 hours, so expired votes must be submitted again. This is the validity period of an approval vote; it does not mean that the Activity record disappears after 24 hours. Even after a sending operation completes, track the transfer result using the sending status ID it returns.

If the connection drops immediately after sending a 0.01 ETH request, the operation may already have been accepted even though the application did not receive a response. If the Activity ID is known, use it to query the accepted operation. If the sending status ID is known, check the sending result using that same ID.

If the fingerprint calculated from the request body is identical, resubmission returns the same Activity. It is therefore possible to resubmit the original body unchanged while its timestamp remains valid. Rebuilding the body with an updated timestamp changes the fingerprint and creates a different operation, so check the outcome of the previous request before deciding to recreate it.

Request submission timestamps are validated within a window from one hour in the past to five minutes in the future. Even if the original body falls outside this window and can no longer be resubmitted, an accepted Activity can still be queried by ID. Separating the mechanism that limits acceptance of old bodies from the mechanism that tracks accepted operations accommodates long approval waits.

Distributing processing across multiple servers does not increase the number of requests allowed by an organization's rate limits. In addition to a shared allocation across the parent and its children, limits also apply per sub-organization and operation. Even when sending requests and status queries are handled by separate servers, check which limits they share.

Sequence for querying an existing operation when its response is unknown

If a 429 response indicates excessive requests, start with a short delay, increase the interval exponentially, and introduce jitter. Check how far the original request has progressed while avoiding simultaneous retries from multiple servers. There are separate limits on the number of registered users and wallets, so plan both the division into customer sub-organizations and the resource count within each organization.

Wallet Operations and Recovery

When users move a wallet to another environment, determine which secret data needs to be moved. Exporting the entire wallet seed allows multiple accounts to be restored from that seed. The scope of transferable keys differs from that of exporting the private key of one account.

The device receiving the secret data generates a new encryption key pair. Its public key and the target wallet ID are included in the export request, which undergoes authentication and authorization like any other request. The isolated process encrypts the secret data being exported for the recipient's public key and returns it as ciphertext.

The receiving device decrypts this data with the corresponding private key. Users can move their secret data into their own environment without passing plaintext asset keys through an intermediate application server. Because the decrypted seed or key must be protected at the destination, the choice of device on which it is decrypted is part of the export design.

Encrypted export and retention of existing authority

The original wallet remains in Turnkey after an export completes. Its registered credentials are not automatically revoked either, so protect the exported key and disable old credentials as separate steps. Exporting a key is not equivalent to removing the original operating authority.

Recovery from an infrastructure outage is also distinct from recovery when a user loses login credentials. Turnkey stores encrypted organization data across multiple regions and maintains key shares and backups for its service-side Quorum Key. If a user loses credentials, however, the question is whether the user's configuration can be recovered through remaining authentication methods or root approvals.

Infrastructure backups do not automatically replace a user's approvers. Before all credentials and recovery methods are lost, define in the organization configuration who can update credentials and which authentication methods they can use. Retaining both backups of asset keys and people who can authorize their use preserves the conditions needed to resume operations.

Configurations by Use Case

In a consumer-facing application, map the logged-in person to the sub-organization containing that person's wallet. Using passkeys or one-time codes through the client SDK allows users to operate from the application without necessarily connecting a browser extension every time. Who can perform recovery depends on who is included as root users of the sub-organization; merely creating a sub-organization does not make every configuration self-custodial.

For company operations, separate routine transfer operators from approvers responsible for configuration changes and recovery. The server responsible for sending 0.01 ETH submits requests with an API authentication key registered to a normal user. Checking the recipient, amount, and target wallet against policies allows business transfers to be executed without copying the asset's private key to each server.

Associate read access with processes that only check incoming payments, and assign restricted signing operations to processes that make withdrawals. An agent can also be configured to submit conditional requests as a normal user. For example, separate the capability that searches for potential recipients from the capability that transfers company assets, and check transfer requests against registered recipient and amount conditions.

Differences in delegation boundaries by use case

In this configuration, the application checks the operation selected by the agent against the business request, and Turnkey checks the signing target of the submitted request against policy. Approvers retain the root recovery credentials outside the automated process. Consumer applications, company operations, and autonomous operations differ in who is connected to the same signing infrastructure and how much authority is delegated to them.

Conclusion

In Turnkey, accounts derived from a seed are used in conjunction with requests from authenticated users and policies. A Stamp proves the request details, and the Signer signs using the asset key after verifying the signatures on organization data and the authorization decision. The transfer can be verified as a single request by linking Activity completion to the sending status and execution result within a block.

The official documentation provides details on authentication, policies, and wallet operations.

The official technical whitepaper explains the relationship between isolated processes and signed data.

The Ethereum execution APIs define the inputs and results for transaction receipts.