Skip to content

Commit 64707aa

Browse files
authored
Merge pull request #324 from javiervargas/patch-9
Chapter 03 - 2 03_2_Conociendo_Su_Configuracion_Bitcoin.md
2 parents 52c8cf8 + 5006f1a commit 64707aa

File tree

1 file changed

+315
-0
lines changed

1 file changed

+315
-0
lines changed
Lines changed: 315 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,315 @@
1+
# 3.2: Conociendo su configuración Bitcoin
2+
3+
Antes de comenzar a jugar con Bitcoin, es posible que siempre quiera llegar a una mejor comprension.
4+
5+
## Conozca su directorio de Bitcoin
6+
7+
Para empezar, debe comprender dónde se guarda todo: el directorio `~/.bitcoin`.
8+
9+
El directorio principal solo contiene su archivo de configuración y el directorio testnet:
10+
```
11+
$ ls ~/.bitcoin
12+
bitcoin.conf testnet3
13+
```
14+
Las guías de configuración del [Capítulo dos: Creación de un VPS de Bitcoin-Core](02_0_Configurando_un_Bitcoin-Core_VPS.md) presentaron un archivo de configuración estandarizado. [3.1: Verificando Su Configuración Bitcoin](03_1_Verificando_Su_Configuracion_Bitcoin.md) sugirió cómo cambiarla para admitir configuraciones más avanzadas. Si está interesado en aprender aún más sobre el archivo de configuración, puede consultar el Generador de configuración de [Bitcoin Core de Jameson Lopp](https://jlopp.github.io/bitcoin-core-config-generator/).
15+
16+
Volviendo a su directorio ~ / .bitcoin, encontrará que el directorio testnet3 contiene todas las vísceras:
17+
```
18+
$ ls ~/.bitcoin/testnet3
19+
banlist.dat blocks debug.log mempool.dat peers.dat
20+
bitcoind.pid chainstate fee_estimates.dat onion_private_key wallets
21+
```
22+
No debería interactuar con la mayoría de estos archivos y directorios, particularmente con los directorios `blocks` y `chainstate`, que contienen todos los datos de la cadena de bloques, y la información en su directorio `wallets`, que contiene su billetera personal. Sin embargo, tome nota del archvo `debug.log`, al que debe consultar si alguna vez tiene problemas con la configuración.
23+
24+
> :link: **TESTNET vs MAINNET:** Si está utilizando mainnet, entonces _todo_ se colocará en el directorio principal `~/.bitcoin`. Estas diversas configuraciones se apilan elegantemente, por lo que si usted está usando mainnet, testnet y regtest, usted encontrará que `~/.bitcoin` contiene el archivo de configuración y sus datos MainNet, el directorio `~/.bitcoin/testnet3` contiene los datos Testnet, y el directorio `~/.bitcoin/regtest` los datos Regtest.
25+
26+
## Conozca sus comandos Bitcoin-cli
27+
28+
La mayor parte de su trabajo inicial se realizará con el comando `bitcoin-cli`, que ofrece una interfaz sencilla para `bitcoind`. Si alguna vez desea obtener más información sobre su uso, simplemente ejecútelo con el argumento `help`. Sin ningún otro argumento, le muestra todos los comandos posibles:
29+
30+
```
31+
$ bitcoin-cli help
32+
== Blockchain ==
33+
getbestblockhash
34+
getblock "blockhash" ( verbosity )
35+
getblockchaininfo
36+
getblockcount
37+
getblockfilter "blockhash" ( "filtertype" )
38+
getblockhash height
39+
getblockheader "blockhash" ( verbose )
40+
getblockstats hash_or_height ( stats )
41+
getchaintips
42+
getchaintxstats ( nblocks "blockhash" )
43+
getdifficulty
44+
getmempoolancestors "txid" ( verbose )
45+
getmempooldescendants "txid" ( verbose )
46+
getmempoolentry "txid"
47+
getmempoolinfo
48+
getrawmempool ( verbose )
49+
gettxout "txid" n ( include_mempool )
50+
gettxoutproof ["txid",...] ( "blockhash" )
51+
gettxoutsetinfo
52+
preciousblock "blockhash"
53+
pruneblockchain height
54+
savemempool
55+
scantxoutset "action" ( [scanobjects,...] )
56+
verifychain ( checklevel nblocks )
57+
verifytxoutproof "proof"
58+
59+
== Control ==
60+
getmemoryinfo ( "mode" )
61+
getrpcinfo
62+
help ( "command" )
63+
logging ( ["include_category",...] ["exclude_category",...] )
64+
stop
65+
uptime
66+
67+
== Generating ==
68+
generatetoaddress nblocks "address" ( maxtries )
69+
generatetodescriptor num_blocks "descriptor" ( maxtries )
70+
71+
== Mining ==
72+
getblocktemplate ( "template_request" )
73+
getmininginfo
74+
getnetworkhashps ( nblocks height )
75+
prioritisetransaction "txid" ( dummy ) fee_delta
76+
submitblock "hexdata" ( "dummy" )
77+
submitheader "hexdata"
78+
79+
== Network ==
80+
addnode "node" "command"
81+
clearbanned
82+
disconnectnode ( "address" nodeid )
83+
getaddednodeinfo ( "node" )
84+
getconnectioncount
85+
getnettotals
86+
getnetworkinfo
87+
getnodeaddresses ( count )
88+
getpeerinfo
89+
listbanned
90+
ping
91+
setban "subnet" "command" ( bantime absolute )
92+
setnetworkactive state
93+
94+
== Rawtransactions ==
95+
analyzepsbt "psbt"
96+
combinepsbt ["psbt",...]
97+
combinerawtransaction ["hexstring",...]
98+
converttopsbt "hexstring" ( permitsigdata iswitness )
99+
createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable )
100+
createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable )
101+
decodepsbt "psbt"
102+
decoderawtransaction "hexstring" ( iswitness )
103+
decodescript "hexstring"
104+
finalizepsbt "psbt" ( extract )
105+
fundrawtransaction "hexstring" ( options iswitness )
106+
getrawtransaction "txid" ( verbose "blockhash" )
107+
joinpsbts ["psbt",...]
108+
sendrawtransaction "hexstring" ( maxfeerate )
109+
signrawtransactionwithkey "hexstring" ["privatekey",...] ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" )
110+
testmempoolaccept ["rawtx",...] ( maxfeerate )
111+
utxoupdatepsbt "psbt" ( ["",{"desc":"str","range":n or [n,n]},...] )
112+
113+
== Util ==
114+
createmultisig nrequired ["key",...] ( "address_type" )
115+
deriveaddresses "descriptor" ( range )
116+
estimatesmartfee conf_target ( "estimate_mode" )
117+
getdescriptorinfo "descriptor"
118+
signmessagewithprivkey "privkey" "message"
119+
validateaddress "address"
120+
verifymessage "address" "signature" "message"
121+
122+
== Wallet ==
123+
abandontransaction "txid"
124+
abortrescan
125+
addmultisigaddress nrequired ["key",...] ( "label" "address_type" )
126+
backupwallet "destination"
127+
bumpfee "txid" ( options )
128+
createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse )
129+
dumpprivkey "address"
130+
dumpwallet "filename"
131+
encryptwallet "passphrase"
132+
getaddressesbylabel "label"
133+
getaddressinfo "address"
134+
getbalance ( "dummy" minconf include_watchonly avoid_reuse )
135+
getbalances
136+
getnewaddress ( "label" "address_type" )
137+
getrawchangeaddress ( "address_type" )
138+
getreceivedbyaddress "address" ( minconf )
139+
getreceivedbylabel "label" ( minconf )
140+
gettransaction "txid" ( include_watchonly verbose )
141+
getunconfirmedbalance
142+
getwalletinfo
143+
importaddress "address" ( "label" rescan p2sh )
144+
importmulti "requests" ( "options" )
145+
importprivkey "privkey" ( "label" rescan )
146+
importprunedfunds "rawtransaction" "txoutproof"
147+
importpubkey "pubkey" ( "label" rescan )
148+
importwallet "filename"
149+
keypoolrefill ( newsize )
150+
listaddressgroupings
151+
listlabels ( "purpose" )
152+
listlockunspent
153+
listreceivedbyaddress ( minconf include_empty include_watchonly "address_filter" )
154+
listreceivedbylabel ( minconf include_empty include_watchonly )
155+
listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed )
156+
listtransactions ( "label" count skip include_watchonly )
157+
listunspent ( minconf maxconf ["address",...] include_unsafe query_options )
158+
listwalletdir
159+
listwallets
160+
loadwallet "filename"
161+
lockunspent unlock ( [{"txid":"hex","vout":n},...] )
162+
removeprunedfunds "txid"
163+
rescanblockchain ( start_height stop_height )
164+
sendmany "" {"address":amount} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode" )
165+
sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount replaceable conf_target "estimate_mode" avoid_reuse )
166+
sethdseed ( newkeypool "seed" )
167+
setlabel "address" "label"
168+
settxfee amount
169+
setwalletflag "flag" ( value )
170+
signmessage "address" "message"
171+
signrawtransactionwithwallet "hexstring" ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" )
172+
unloadwallet ( "wallet_name" )
173+
walletcreatefundedpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime options bip32derivs )
174+
walletlock
175+
walletpassphrase "passphrase" timeout
176+
walletpassphrasechange "oldpassphrase" "newpassphrase"
177+
walletprocesspsbt "psbt" ( sign "sighashtype" bip32derivs )
178+
179+
== Zmq ==
180+
getzmqnotifications
181+
```
182+
También puede escribir `bitcoin-cli help [command]` para obtener información aún más extensa sobre ese comando. Por ejemplo:
183+
```
184+
$ bitcoin-cli help getmininginfo
185+
...
186+
Returns a json object containing mining-related information.
187+
Result:
188+
{ (json object)
189+
"blocks" : n, (numeric) The current block
190+
"currentblockweight" : n, (numeric, optional) The block weight of the last assembled block (only present if a block was ever assembled)
191+
"currentblocktx" : n, (numeric, optional) The number of block transactions of the last assembled block (only present if a block was ever assembled)
192+
"difficulty" : n, (numeric) The current difficulty
193+
"networkhashps" : n, (numeric) The network hashes per second
194+
"pooledtx" : n, (numeric) The size of the mempool
195+
"chain" : "str", (string) current network name (main, test, regtest)
196+
"warnings" : "str" (string) any network and blockchain warnings
197+
}
198+
199+
Examples:
200+
> bitcoin-cli getmininginfo
201+
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getmininginfo", "params": []}' -H 'content-type: text/plain;' http://127.0.0.1:8332/
202+
```
203+
> :book: ***¿Qué es RPC?*** `bitcoin-cli` es solo una interfaz práctica que le permite enviar comandos al `bitcoind`. Más específicamente, es una interfaz que le permite enviar comandos RPC (o protocolo de procedimiento remoto) al `bitcoind`. A menudo, el comando `bitcoin-cli` y el comando RPC tienen nombres e interfaces idénticos, pero algunos comandos `bitcoin-cli` proporcionan atajos para solicitudes RPC más complejas. Generalmente, la interfaz `bitcoin-cli` es mucho más limpia y simple que intentar enviar comandos RPC a mano, usando `curl` o algún otro método. Sin embargo, también tiene limitaciones en cuanto a lo que puede hacer en última instancia.
204+
205+
## Opcional: conozca su información de Bitcoin
206+
207+
Una variedad de comandos bitcoin-cli pueden brindarle información adicional sobre sus datos bitcoin. Los más generales son:
208+
209+
`bitcoin-cli -getinfo` devuelve información de diferentes RPC (fácil de usar)
210+
211+
```diff
212+
$ bitcoin-cli -getinfo
213+
214+
! Chain: test
215+
Blocks: 1977694
216+
Headers: 1977694
217+
Verification progress: 0.9999993275374796
218+
Difficulty: 1
219+
220+
+ Network: in 0, out 8, total 8
221+
Version: 219900
222+
Time offset (s): 0
223+
Proxy: N/A
224+
Min tx relay fee rate (BTC/kvB): 0.00001000
225+
226+
@@ Wallet: ""@@
227+
Keypool size: 1000
228+
Unlocked until: 0
229+
Transaction fee rate (-paytxfee) (BTC/kvB): 0.00000000
230+
231+
# Balance: 0.02853102
232+
233+
- Warnings: unknown new rules activated (versionbit 28)
234+
235+
```
236+
237+
Otros comandos para obtener información sobre blockchain, minería, red, billetera, etc.
238+
239+
```
240+
$ bitcoin-cli getblockchaininfo
241+
$ bitcoin-cli getmininginfo
242+
$ bitcoin-cli getnetworkinfo
243+
$ bitcoin-cli getnettotals
244+
$ bitcoin-cli getwalletinfo
245+
```
246+
Por ejemplo, `bitcoin-cli getnetworkinfo` le brinda una variedad de información sobre su configuración y su acceso a varias redes:
247+
```
248+
$ bitcoin-cli getnetworkinfo
249+
{
250+
"version": 200000,
251+
"subversion": "/Satoshi:0.20.0/",
252+
"protocolversion": 70015,
253+
"localservices": "0000000000000408",
254+
"localservicesnames": [
255+
"WITNESS",
256+
"NETWORK_LIMITED"
257+
],
258+
"localrelay": true,
259+
"timeoffset": 0,
260+
"networkactive": true,
261+
"connections": 10,
262+
"networks": [
263+
{
264+
"name": "ipv4",
265+
"limited": false,
266+
"reachable": true,
267+
"proxy": "",
268+
"proxy_randomize_credentials": false
269+
},
270+
{
271+
"name": "ipv6",
272+
"limited": false,
273+
"reachable": true,
274+
"proxy": "",
275+
"proxy_randomize_credentials": false
276+
},
277+
{
278+
"name": "onion",
279+
"limited": false,
280+
"reachable": true,
281+
"proxy": "127.0.0.1:9050",
282+
"proxy_randomize_credentials": true
283+
}
284+
],
285+
"relayfee": 0.00001000,
286+
"incrementalfee": 0.00001000,
287+
"localaddresses": [
288+
{
289+
"address": "45.79.111.171",
290+
"port": 18333,
291+
"score": 1
292+
},
293+
{
294+
"address": "2600:3c01::f03c:92ff:fecc:fdb7",
295+
"port": 18333,
296+
"score": 1
297+
},
298+
{
299+
"address": "4wrr3ktm6gl4sojx.onion",
300+
"port": 18333,
301+
"score": 4
302+
}
303+
],
304+
"warnings": "Warning: unknown new rules activated (versionbit 28)"
305+
}
306+
```
307+
No dude en hacer referencia a cualquiera de estos y utilizar el comando "bitcoin-cli help" si desea obtener más información sobre lo que hacen.
308+
309+
## Resumen: conociendo la configuración de Bitcoin
310+
311+
El directorio `~/.bitcoin` contiene todos sus archivos, mientras que `bitcoin-cli help` se puede usar con una variedad de comandos informativos para obtener más información sobre cómo funcionan su configuración y Bitcoin.
312+
313+
## ¿Que sigue?
314+
315+
Continúe "Entendiendo su configuracion de Bitcoin" en [§3.3: Configurando su billetera](03_3_Configurando_Su_Billetera.md).

0 commit comments

Comments
 (0)