<p>It turns out, it is grpc nomenclature. According to the <a href="https://grpc.io/docs/guides/concepts.html#using-the-api-surface" rel="nofollow noreferrer">documentation at grpc.io</a>:</p>

<blockquote>
  <p>gRPC users typically call these APIs on the client side and implement
  the corresponding API on the server side.</p>
  
  <p>...</p>
  
  <p>On the client side, the client has a local object known as stub (for
  some languages, the preferred term is client) that implements the same
  methods as the service.</p>
</blockquote>

<p>Which pretty much means using grpc on the client side looks like you're interacting with an object that performs the operations locally - when in reality that object ( known as a <strong>stub</strong> ) is making calls to the server asking it to perform certain actions. </p>

CC BY-SA 4.0
2019-03-08T22:13:48.883Z
2019-03-08T22:13:48.883Z
arshbot
<p>For example, very often in the <a href="https://api.lightning.community" rel="nofollow noreferrer">lightning documentation</a> for their grpc api, you will see the following boilerplate python code:</p>

<pre><code>&gt;&gt;&gt; import codecs, grpc, os
&gt;&gt;&gt; import rpc_pb2 as ln, rpc_pb2_grpc as lnrpc
&gt;&gt;&gt; macaroon = codecs.encode(open('LND_DIR/data/chain/bitcoin/simnet/admin.macaroon', 'rb').read(), 'hex')
&gt;&gt;&gt; os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'
&gt;&gt;&gt; cert = open('LND_DIR/tls.cert', 'rb').read()
&gt;&gt;&gt; ssl_creds = grpc.ssl_channel_credentials(cert)
&gt;&gt;&gt; channel = grpc.secure_channel('localhost:10009', ssl_creds)
&gt;&gt;&gt; stub = lnrpc.LightningStub(channel)
</code></pre>

<p>I am curious, what is an LightningStub? Looking a bit deeper into rpc_pb2_grpc, which seems to be a generated file you'll find the following ( lacking ) bit of documentation:</p>

<pre><code>class LightningStub(object):
  # missing associated documentation comment in .proto file
  pass
</code></pre>

<lightning-network><lightning-network-daemon><grpc>
What is a stub from the lightning grpc documentation?
arshbot
# What is a stub from the lightning grpc documentation?

(Asked by: username_0 on 2019-03-08)

For example, very often in the lightning documentation for their grpc api, you will see the following boilerplate python code:
>>> import codecs, grpc, os
>>> import rpc_pb2 as ln, rpc_pb2_grpc as lnrpc
>>> macaroon = codecs.encode(open('LND_DIR/data/chain/bitcoin/simnet/admin.macaroon', 'rb').read(), 'hex')
>>> os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'
>>> cert = open('LND_DIR/tls.cert', 'rb').read()
>>> ssl_creds = grpc.ssl_channel_credentials(cert)
>>> channel = grpc.secure_channel('localhost:10009', ssl_creds)
>>> stub = lnrpc.LightningStub(channel)

I am curious, what is an LightningStub? Looking a bit deeper into rpc_pb2_grpc, which seems to be a generated file you'll find the following ( lacking ) bit of documentation:
class LightningStub(object):
  # missing associated documentation comment in .proto file
  pass

**Tags:** lightning-network, lightning-network-daemon, grpc


---

## 1 answers

### Answer by username_0 on 2019-03-08. Score: 1

It turns out, it is grpc nomenclature. According to the [documentation at grpc.io](https://grpc.io/docs/guides/concepts.html#using-the-api-surface):

> gRPC users typically call these APIs on the client side and implement
> the corresponding API on the server side.
>
> ...
>
> On the client side, the client has a local object known as stub (for
> some languages, the preferred term is client) that implements the same
> methods as the service.

Which pretty much means using grpc on the client side looks like you're interacting with an object that performs the operations locally - when in reality that object ( known as a **stub** ) is making calls to the server asking it to perform certain actions.


---

