Git Product home page Git Product logo

Comments (9)

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

Tested on this piece of code.
For zprv (bip84) - it's downloading transactions, but not recognising old transactions (history for such wallet is empty)
For xprv (bip32) - it doesn't download transactions at all.

image

from bitcoincore.swift.

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

Same seedData used to initialise bitcoinKit works as expected

image

from bitcoincore.swift.

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

All tested on .testNet .newWallet

from bitcoincore.swift.

esen avatar esen commented on May 23, 2024

hey @ArtemZinkov ,

.newWallet is considered to sync transactions only after the last checkpoint block. It assumes that the wallet is new and it has no transactions. You can check with ".api" or ".full" to sync historical transactions.

full // Sync from bip44Checkpoint. Api restore disabled
api // Sync from lastCheckpoint. Api restore enabled
newWallet // Sync from lastCheckpoint. Api restore enabled

lastCheckpoint is the last block of the last difficulty adjustment and it's updated before each release of the app.

from bitcoincore.swift.

esen avatar esen commented on May 23, 2024

Tested on this piece of code. For zprv (bip84) - it's downloading transactions, but not recognising old transactions (history for such wallet is empty) For xprv (bip32) - it doesn't download transactions at all.

image

As of watch accounts, we only support account derivations which have "m/purpose'/coin_type'/account'" derivations. You can get an account Public extended key as following:

let keychain = HDKeychain(privateKey: rootKey) // rootKey is an instance of HDPrivateKey
let publicKey = try! keychain.derivedKey(path: "m/84'/0'/0'").publicKey()
let extendedKey = HDExtendedKey.public(key: publicKey)

bip32 derivations are the generic name of all HD wallets and it may be custom for each type of wallets.

from bitcoincore.swift.

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

Hello @esen thank you for answering!

I tried to generate pubKey the way you mentioned, but for some reason - old transactions was still not recognised as "ours"
Screenshot 2023-08-08 at 15 10 13

BUT if i init wallet with Seed - it fetches and see transactions properly
Screenshot 2023-08-08 at 15 11 53

For more context - i still use .newWallet, due to it's testNet, transactions in it is quite recent and they're shown in history, for seed initialisation.
I clear Tx (BitcoinKit.Kit.clear()) every time when i change init version (with seed, or derived pubKey), to replicate initial launch.

Sorry if i missing some important detail, please ask if more context is required here

from bitcoincore.swift.

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

Hello @esen i would really appreciate any help or suggestion here, due to i faced road block here and not sure where to move forward, to enable watch only mode for wallets.

i also checked syncMode == .full, and still had no history for watch only mode, while bitcoinKit with seedData initialiser was capable to see old transactions for wallet i used

from bitcoincore.swift.

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

UPDATE:

Found what was the issue!
Derived path ("m/84'/0'/0'") you provided - consists of:
Purpose - 84
coinType - 0 (bitcoin)
chain - 0

I was testing this all on testNet, thus coinType should be 1 as mentioned here

i changed derivation path from "m/84'/0'/0'" to "m/84'/1'/0'" and it worked!
Thanks!!

from bitcoincore.swift.

ArtemZinkov avatar ArtemZinkov commented on May 23, 2024

I would suggest to add this as a check to compare with networkType, during initialisation of bitcoinKit

from bitcoincore.swift.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.