Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只是想用私钥或者keystore,我新建一个identity,怎么将我的keystore和私钥导入? #96

Open
wkn66 opened this issue Sep 28, 2021 · 2 comments

Comments

@wkn66
Copy link

wkn66 commented Sep 28, 2021

我通过私钥倒入,怎么创建身份?

@XuNeal
Copy link
Contributor

XuNeal commented Sep 28, 2021

需要先创建身份再导入私钥

// You should create or recover Identity first before you create other wallets
do {
  var metadata = WalletMeta(source: .newIdentity)
  metadata.network = Network.mainnet
  metadata.segWit = .p2wpkh // .p2wpkh means that the derived btc wallet is a SegWit wallet
  metadata.name = "MyFirstIdentity"
  let (mnemonic, identity) = try Identity.createIdentity(password: TestData.password, metadata: metadata)
  let ethereumWallet = identity.wallets[0]
  let bitcoinWalelt = identity.wallets[1]
} catch {
  print("createIdentity failed, error:\(error)")
}

@wkn66
Copy link
Author

wkn66 commented Sep 28, 2021

需要先创建身份再导入私钥

// You should create or recover Identity first before you create other wallets
do {
  var metadata = WalletMeta(source: .newIdentity)
  metadata.network = Network.mainnet
  metadata.segWit = .p2wpkh // .p2wpkh means that the derived btc wallet is a SegWit wallet
  metadata.name = "MyFirstIdentity"
  let (mnemonic, identity) = try Identity.createIdentity(password: TestData.password, metadata: metadata)
  let ethereumWallet = identity.wallets[0]
  let bitcoinWalelt = identity.wallets[1]
} catch {
  print("createIdentity failed, error:\(error)")
}

好的 明白了 感谢。还有一个问题,我倒入多个助记词,转账的时候提示walletNotfound。请问有什么方式可以管理多个助记词嘛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants