func main() {
bitcliconfig := bitcoincli.NewDefaultBitcoinCliConfig().
WithUser("YOUR_USER_NAME"). // form bitcoin.conf
WithPassword("YOUR_PASSWORD").
WithWalletNotify(&bitcoincli.WalletNotifyConfig{
Port: 17331,
})
client := bitcoincli.NewBitcoinCli(*bitcliconfig, []func(trans bitcoincli.RawTransaction){RawTransactionCallback})
walletBalance, _ := client.GetBalance("", 1)
// You can create any rpc request from https://developer.bitcoin.org/reference/intro.html
rpcWalletBalance, _ := client.Rpc().CallWallet("", "getbalance", []interface{}{"*", 1})
fmt.Println(walletBalance, rpcWalletBalance)
}
func RawTransactionCallback(trans bitcoincli.RawTransaction) { // receiving transaction updates
fmt.Println("TX UPD", trans.TxId, "confirms", trans.Confirmations)
}
-
Notifications
You must be signed in to change notification settings - Fork 0
aaapi-net/bitcoincli
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
JSON RPC Bitcoin Core Go Client
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published