If you are already familiar with ICP Identities, you can skip this step.
- Authenticate users with their Bitcoin wallets
- Generate Internet Computer identities
- Obtain API tokens for Odin services
Understanding Odin Authentication
Authentication Flow Explained
The Odin authentication process follows these steps:1
Address Retrieval
Your wallet provides its Bitcoin address to the SIWB (Sign-In with Bitcoin) canister. This establishes the identity that will be used for authentication.
2
Login Preparation
The SIWB canister generates a unique challenge message and sends it to your application. This message contains cryptographic data that proves the request’s authenticity.
3
Message Signing Request
Your application receives the challenge message and requests the user’s wallet to sign it. This step verifies that the user controls the private key associated with their Bitcoin address.
4
Wallet Signature
The wallet signs the challenge message using the user’s private key, creating a cryptographic proof of ownership without exposing the private key itself.
5
Login Completion
The signed message is sent back to the SIWB canister, which verifies the signature against the Bitcoin address. If valid, the authentication is approved.
6
Delegation Creation
Your application requests a delegation from the SIWB canister. This delegation acts as a temporary identity that can interact with Internet Computer services.
7
JWT Exchange
Your application exchanges the delegation for a JWT (JSON Web Token) from the Odin API. This token contains the user’s authenticated identity and permissions.
8
Access Token Received
The Odin API returns a JWT token that your application can use to authenticate all subsequent requests to Odin services.
This process ensures that users maintain control of their Bitcoin private keys while securely authenticating with Odin services through the Internet Computer infrastructure.

This tutorial focuses on Bitcoin wallet authentication through Node.js. For web applications, we recommend checking out Laser Eyes for easier wallet integration.
Prerequisites
Make sure you have the following installed before starting:Node.js
Node.js 18.0.0 or higher
TypeScript
TypeScript 5.0.0 or higher (recommended)
Install Dependencies
First, install the required Internet Computer libraries:SIWB Canister Integration
Import Canister Interface
Let’s start by setting up the SIWB canister interface. You can reference the contract and download the interface from the Internet Computer Dashboard.- IDL Factory
- TypeScript Types
- Service Interface
canister/ic_siwb_provider.idl.ts
For production deployments, you’ll need to deploy your own SIWB contract to the Internet Computer.
Configuration Setup
Create the necessary configuration files for your project:Implementing Phase 1: Prepare Authentication
Let’s implement the first phase where we request a message to sign from the SIWB canister:core/prepare.ts
Testing the Prepare Function
Let’s test our preparation function with a sample Bitcoin address:index.ts
Great! You’ve successfully implemented the first phase of SIWB authentication. The function returns a message that needs to be signed with your Bitcoin wallet.
What’s Next?
In the next step, you’ll learn how to:- Sign the message with a Bitcoin wallet
- Complete the authentication process
- Generate an Internet Computer identity
Continue to Step 2
Learn how to complete the SIWB login process with message signing
The code used in this guide is published at https://github.com/Toniq-Labs/odin-docs/tree/main/demo/getting-started.