Make requests to an Electrum Server via Swift.
This package supports TCP, TLS, SSL, UDP, DTLS and not tor. The returning Objects are the same as in the MempoolKit. Also the Electrum Struct conforms to the BlockExplorer protocol, which means you can ether use MempoolKit or ElectrumKit
var blockexplorer: BlockExplorer = Mempool() blockexplorer = Electrum(hostName: "bitcoin.lukechilds.co", port: 50001, using: .tcp)
let electrum = Electrum(hostName: "bitcoin.lukechilds.co", port: 50001, using: .tcp)
If you want debug logs you can turn set debug to true.
let version = try await electrum.version()
Returns the version of the Electrum Server in a String.
let blockTip = try await electrum.getBlockTip()
Returns the blockheight of the latest block.
let tx = try await electrum.transaction(txid: "54b34ca8a627105a1d2a6c0a2224ba3394ca5dcd70ecf62ed43e334129b654d0")
Returns the transactions with all the prevouts. If this transaction is huge and has a lot of entries and exits, this method might take a lot of time or even throw an error. If you dont need all the prevouts its way faster:
let tx = try await electrum.transaction(txid: "54b34ca8a627105a1d2a6c0a2224ba3394ca5dcd70ecf62ed43e334129b654d0", withPrevOut: false)
let txid = try await electrum.sendTransaction(hex: transactionHex)
Broadcast a raw transaction in hex format.
let recommendedFees = try await electrum.recommendedFees()
Returns the recommended Fees.
let txs = try await electrum.addressTXS(address: "1Ecc7owFDacRgjcm2Vfw17eW2zM5Gjg4SX")
Returns all confirmed and unconfirmed transactions from a address.
Address Mempool Transactions
let mempoolTX = try await electrum.getMempoolTX(address: "1Ecc7owFDacRgjcm2Vfw17eW2zM5Gjg4SX")
Returns all unconfirmed transactions from a address.
let utxos = try await electrum.addressUTXOs(address: "1Ecc7owFDacRgjcm2Vfw17eW2zM5Gjg4SX")
Returns all the UTXOs from an address.
let outspends = try await electrum.transactionOutspends(txid: "a00e4ff182014fe854e8278c8ba8d3f25bd564c8e94cdaa746fbfe7c15cc1d6c")
Returns which UTXOs in a transaction is spent.