IMPORTANT NOTE:
This article will be deprecated by February 28th, 2025. For all API Co-signer documentation, visit this overview article, which also links to updated Co-signer content in the Developer Portal.
Note:
The AWS-compatible API Co-Signer is a limited-release, opt-in feature. Unlike deploying the API Co-Signer on Azure, IBM Cloud, or on-premises, Fireblocks selectively approves customers for an AWS-compatible API Co-Signer after signing an agreement with the customer. Contact Fireblocks Support to discuss using an API Co-Signer with an AWS server.
AWS Nitro systems are now the recommended AWS service for deploying Fireblocks API Co-signers.
Overview
The AWS-compatible API Co-Signer automates transaction signing, wallet approvals, and other approvals initiated via the API. AWS EC2 instances with Nitro allow the same functionality with higher security and are now the recommended AWS service for deploying Fireblocks API Co-signers.
The AWS-compatible API Co-Signer utilizes the Customer Managed Key (CMK) within the AWS KMS service to encrypt the secrets.key file. The secrets.key file is used to encrypt the API Co-Signer’s secrets database which stores the following data:
- The set of keys required for approving transactions according to Transaction Authorization Policy (TAP) rules and various administrative configurations
- Your MPC key share used to sign transactions.
Each API Co-Signer can be optionally configured to work with a unique API Co-Signer Callback Handler, an HTTPS server that can approve or reject transaction signing and configuration change requests based on custom logic implemented by the customer.
API Co-Signer transaction flow
The process for generating and signing a Fireblocks transaction using the Fireblocks REST API service and the API Co-Signer is as follows:
- An API transaction request is made to the Fireblocks REST API service. A new transaction is submitted via this API endpoint; the transaction is generated on the Fireblocks backend.
- The transaction passes through your transaction authorization policy and, if approved, continues to the next step.
- The transaction is sent to all Co-Signers for signing.
- The AWS Co-Signer receives a request to sign the transaction.
- If there is no callback handler setup, the transaction continues to step 7.
- If the callback handler is set up, the API Co-Signer sends a secure approval request to the callback handler.
- The callback handler responds, either approving or rejecting the transaction.
- Upon approval, the AWS Co-Signer engages with the Co-Signers on Fireblocks to start a mutual signing process for the transaction.
API Co-Signer requirements
To set up an API Co-Signer, you must first hold an API key with signing permissions. Please follow these instructions to set up your API key.
The API Co-Signer can be provisioned together with the Callback Handler. The Callback Handler processes POST requests and responds with an approval or rejection response.
Note
Beginning with API Co-Signer version 1.1.7 image 3.5.0, the Callback Handler can return the new RETRY action. Learn more here.
For more details on response requests and structure, learn more about API Signer Callback in the developer documentation.
AWS and API Co-Signer setup
Follow the steps below to configure your AWS Key and set up your API co-signing software.
Step 1: Create CMK using AWS Key Management Service (KMS)
AWS KMS helps you centrally manage and securely store your keys.
- Open the KMS console and select Create a key.
- Under Configure key, select the following options:
- Key type: Symmetric
- Key Usage: Encrypt and decrypt
- Key Material Origin: KMS
- Regionality: Single-Region key or Multi-Region key (use Multi-Region if the EC2 instance is located in a different region)
- Select Next.
- Alias: Set a display name for the key
- Description & Tags: Optional
- Select Next.
- Key administrators: Choose the role that you would like, or leave this section empty.
- Select Next.
- Key usage permissions: This can remain empty.
- Select Next.
- Review and Confirm.
- Select the Key ID and then copy the Key ARN for later usage:
Step 2: Create an IAM policy
You manage access in AWS by creating policies and attaching them to IAM identities (users, groups of users, or roles) or AWS resources. A policy is an object in AWS that defines an identity or resource's permissions. AWS evaluates these policies when an IAM principal (user or role) makes a request. Permissions in the policies determine whether the request is allowed or denied.
- Open the Identity and Access Management (IAM) console.
- On the left side menu, select Access Management > Policies.
- Select Create Policy.
- Switch to "JSON" view and paste the following JSON file into the editor. Make sure to replace the Resource value of the Statement array with your CMK ARN from Step 1: Create CMK using AWS Key Management Server.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "kms:Decrypt", "Action": "kms:Encrypt", "Resource":"<YOUR_CMK_ARN_HERE>" } ] }
- Select Next: Tags.
- Tags: Optional
- Select Next: Review.
- Review Policy: Enter a Name and select Create Policy.
Step 3: Create an IAM role
You can use IAM roles to delegate access to your AWS resources. With IAM roles, you can establish trust relationships between your trusting account and other AWS trusted accounts.
- The trusting account owns the resource that requires access.
- The trusted account contains the users who need access to the resource.
Please note that for the instance metadata version, use V1 and V2.
- Open the Identity and Access Management (IAM) console.
- On the left side menu, select Access Management.
- Select Roles.
- Select Create Role.
- Type of trusted entity: AWS Service
- Use Case: EC2
- Select Next: Permissions.
-
Attach Permissions Policy: Search for the policy created in Step 2: Create an IAM policy and enable the checkbox.
- Select Next: Tags.
- Tags: Optional
- Select Next: Review.
- Review: Enter a Name and select Create Role.
Step 4: Create an EC2 instance
- Open the EC2 Dashboard.
- Select Launch Instance.
-
Choose an Amazon Machine Image (AMI): Search for "Ubuntu Server 20.04" and select Select.
-
Choose an Instance Type: c5.large (2 vCPUs and 4GiB of Memory)
- Select Next: Configure Instance Details.
- IAM role: Select the IAM Role created in Step 3: Create an IAM role.
- Select Review and Launch.
- Review Instance Launch: Review and select Launch.
- Make sure the machine meets the following requirements:
- No inbound connections
- Outbound - only port 443
- The installation phase requires Docker registry, auth port 443 and 5000 for transport.
- Controlling network access to your instances is highly recommended. For example, configure your VPC and security groups appropriately. For more information, see the AWS documentation for controlling network traffic.
- Securely manage the credentials used to connect to your instances.
Step 5: API Co-Signer software installation
On the API Co-Signer machine:
- Enter root mode:
sudo - i
- Use the steps below to copy a link to the API Co-Signer script file from your Fireblocks Console. If you have any issues with these steps, please contact Fireblocks Support.
-
- Go to Settings > General.
- Under Download co-signer script select the Copy icon to copy the AWS KMS script file's URL to your clipboard.
-
- Enter the command:
curl -o cosigner "<<Download Link>>"
- Change the script's permissions to be executable:
chmod +x cosigner
- If you plan to set up an API Co-Signer Callback Handler place either the TLS certificate of the callback handler in a file named certificate.pem or a copy of the public key under the same folder as the CLI script. Learn more about configuring an API Co-Signer with a callback handler.
- Optionally enter the Callback URL. This is the HTTPS server base URL of the API Co-Signer Callback Handler.
Please enter callback URL (if using callback URL, else empty)
- The script will ask to select an authentication method:
Please select one of the callback authentication options: (1)-PUBLIC KEY (2)-certificate
- (Recommended method) If you choose PUBLIC KEY (more information), paste your public key and press return:
Please paste your callback public key
Note
This authentication method is supported for API Co-Signer version 1.1.1 and greater.
- If you choose a certificate (more information), the script can either fetch the certificate from the Callback Handler URL, or you can paste the certificate.
Would you like to try to fetch the certificate for <URL> from the web server(y/n)?
- If you enter "n" to choose no, you will be requested to paste your certificate:
Need certificate for domain <URL domain>, please paste your certificate
- If you enter "n" to choose no, you will be requested to paste your certificate:
- (Recommended method) If you choose PUBLIC KEY (more information), paste your public key and press return:
- Optionally enter the Callback URL. This is the HTTPS server base URL of the API Co-Signer Callback Handler.
- Run the API Co-Signer setup:
./cosigner setup
- The CLI script will request you to enter the following inputs:
- KMS ARN: The CMK ARN created in Step 1: Create CMK using AWS Key Management Server.
-
Pairing Token: This token can be retrieved from the Fireblocks Console admin page accordingly:
- As an Admin, log in to your Fireblocks Console and navigate to Settings > Users.
- Select the Pending Activation user status.
- Select Copy Pairing Token from the context menu. This token is only available for API users assigned a Signer or Admin role that are not paired with a signing device. The pairing token is valid for 1 hour.
- [Optional] Callback Handler URL: The HTTPS server base URL where the API Co-Signer Callback Handler is or will be available. (See Callback Handler setup for more details.) If you don't have the callback handler URL available at this stage, you can provide it at a later stage as a configuration update.
- Start the API Co-Signer:
./cosigner start
- If you are running the API Co-Signer for the first time, the workspace owner must approve a new MPC key share request from the Fireblocks mobile app, similar to approving any other user with signing privileges.
If you do not plan on using a callback handler, your API Co-Signer should now be available for use.
To configure a callback handler with your API Co-Signer, follow the steps in the API Co-Signer setup article for non-AWS servers, keeping in mind you will be prompted to provide a KMS ARN, the CMK ARN described in step 1 of this article.
Additional Features
See below a list of various use cases and commands for the API Co-Signer.
Adding additional API users
The API Co-Signer supports signing for multiple API users, either from the same workspace or from different workspaces.
To add another user, please run the following command that will request you to enter the following inputs:
./cosigner add-user
- Pairing Token: As described above.
- Callback Handler URL: As described above.
Configuration Updates
Users can update the callback handler URL (callback_handler_url), by running:
./cosigner callback-update [user id]
The [user id] is optional and only needed if there are several API users paired to the same API Co-Signer. When running the command in this instance, please specify which user’s callback handler URL you would like to update. A complete list of all users can be retrieved by running the following command:
./cosigner list-users
Software Upgrades
Fireblocks notifies all customers when a software update is available.
To update, please run the following command:
./cosigner upgrade
Monitoring
The API Co-Signer is docker-based and uses the docker JSON file driver for logging. The default output of the driver is standard but can be configured to support other logging mechanisms.
To retrieve the API Co-Signer logs, run the following command:
./cosigner logs
The log file is written to the /databases/cosigner/log directory.