Blockchain

class Blockchain(config: BlockchainConfig)

A blockchain backend.

Samples


fun main() { 
   //sampleStart 
   val blockchainConfig: BlockchainConfig = BlockchainConfig.Electrum(
    ElectrumConfig(
        electrumURL,
        null,
        5u,
        null,
        10u
    )
)

val blockchain: Blockchain = Blockchain(blockchainConfig)

blockchain.broadcast(signedPsbt) 
   //sampleEnd
}

Parameters

config

The blockchain configuration required.

Constructors

Link copied to clipboard
fun Blockchain(config: BlockchainConfig)

Create the new blockchain client.

Functions

Link copied to clipboard
fun broadcast(psbt: PartiallySignedBitcoinTransaction): String

Broadcast a transaction.

Link copied to clipboard
fun getBlockHash(height: UInt): String

Get the block hash of a given block.

Link copied to clipboard
fun getHeight(): UInt

Get the current height of the blockchain.