A BTC api for nim.
Find a file
2025-01-16 06:44:59 -05:00
src moved to puppy, sorry for all the breaming changes 2025-01-16 06:44:59 -05:00
NimBTC.nimble moved to puppy, sorry for all the breaming changes 2025-01-16 06:44:59 -05:00
README.md InitialCommit 2024-12-20 20:49:09 -05:00

  • A BTC wrapper for nim

  • Note: This is not fully tested, as some of the endpoints are complex and time consuming to test. The Bitcoin Core's RPC documentation is sloppy and sometimes out of date, the defaults they specify has been wrong on several occasions during testing. For example, the default for decriptors is wrong on the createWallet endpoint. This was corrected in the wrapper.

Example Usage:

import NimBTC
import Json
import pretty
let client = initBTCClient("http://127.0.0.1:18332/", "user", "7wFULRLmjxXSH1kqUSB2NLR3MrsYCc8l0GWP_6nccug")
echo createWallet(client, "user")
echo loadWallet(client, "user")

let blockTest = getBestBlockHash(client).resultObject.getStr()
let transactions = getblock(client, blockTest, HighVerbosity).resultObject["tx"]
let txid = transactions[5]["txid"].getStr()
echo txid
let txRawBase = getrawtransaction(client, txid, true)
let originBlock = txRawBase.resultObject["vin"][0]["txid"].getStr()
let txRawMinusOne = getrawtransaction(client, originBlock, true)
print txRawBase
print txRawMinusOne