|
| 1 | +# 19.2: Conocer la configuración de su nodo c-lightning |
| 2 | + |
| 3 | +> :information_source: **NOTA:** Esta sección se ha agregado recientemente al curso y es un borrador inicial que aún puede estar pendiente de revisión. Lector de advertencias. |
| 4 | +
|
| 5 | +Antes de comenzar a acceder a Lightning Network, debe comprender mejor su configuración. |
| 6 | + |
| 7 | +## Conozca su directorio de c-lightning |
| 8 | + |
| 9 | +Cuando se usa c-lightning, todo se guarda en el directorio `~/.lightning`. |
| 10 | + |
| 11 | +El directorio principal solo contiene directorios para las redes que estén configuradas, en este caso testnet: |
| 12 | +``` |
| 13 | +$ ls ~/.lightning |
| 14 | +testnet |
| 15 | +``` |
| 16 | + |
| 17 | +El directorio`~/.lightning/testnet`contendrá todas las entrañas de su configuración: |
| 18 | +``` |
| 19 | +$ ls ~/.lightning/testnet3 |
| 20 | +config gossip_store hsm_secret lightningd.sqlite3 lightningd.sqlite3-journal lightning-rpc |
| 21 | +``` |
| 22 | + |
| 23 | +> :link: **TESTNET vs MAINNET:** Si está utilizando mainnet, entonces _todo_ se colocará en el directorio `~/.lightning/bitcoin`. Estas diversas configuraciones se hacen elegantemente, por lo que si usted está usando MainNet, testnet y Regtest, usted encontrará que `~/.lightning/bitcoin` contiene el archivo de configuración y sus datos MainNet, el directorio `~/.lightning/testnet` contiene los datos Testnet, y el directorio `~/.lightning/regtest` contiene sus datos regtest. |
| 24 | +
|
| 25 | +## Conozca sus comandos lightning-cli |
| 26 | + |
| 27 | +La mayor parte de su trabajo inicial se realizará con el comando `lightning-cli`, que ofrece una interfaz fácil contra `lightningd`, tal como lo hace `bitcoin-cli`. |
| 28 | + |
| 29 | +Ya ha visto que el `help` comando le dará una lista de otros comandos: |
| 30 | +``` |
| 31 | +$ lightning-cli help |
| 32 | +lightning-cli: WARNING: default network changing in 2020: please set network=testnet in config! |
| 33 | +=== bitcoin === |
| 34 | +
|
| 35 | +feerates style |
| 36 | + Return feerate estimates, either satoshi-per-kw ({style} perkw) or satoshi-per-kb ({style} perkb). |
| 37 | +
|
| 38 | +newaddr [addresstype] |
| 39 | + Get a new {bech32, p2sh-segwit} (or all) address to fund a channel (default is bech32) |
| 40 | +
|
| 41 | +reserveinputs outputs [feerate] [minconf] [utxos] |
| 42 | + Reserve inputs and pass back the resulting psbt |
| 43 | +
|
| 44 | +sendpsbt psbt |
| 45 | + Finalize, extract and send a PSBT. |
| 46 | +
|
| 47 | +signpsbt psbt |
| 48 | + Sign this wallet's inputs on a provided PSBT. |
| 49 | +
|
| 50 | +txdiscard txid |
| 51 | + Abandon a transaction created by txprepare |
| 52 | +
|
| 53 | +txprepare outputs [feerate] [minconf] [utxos] |
| 54 | + Create a transaction, with option to spend in future (either txsend and txdiscard) |
| 55 | +
|
| 56 | +txsend txid |
| 57 | + Sign and broadcast a transaction created by txprepare |
| 58 | +
|
| 59 | +unreserveinputs psbt |
| 60 | + Unreserve inputs, freeing them up to be reused |
| 61 | +
|
| 62 | +withdraw destination satoshi [feerate] [minconf] [utxos] |
| 63 | + Send to {destination} address {satoshi} (or 'all') amount via Bitcoin transaction, at optional {feerate} |
| 64 | +
|
| 65 | +=== channels === |
| 66 | +
|
| 67 | +close id [unilateraltimeout] [destination] [fee_negotiation_step] |
| 68 | + Close the channel with {id} (either peer ID, channel ID, or short channel ID). Force a unilateral close after {unilateraltimeout} seconds (default 48h). If {destination} address is provided, will be used as output address. |
| 69 | +
|
| 70 | +fundchannel_cancel id |
| 71 | + Cancel inflight channel establishment with peer {id}. |
| 72 | +
|
| 73 | +fundchannel_complete id txid txout |
| 74 | + Complete channel establishment with peer {id} for funding transactionwith {txid}. Returns true on success, false otherwise. |
| 75 | +
|
| 76 | +fundchannel_start id amount [feerate] [announce] [close_to] [push_msat] |
| 77 | + Start fund channel with {id} using {amount} satoshis. Returns a bech32 address to use as an output for a funding transaction. |
| 78 | +
|
| 79 | +getroute id msatoshi riskfactor [cltv] [fromid] [fuzzpercent] [exclude] [maxhops] |
| 80 | + Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9). If specified search from {fromid} otherwise use this node as source. Randomize the route with up to {fuzzpercent} (default 5.0). {exclude} an array of short-channel-id/direction (e.g. [ '564334x877x1/0', '564195x1292x0/1' ]) or node-id from consideration. Set the {maxhops} the route can take (default 20). |
| 81 | +
|
| 82 | +listchannels [short_channel_id] [source] |
| 83 | + Show channel {short_channel_id} or {source} (or all known channels, if not specified) |
| 84 | +
|
| 85 | +listforwards |
| 86 | + List all forwarded payments and their information |
| 87 | +
|
| 88 | +setchannelfee id [base] [ppm] |
| 89 | + Sets specific routing fees for channel with {id} (either peer ID, channel ID, short channel ID or 'all'). Routing fees are defined by a fixed {base} (msat) and a {ppm} (proportional per millionth) value. If values for {base} or {ppm} are left out, defaults will be used. {base} can also be defined in other units, for example '1sat'. If {id} is 'all', the fees will be applied for all channels. |
| 90 | +
|
| 91 | +=== network === |
| 92 | +
|
| 93 | +connect id [host] [port] |
| 94 | + Connect to {id} at {host} (which can end in ':port' if not default). {id} can also be of the form id@host |
| 95 | +
|
| 96 | +disconnect id [force] |
| 97 | + Disconnect from {id} that has previously been connected to using connect; with {force} set, even if it has a current channel |
| 98 | +
|
| 99 | +listnodes [id] |
| 100 | + Show node {id} (or all, if no {id}), in our local network view |
| 101 | +
|
| 102 | +listpeers [id] [level] |
| 103 | + Show current peers, if {level} is set, include logs for {id} |
| 104 | +
|
| 105 | +ping id [len] [pongbytes] |
| 106 | + Send peer {id} a ping of length {len} (default 128) asking for {pongbytes} (default 128) |
| 107 | +
|
| 108 | +=== payment === |
| 109 | +
|
| 110 | +createonion hops assocdata [session_key] |
| 111 | + Create an onion going through the provided nodes, each with its own payload |
| 112 | +
|
| 113 | +decodepay bolt11 [description] |
| 114 | + Decode {bolt11}, using {description} if necessary |
| 115 | +
|
| 116 | +delexpiredinvoice [maxexpirytime] |
| 117 | + Delete all expired invoices that expired as of given {maxexpirytime} (a UNIX epoch time), or all expired invoices if not specified |
| 118 | +
|
| 119 | +delinvoice label status |
| 120 | + Delete unpaid invoice {label} with {status} |
| 121 | +
|
| 122 | +invoice msatoshi label description [expiry] [fallbacks] [preimage] [exposeprivatechannels] |
| 123 | + Create an invoice for {msatoshi} with {label} and {description} with optional {expiry} seconds (default 1 week), optional {fallbacks} address list(default empty list) and optional {preimage} (default autogenerated) |
| 124 | +
|
| 125 | +listinvoices [label] |
| 126 | + Show invoice {label} (or all, if no {label}) |
| 127 | +
|
| 128 | +listsendpays [bolt11] [payment_hash] |
| 129 | + Show sendpay, old and current, optionally limiting to {bolt11} or {payment_hash}. |
| 130 | +
|
| 131 | +listtransactions |
| 132 | + List transactions that we stored in the wallet |
| 133 | +
|
| 134 | +sendonion onion first_hop payment_hash [label] [shared_secrets] [partid] |
| 135 | + Send a payment with a pre-computed onion. |
| 136 | +
|
| 137 | +sendpay route payment_hash [label] [msatoshi] [bolt11] [payment_secret] [partid] |
| 138 | + Send along {route} in return for preimage of {payment_hash} |
| 139 | +
|
| 140 | +waitanyinvoice [lastpay_index] [timeout] |
| 141 | + Wait for the next invoice to be paid, after {lastpay_index} (if supplied). If {timeout} seconds is reached while waiting, fail with an error. |
| 142 | +
|
| 143 | +waitinvoice label |
| 144 | + Wait for an incoming payment matching the invoice with {label}, or if the invoice expires |
| 145 | +
|
| 146 | +waitsendpay payment_hash [timeout] [partid] |
| 147 | + Wait for payment attempt on {payment_hash} to succeed or fail, but only up to {timeout} seconds. |
| 148 | +
|
| 149 | +=== plugin === |
| 150 | +
|
| 151 | +autocleaninvoice [cycle_seconds] [expired_by] |
| 152 | + Set up autoclean of expired invoices. |
| 153 | +
|
| 154 | +estimatefees |
| 155 | + Get the urgent, normal and slow Bitcoin feerates as sat/kVB. |
| 156 | +
|
| 157 | +fundchannel id amount [feerate] [announce] [minconf] [utxos] [push_msat] |
| 158 | + Fund channel with {id} using {amount} (or 'all'), at optional {feerate}. Only use outputs that have {minconf} confirmations. |
| 159 | +
|
| 160 | +getchaininfo |
| 161 | + Get the chain id, the header count, the block count, and whether this is IBD. |
| 162 | +
|
| 163 | +getrawblockbyheight height |
| 164 | + Get the bitcoin block at a given height |
| 165 | +
|
| 166 | +getutxout txid vout |
| 167 | + Get informations about an output, identified by a {txid} an a {vout} |
| 168 | +
|
| 169 | +listpays [bolt11] |
| 170 | + List result of payment {bolt11}, or all |
| 171 | +
|
| 172 | +pay bolt11 [msatoshi] [label] [riskfactor] [maxfeepercent] [retry_for] [maxdelay] [exemptfee] |
| 173 | + Send payment specified by {bolt11} with {amount} |
| 174 | +
|
| 175 | +paystatus [bolt11] |
| 176 | + Detail status of attempts to pay {bolt11}, or all |
| 177 | +
|
| 178 | +plugin subcommand=start|stop|startdir|rescan|list |
| 179 | + Control plugins (start, stop, startdir, rescan, list) |
| 180 | +
|
| 181 | +sendrawtransaction tx |
| 182 | + Send a raw transaction to the Bitcoin network. |
| 183 | +
|
| 184 | +=== utility === |
| 185 | +
|
| 186 | +check command_to_check |
| 187 | + Don't run {command_to_check}, just verify parameters. |
| 188 | +
|
| 189 | +checkmessage message zbase [pubkey] |
| 190 | + Verify a digital signature {zbase} of {message} signed with {pubkey} |
| 191 | +
|
| 192 | +getinfo |
| 193 | + Show information about this node |
| 194 | +
|
| 195 | +getlog [level] |
| 196 | + Show logs, with optional log {level} (info|unusual|debug|io) |
| 197 | +
|
| 198 | +getsharedsecret point |
| 199 | + Compute the hash of the Elliptic Curve Diffie Hellman shared secret point from this node private key and an input {point}. |
| 200 | +
|
| 201 | +help [command] |
| 202 | + List available commands, or give verbose help on one {command}. |
| 203 | +
|
| 204 | +listconfigs [config] |
| 205 | + List all configuration options, or with [config], just that one. |
| 206 | +
|
| 207 | +listfunds |
| 208 | + Show available funds from the internal wallet |
| 209 | +
|
| 210 | +signmessage message |
| 211 | + Create a digital signature of {message} |
| 212 | +
|
| 213 | +stop |
| 214 | + Shut down the lightningd process |
| 215 | +
|
| 216 | +waitblockheight blockheight [timeout] |
| 217 | + Wait for the blockchain to reach {blockheight}, up to {timeout} seconds. |
| 218 | +
|
| 219 | +=== developer === |
| 220 | +
|
| 221 | +dev-listaddrs [bip32_max_index] |
| 222 | + Show addresses list up to derivation {index} (default is the last bip32 index) |
| 223 | +
|
| 224 | +dev-rescan-outputs |
| 225 | + Synchronize the state of our funds with bitcoind |
| 226 | +
|
| 227 | +--- |
| 228 | +run `lightning-cli help <command>` for more information on a specific command |
| 229 | +``` |
| 230 | + |
| 231 | +## Conozca la información de lightning |
| 232 | + |
| 233 | +Una variedad de comandos `lightning-cli` pueden brindarle información adicional sobre su nodo Lightning. Los más generales son: |
| 234 | +``` |
| 235 | +$ lightning-cli --testnet listconfigs |
| 236 | +$ lightning-cli --testnet listfunds |
| 237 | +$ lightning-cli --testnet listtransactions |
| 238 | +$ lightning-cli --testnet listinvoices |
| 239 | +$ lightning-cli --testnet listnodes |
| 240 | +``` |
| 241 | +* listconfigs: El comando RPC `listconfigs` enumera todas las opciones de configuración. |
| 242 | +* listfunds: El comando RPC `listfunds` muestra todos los fondos disponibles, ya sea en salidas no gastadas (UTXO) en la billetera interna o fondos bloqueados en los canales abiertos actualmente. |
| 243 | +* listtransactions: El comando RPC `listtransactions` devuelve transacciones rastreadas en la billetera. Esto incluye depósitos, retiros y transacciones relacionadas con los canales. |
| 244 | +* listinvoices: El comando RPC `listinvoices` recupera el estado de una factura específica, si existe, o el estado de todas las facturas si no se proporciona ningún argumento. |
| 245 | +* listnodes: El comando RPC `listnodes` devuelve los nodos que su servidor ha aprendido a través de mensajes de chismes, o uno solo si se especificó el ID de nodo. |
| 246 | + |
| 247 | +Por ejemplo `lightning-cli listconfigs` le brinda una variedad de información sobre su configuración: |
| 248 | +``` |
| 249 | +c$ lightning-cli --testnet listconfigs |
| 250 | +{ |
| 251 | + "# version": "v0.8.2-398-g869fa08", |
| 252 | + "lightning-dir": "/home/standup/.lightning", |
| 253 | + "network": "testnet", |
| 254 | + "allow-deprecated-apis": true, |
| 255 | + "rpc-file": "lightning-rpc", |
| 256 | + "plugin": "/usr/local/bin/../libexec/c-lightning/plugins/fundchannel", |
| 257 | + "plugin": "/usr/local/bin/../libexec/c-lightning/plugins/autoclean", |
| 258 | + "plugin": "/usr/local/bin/../libexec/c-lightning/plugins/bcli", |
| 259 | + "plugin": "/usr/local/bin/../libexec/c-lightning/plugins/pay", |
| 260 | + "plugin": "/usr/local/bin/../libexec/c-lightning/plugins/keysend", |
| 261 | + "plugins": [ |
| 262 | + { |
| 263 | + "path": "/usr/local/bin/../libexec/c-lightning/plugins/fundchannel", |
| 264 | + "name": "fundchannel" |
| 265 | + }, |
| 266 | + { |
| 267 | + "path": "/usr/local/bin/../libexec/c-lightning/plugins/autoclean", |
| 268 | + "name": "autoclean", |
| 269 | + "options": { |
| 270 | + "autocleaninvoice-cycle": null, |
| 271 | + "autocleaninvoice-expired-by": null |
| 272 | + } |
| 273 | + }, |
| 274 | + { |
| 275 | + "path": "/usr/local/bin/../libexec/c-lightning/plugins/bcli", |
| 276 | + "name": "bcli", |
| 277 | + "options": { |
| 278 | + "bitcoin-datadir": null, |
| 279 | + "bitcoin-cli": null, |
| 280 | + "bitcoin-rpcuser": null, |
| 281 | + "bitcoin-rpcpassword": null, |
| 282 | + "bitcoin-rpcconnect": null, |
| 283 | + "bitcoin-rpcport": null, |
| 284 | + "bitcoin-retry-timeout": null, |
| 285 | + "commit-fee": "500" |
| 286 | + } |
| 287 | + }, |
| 288 | + { |
| 289 | + "path": "/usr/local/bin/../libexec/c-lightning/plugins/pay", |
| 290 | + "name": "pay" |
| 291 | + }, |
| 292 | + { |
| 293 | + "path": "/usr/local/bin/../libexec/c-lightning/plugins/keysend", |
| 294 | + "name": "keysend" |
| 295 | + } |
| 296 | + ], |
| 297 | + "disable-plugin": [], |
| 298 | + "always-use-proxy": false, |
| 299 | + "daemon": "false", |
| 300 | + "wallet": "sqlite3:///home/user/.lightning/testnet/lightningd.sqlite3", |
| 301 | + "wumbo": false, |
| 302 | + "wumbo": false, |
| 303 | + "rgb": "03fce2", |
| 304 | + "alias": "learningBitcoin", |
| 305 | + "pid-file": "/home/user/.lightning/lightningd-testnet.pid", |
| 306 | + "ignore-fee-limits": false, |
| 307 | + "watchtime-blocks": 144, |
| 308 | + "max-locktime-blocks": 720, |
| 309 | + "funding-confirms": 3, |
| 310 | + "commit-fee-min": 200, |
| 311 | + "commit-fee-max": 2000, |
| 312 | + "cltv-delta": 6, |
| 313 | + "cltv-final": 10, |
| 314 | + "commit-time": 10, |
| 315 | + "fee-base": 1, |
| 316 | + "rescan": 15, |
| 317 | + "fee-per-satoshi": 10, |
| 318 | + "max-concurrent-htlcs": 483, |
| 319 | + "min-capacity-sat": 10000, |
| 320 | + "offline": "false", |
| 321 | + "autolisten": true, |
| 322 | + "disable-dns": "false", |
| 323 | + "enable-autotor-v2-mode": "false", |
| 324 | + "encrypted-hsm": false, |
| 325 | + "rpc-file-mode": "0600", |
| 326 | + "log-level": "DEBUG", |
| 327 | + "log-prefix": "lightningd" |
| 328 | +} |
| 329 | +``` |
| 330 | + |
| 331 | +## Resumen: Conozca la configuración de su nodo lightning |
| 332 | + |
| 333 | +El directorio `~/.lightning` contiene todos sus archivos, mientras que el comando `lightning-cli help` se puede usar con una variedad de comandos de ayuda para obtener más información sobre cómo funcionan su configuración y Lightning Network. |
| 334 | + |
| 335 | +## Que sigue? |
| 336 | + |
| 337 | +Necesitará tener un segundo nodo Linode para probar el pago real de facturas. Si necesita ayuda para configurar uno, lea [Interludio: Acceso a un segundo nodo Lightning .](19_2__Interludio_Accediendo_a_un_Segundo_Nodo_Lightning.md). |
| 338 | + |
| 339 | +De lo contrario, continúe "Comprensión de la configuración de Lightning" con [§19.3: Configurando un Canal](19_3_Creando_un_Canal_en_Lightning.md). |
0 commit comments