<p>I'm new to Bitcoin Core development, and I am trying to find a way to execute another RPC command from within a new RPC command I'm trying to add.  I believe the <code>Node</code> interface has the <code>executeRpc()</code> method, but I don't have access to a <code>node</code> object, at least I can't find it.  How can I make that rpc call?</p>

CC BY-SA 4.0
2021-08-02T02:04:45.077Z
You shouldn't be calling an RPC from another RPC. If there is something that RPC does that you want to do in your own RPC, then you should move it to somewhere else and call it from both RPCs.
Ava Chow
CC BY-SA 4.0
2021-08-02T02:06:12.460Z
I looked at that, but that's too complicated, it would require too much messy refactoring.
andrewz
CC BY-SA 4.0
2021-08-02T03:36:19.317Z
"but I don't have access to a node object" Have you tried using a callback? What are you trying to do exactly? As Andrew Chow stated you should be able to do these as separate calls.
m1xolyd1an
<bitcoin-core><json-rpc>
How to internally call another RPC command inside bitcoin core server?
andrewz
# How to internally call another RPC command inside bitcoin core server?

(Asked by: username_0 on 2021-08-02)

I'm new to Bitcoin Core development, and I am trying to find a way to execute another RPC command from within a new RPC command I'm trying to add. I believe the `Node` interface has the `executeRpc()` method, but I don't have access to a `node` object, at least I can't find it. How can I make that rpc call?

**Tags:** bitcoin-core, json-rpc

> **Comments:**
> **username_1**: You shouldn't be calling an RPC from another RPC. If there is something that RPC does that you want to do in your own RPC, then you should move it to somewhere else and call it from both RPCs.  
> **username_0**: I looked at that, but that's too complicated, it would require too much messy refactoring.  
> **username_2**: "but I don't have access to a node object" Have you tried using a callback? What are you trying to do exactly? As Andrew username_1 stated you should be able to do these as separate calls.  

---

## 0 answers

