Bitcoin Core RPC Methods
Here is a list of Methods that provided on bitcoin core
all of them will be auto-generated for us
with a bit small amount of work
Wanna Help ?
- Fork & Clone it in your local machine
- Chose a Method From Above, and you should check if there is no PR created for it.
- Create a new branch, the branch name should be in this format
bitclient-{methodname}
- Add the Method to a new
json file named after the method name in src/methods See below.
- Create a PR with
(feat): Adding {methodname} to Bitclient
- after adding it and your PR has been accepted, kindly delete your branch and rebase.
- Thank you ❤️
How To Add Methods
the structure of json file is really simple, here is an example of getaccount method
"getAccount": {
"description": "The getaccount RPC returns the name of the account associated with the given address.",
"spec": "https://bitcoin.org/en/developer-reference#getaccount",
"params": {
"address": {
"type": "string",
"required": true,
"description": "A P2PKH or P2SH Bitcoin address belonging either to a specific account or the default account (“”)"
}
},
"result": {
"type": "string",
"required": true,
"description": "The name of an account, or an empty string (“”, the default account)"
}
}
all information has been copied from the method reference.
but some times the return type is got complex, like here in this method getblockchaininfo, the generator is just smart to convert these types from json to typescript interfaces.
"getBlockChainInfo": {
"description": "The getblockchaininfo RPC provides information about the current state of the block chain.",
"spec": "https://bitcoin.org/en/developer-reference#getblockchaininfo",
"params": {},
"result": {
"type": {
"chain": "string",
"blocks": 0,
"headers": 0,
"bestblockhash": "string",
"difficulty": 0,
"mediantime": 0,
"verificationprogress": 0,
"chainwork": "string",
"pruned": true,
"softforks": [
{
"id": "string",
"version": 0,
"reject": {
"status": true
}
}
],
"bip9_softforks": {
"csv": {
"status": "string",
"startTime": 0,
"timeout": 0,
"since": 0
},
"segwit": {
"status": "string",
"bit": 0,
"startTime": 0,
"timeout": 0,
"since": 0
}
}
},
"required": true,
"description": ""
}
}
you just have to copy the method's response example provided by it's reference, BUT with some modifications
Methods Spec:
- All Method Names should be in
lowerCamalCase, also for the parameters name.
- If the method takes no
params just make the params object empty "params": {}
- if the one of the
params is optional set "required" to false (:trollface: ).
- If the
result is an Object you should edit the values to this
- type of
number just make it 0 ( it could be any arbitrary number)
- type of
string make it "string" ( it could be any arbitrary string but let's make it a spec)
- type of
boolean make it true ( it could be any false too)
- same goes to the
params ⬆️ .
see more examples in the json files, it will help you a lot.
Bitcoin Core RPC Methods
Here is a list of Methods that provided on bitcoin core
all of them will be auto-generated for us
with a bit small amount of work
Wanna Help ?
bitclient-{methodname}jsonfile named after the method name insrc/methodsSee below.(feat): Adding {methodname} to BitclientHow To Add Methods
the structure of json file is really simple, here is an example of
getaccountmethodbut some times the return type is got complex, like here in this method
getblockchaininfo, the generator is just smart to convert these types from json to typescript interfaces.you just have to copy the method's response example provided by it's reference, BUT with some modifications
Methods Spec:
lowerCamalCase, also for the parameters name.paramsjust make theparamsobject empty"params": {}paramsis optional set"required"tofalse(:trollface: ).resultis anObjectyou should edit the values to thisnumberjust make it0( it could be any arbitrary number)stringmake it"string"( it could be any arbitrary string but let's make it a spec)booleanmake ittrue( it could be any false too)params⬆️ .see more examples in the json files, it will help you a lot.