# Sign In with Bitcoin on ICP

**URL:** <https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734>\
**Category:** Developers\
**Created:** [July 4, 2024, 4:00pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734 "2024-07-04T16:00:24Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [July 4, 2024, 4:00pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/1 "2024-07-04T16:00:24Z")

</div>

Hi everyone, we have a new Sign-in solution for Bitcoin Wallet, so called “Sign-In with Bitcoin” aka `ic-siwb`.

The project is forked and modified from the project we love: [`is-siwe`](https://forum.dfinity.org/t/announcing-ic-siwe-use-ethereum-wallets-to-login-to-ic/27450), thanks @kristofer . If you are familiar with `ic-siwe`, then you will find it very easy to configure and use the `ic-siwb`.

## Features

- **Bitcoin Wallet Sign-In** : Sign in with popular btc wallets (currently with Wizz Wallet and Unisat wallet ) to generate an IC identity and session.

----- forked from SIWE ----

- **Session Identity Uniqueness** : Ensures that session identities are specific to each application’s context, preventing cross-app identity misuse.
- **Consistent Principal Generation** : Guarantees that logging in with an Bitcoin wallet consistently produces the same Principal, irrespective of the client used.
- **Direct Bitcoin Address to Principal Mapping** : Creates a one-to-one correlation between Bitcoin addresses and Principals within the scope of the current application.
- **Timebound Sessions** : Allows developers to set expiration times for sessions, enhancing security and control.
- **Prebuilt Identity Provider** : Provides a prebuilt canister that can be integrated into any Internet Computer application, independent of the application’s programming language.

## TODOS:

- **Integrated Tests** : we need test cases to make sure the code is running correctly.
- \*\*More wallet supports \*\*: we need more wallet supports, for example: OKX Wallet, Xverse, Hiro and more. And customizable provider to support more.
- **Prebuild and Deployed Canister** : we need a canister to generate global stable identity, it’s best to be governed, upgraded and run by NNS.
- **Documentation** : we need documentation on everything, codes and examples.
- **Publishing** : crates and npm packages.

## Next steps:

1. more developers use and fork, and maintain the code.
2. more adoption by projects
3. your ideas, 😃.

@domwoe @kristofer @bob11

> **[GitHub - AstroxNetwork/ic-siwb: SIWB, Sign in with Bitcoin for ICP, the Internet...](https://github.com/AstroxNetwork/ic-siwb)**
>
> SIWB, Sign in with Bitcoin for ICP, the Internet Computer. Build cross chain Bitcoin apps on ICP!

---

<div class="post-metadata">

**Author:** ![lshoo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lshoo/32/5847_2.png) [@lshoo](https://forum.dfinity.org/u/lshoo)\
**Post date:** [July 7, 2024, 1:14am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/2 "2024-07-07T01:14:40Z")

</div>

Awesome！  
bitcoinOS will adopt ic-siwb，thanks

---

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [July 21, 2024, 1:12pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/3 "2024-07-21T13:12:10Z")

</div>

Updates: To add support for Xverse and more bitcoin compatible wallets. We also need to support BIP-322-simple Signature Verification, see [BIP-0322](https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki).

Since there is no existing BIP322 rust crates we can use directly. We have to build it our own and also need to support both Segwit v0 and v1.

After we implement this, the final API call will add another parameter to the login parameter.

```rust
pub enum SignMessageType{
    ECDSA,
    Bip322Simple
}

```

the siwb\_login function signature will be

```rust
#[update]
fn siwb_login(
    signature: String,
    address: String,
    public_key: String,
    session_key: ByteBuf,
    sign_message_type: SignMessageType,
) -> Result<LoginDetails, String>

```

---

<div class="post-metadata">

**Author:** ![icme](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icme/32/4327_2.png) [@icme](https://forum.dfinity.org/u/icme)\
**Post date:** [August 19, 2024, 10:00pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/4 "2024-08-19T22:00:06Z")

</div>

> [@neeboo](#):
>
> Updates: To add support for Xverse and more bitcoin compatible wallets. We also need to support BIP-322-simple Signature Verification, see [BIP-0322](https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki)

Hey @neeboo, are there any updates on this and expanding the list of Bitcoin compatible wallets?

---

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [August 21, 2024, 12:10am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/5 "2024-08-21T00:10:05Z")

</div>

BIP322 is supported.  
Currently Xverse is supported.

For the list, I think I will add more by the weekend

---

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [November 14, 2024, 1:38pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/6 "2024-11-14T13:38:51Z")

</div>

LaserEyes Support is added.

npm.js library:

> **[ic-siwb-lasereyes-connector](https://www.npmjs.com/package/ic-siwb-lasereyes-connector)**
>
> React hook and context provider for easy frontend integration with SIWE enabled Internet Computer canisters.. Latest version: 0.1.0, last published: 27 minutes ago. Start using ic-siwb-lasereyes-connector in your project by running \`npm i...

Example:

> **[ic-siwb/examples/laserEyes at main · AstroxNetwork/ic-siwb](https://github.com/AstroxNetwork/ic-siwb/tree/main/examples/laserEyes)**
>
> SIWB, Sign in with Bitcoin for ICP, the Internet Computer. Build cross chain Bitcoin apps on ICP! - AstroxNetwork/ic-siwb

---

<div class="post-metadata">

**Author:** ![iamenochchirima](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/iamenochchirima/32/21673_2.png) [@iamenochchirima](https://forum.dfinity.org/u/iamenochchirima)\
**Post date:** [November 15, 2024, 7:52am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/7 "2024-11-15T07:52:52Z")

</div>

Hi @neeboo ,

Amazing work on `siwb`! 🔥 I’m trying to use it in my project but struggling to figure out the parameters for deploying `ic_siwb_provider`. Could you update the README and Makefiles with the commands and steps for the whole setup?

Thanks so much for your help!

---

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [November 15, 2024, 8:19am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/8 "2024-11-15T08:19:31Z")

</div>

sure,

I’ll be updating the document after a few updates along

---

<div class="post-metadata">

**Author:** ![neeboo](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/neeboo/32/981_2.png) [@neeboo](https://forum.dfinity.org/u/neeboo)\
**Post date:** [November 17, 2024, 2:13pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/9 "2024-11-17T14:13:32Z")

</div>

> <https://github.com/AstroxNetwork/ic-siwb/blob/main/README.md>

REAME updated

---

<div class="post-metadata">

**Author:** ![iamenochchirima](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/iamenochchirima/32/21673_2.png) [@iamenochchirima](https://forum.dfinity.org/u/iamenochchirima)\
**Post date:** [November 18, 2024, 7:48am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/10 "2024-11-18T07:48:00Z")

</div>

Awesome! Thank you! back to it

---

<div class="post-metadata">

**Author:** ![Buriburizaemon](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/buriburizaemon/32/19925_2.png) [@Buriburizaemon](https://forum.dfinity.org/u/Buriburizaemon)\
**Post date:** [November 20, 2024, 1:28am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/11 "2024-11-20T01:28:01Z")

</div>

@neeboo ,

Failing to build the package.

```auto
error[E0282]: type annotations needed for `Box<_>`
  --> /Users/foo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/time-0.3.31/src/format_description/parse/mod.rs:83:9
   |
83 | let items = format_items
   | ^^^^^
...
86 | Ok(items.into())
   | ---- type must be known at this point
   |
help: consider giving `items` an explicit type, where the placeholders `_` are specified
   |
83 | let items: Box<_> = format_items
   | ++++++++

For more information about this error, try `rustc --explain E0282`.
error: could not compile `time` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
Error: Failed while trying to deploy canisters.
Caused by: Failed to build all canisters.
Caused by: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'bd3sg-teaaa-aaaaa-qaaba-cai' (ic_siwb_provider)
Caused by: Failed to build Rust canister 'ic_siwb_provider'.
Caused by: Failed to compile the rust package: ic_siwb_provider

```

can we have a release version of the `ic-siwb`?  
will be easier for me to specify the link to the wasm and candid in the `dfx.json` file.

something like this: [GitHub - domwoe/schnorr\_canister: Developer Preview of the Internet Computer (ICP)'s Threshold Schnorr Signing API](https://github.com/domwoe/schnorr_canister?tab=readme-ov-file#add-the-canister-to-your-project)

---

<div class="post-metadata">

**Author:** ![Buriburizaemon](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/buriburizaemon/32/19925_2.png) [@Buriburizaemon](https://forum.dfinity.org/u/Buriburizaemon)\
**Post date:** [December 27, 2024, 3:47am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/12 "2024-12-27T03:47:34Z")

</div>

@neeboo

I’m still failing to deploy the `ic-siwb` locally!

here is the error that I’m receiving with the release wasm:

```auto
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to install all canisters.
Caused by: Failed to install wasm module to canister 'ic_siwb_provider'.
Caused by: Failed during wasm installation call
Caused by: The replica returned a rejection error: reject code CanisterError, reject message Error from Canister be2us-64aaa-aaaaa-qaabq-cai: Canister called `ic0.trap` with message: failed to decode call arguments: Custom(No more values on the wire).
Consider gracefully handling failures from this canister or altering the canister to handle exceptions. See documentation: http://internetcomputer.org/docs/current/references/execution-errors#trapped-explicitly, error code None

```

---

<div class="post-metadata">

**Author:** ![Buriburizaemon](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/buriburizaemon/32/19925_2.png) [@Buriburizaemon](https://forum.dfinity.org/u/Buriburizaemon)\
**Post date:** [December 27, 2024, 5:07am UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/13 "2024-12-27T05:07:39Z")

</div>

I was able to fix the problem by replacing the candid file.

candid file provided in `release/ic_siwb_provider.did` doesn’t matches to `package/ic_siwb_provider/ic_siwb_provider.did`

---

<div class="post-metadata">

**Author:** ![Buriburizaemon](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/buriburizaemon/32/19925_2.png) [@Buriburizaemon](https://forum.dfinity.org/u/Buriburizaemon)\
**Post date:** [December 27, 2024, 1:54pm UTC](https://forum.dfinity.org/t/sign-in-with-bitcoin-on-icp/32734/14 "2024-12-27T13:54:13Z")

</div>

![Screenshot 2024-12-27 at 19.37.38](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/3X/5/a/5ad2fe464e74d2a241138077762d7433c0314df5.jpeg)

looks like it’s looking for something on port `8080`.  
do I need to deploy anything for localhost, as I don’t see anything on the README file?
