Comments (20)
Have you solved this problem?
from bitcoinkit.
Do you have any issues regarding to this?
from bitcoinkit.
No, I'm facing a similar problem. I thought maybe you have already found a solution?
from bitcoinkit.
Can you help me?
from bitcoinkit.
I will try to help you later;)
from bitcoinkit.
You mean not today? Let me know when you're ready to help.
from bitcoinkit.
Today
from bitcoinkit.
Ok
from bitcoinkit.
- Try to build everything like in the Readme.md
- Use Native Modules like JS and then call the JS function which contains your BTC Function from Swift
Notice: This library is over 4-5 years old without any updates so its kind of outdated
from bitcoinkit.
I'm a newbie. I didn't understand anything)
from bitcoinkit.
can you tell me more?
from bitcoinkit.
Opportunity 1. You try to build everything like in the documentation of this library. (Readme.md in Root of this project)
Opportunity 2. You use Native modules to call a Bitcoin JS function in Swift.
Explantation: you found a working Bitcoin function in a different Programming language like JavaScript.
You still want to use Swift as your primary programming language.
With Native Modules can you call a JS (can be any language if supported) Function in Swift.
from bitcoinkit.
I don't know). I want everything to work). I need a module that accepts seed and returns the current balance.
from bitcoinkit.
Would a Public Key instead of Seed Phrase also be ok?
from bitcoinkit.
No, only by seed.
from bitcoinkit.
Hello again,
use https://github.com/horizontalsystems/bitcoin-kit-ios library instead of this one because it is way more recent to get the Public Key from Seed Phrases.
To get the Balance, we use Alamofire (API module for Swift) and the api.blockcypher.com
API.
You need to install: bitcoin-kit-ios and Alamofire in your Podfile
pod 'BitcoinCore.swift'
pod 'BitcoinKit.swift'
pod 'Alamofire', '~> 5.6'
- turn Seed Phrases to Public Key:
func checkbalance(){
print("CheckBalance start");
var bitcoinKit: BitcoinKit
let words = [Seed Phrases example:"special", "verb"] //implement here your seed phrases
let seed = Mnemonic.seed(mnemonic: words)
bitcoinKit = try! BitcoinKit(withWords: words, bip: .bip44, walletId: "bitcoin-wallet-id", syncMode: .api, networkType: .testNet, logger: .none) //if you want to use mainnet change to networkType: .mainNet
bitcoinKit.start()
let PublicKey = bitcoinKit.receiveAddress()
print(PublicKey)
print(bitcoinKit.balance) //would normally print the Balance but doesn't works at the moment
print("BTC session completed!")
bitcoinKit.stop()
}
- Because
bitcoinKit.balance
doesn't works at the moment do we need to use aBTC API
to get the Balance
API request via Alamofire Swift
and api.blockcypher.com
API
Where the address in the Link is, do you need to paste the address from which you want to know the balance.
You can do this by pasting a variable in there with the Wallet address.
AF.request("https://api.blockcypher.com/v1/btc/test3/addrs/address/balance").responseJSON { response in
print(response)
var WalletResponse = response
print(WalletResponse)
}
from bitcoinkit.
I did everything as you said, but I get a lot of errors. Could you assemble this module into a single file so that everything works.
from bitcoinkit.
Import and setup everything like I told you before.
Change the @IBOutlet weak var TextLabel: UILabel!
(This is a TextLabel) and @IBAction func SendButton(_ sender: Any)
(This is a Button) to your own and enter your mnemonics in the Script.
The ViewController.swift
//
// ViewController.swift
// Swift Bitcoin
//
// Created by SurpriseMF3000 on 07.09.22.
//
import UIKit
import BitcoinKit
import BitcoinCore
import HdWalletKit
import HsToolKit
import RxSwift
import Alamofire
class ViewController: UIViewController {
@IBOutlet weak var TextLabel: UILabel!
@IBAction func SendButton(_ sender: Any) {
checkbalance()
}
func checkbalance(){
print("CheckBalance start");
var bitcoinKit: BitcoinKit
let words = [Enter here your mnemonics] //!!!!!!!!!!!!!!!!!!!!!
let seed = Mnemonic.seed(mnemonic: words)
bitcoinKit = try! BitcoinKit(withWords: words, bip: .bip44, walletId: "bitcoin-wallet-id", syncMode: .api, networkType: .testNet, logger: .none)
bitcoinKit.start()
print(bitcoinKit.receiveAddress())
var publicKey = bitcoinKit.receiveAddress()
print("PublicKey: " + publicKey)
AF.request("https://api.blockcypher.com/v1/btc/test3/addrs/\(publicKey)/balance").responseJSON { response in
print(response)
var WalletResponse = response
print("WalletResponse: " ,WalletResponse)
let WalletBalance = (WalletResponse.result)
print("Balance: ", WalletBalance)
}
print("BTC session completed!")
bitcoinKit.stop()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
from bitcoinkit.
Thank you, as soon as I have the opportunity to test your code
from bitcoinkit.
端点是怎么申请的,谢谢了
from bitcoinkit.
Related Issues (20)
- secp256k1 conflict with other kit. eg: web3swift. how remove depends
- Is the project being maintained? I wanted to use HDWallet balance and send
- Get signature as expected.
- Pod Install Fails HOT 15
- Good
- Pod install fails HOT 1
- Pod integration fail HOT 3
- Swift Package Manager & Vapor integration fail
- Hierarchical key ("xpub") based address derivation
- How can I check payment way done?
- Value of type 'OpaquePointer' has no member 'pointee'
- Is BitcoinAddress legacy wrong when HashType is .scriptHash ?
- 'OP_CHECKSEQUENCEVERIFY' mainProcess error
- Cannot receive fee
- Cannot send BTC to any wallet HOT 1
- Pod Install Error HOT 1
- Why does pod install fail all the time? HOT 4
- Dead project ? HOT 1
- pod install 总是报错
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitcoinkit.