Sign In with Bitcoin on ICP

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, 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, :smiley:.

@domwoe @kristofer @bob11

13 Likes

Awesome!
bitcoinOS will adopt ic-siwb,thanks

Updates: To add support for Xverse and more bitcoin compatible wallets. We also need to support BIP-322-simple Signature Verification, see BIP-0322.

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.

pub enum SignMessageType{
    ECDSA,
    Bip322Simple
}

the siwb_login function signature will be

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

3 Likes

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

BIP322 is supported.
Currently Xverse is supported.

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

3 Likes

LaserEyes Support is added.

npm.js library:

Example:

3 Likes

Hi @neeboo ,

Amazing work on siwb! :fire: 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!

sure,

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

1 Like

REAME updated

2 Likes

Awesome! Thank you! back to it

@neeboo ,

Failing to build the package.

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