- Команды консоли RPC кошелька Bitcoin core — списки вызовов API клиента Bitcoin-qt
- Графический интерфейс Bitcoin core и CLI / API
- Окно консоли Bitcoin core
- Команды консоли Bitcoin
- Список команд консоли Bitcoin Core
- Блокчейн
- Контроль
- Создание
- Майнинг
- Необработанные транзакции
- Утилиты
- Кошелек
- How to get an address’s balance with the bitcoin client?
- 5 Answers 5
Команды консоли RPC кошелька Bitcoin core — списки вызовов API клиента Bitcoin-qt
В этой статье мы расскажем про некоторые основные команды, которые вы можете использовать для взаимодействия с консолью RPC Bitcoin core.
Клиент QT Bitcoin core — это оригинальный Биткойн-кошелек. Он имеет функции, которых нет у большинства других Биткойн-кошельков. Bitcoin core обеспечивает высокий уровень конфиденциальности, безопасности и стабильности.
Кошелек доступен для следующих операционных систем: Windows, Mac и Linux. Если на вашем компьютере еще не установлен Bitcoin core, вы можете скачать его отсюда.
Перед загрузкой и установкой обязательно проверьте пропускную способность и место на жестком диске (SSD).
Core Walle должен полностью подтверждать транзакции и блоки – поэтому он выкачивает весь блокчейн криптовалюты Bitcoin.
На момент написания этой статьи минимальные требования к месту на диске для работы Bitcoin core составляют более 350 ГБ. Он обрабатывает огромные объемы данных, поэтому убедитесь, что у вас хорошее подключение к Интернету.
Графический интерфейс Bitcoin core и CLI / API
После загрузки и установки кошелька дождитесь его полной синхронизации. Если у вас возникли проблемы с синхронизацией кошелька, ознакомьтесь с этим руководством:
После полной синхронизации ваш кошелек готов к использованию, и вы можете начать взаимодействие с ним.
Программное обеспечение Core wallet имеет как графический интерфейс (GUI), так и консольный интерфейс (CLI).
Графический интерфейс удобен для новичков. Можно легко и быстро просматривать текущий баланс, последние транзакции, отправлять и получать монеты BTC, настраивать комиссии, есть контроль монет и некоторые другие основные функции.
Но чтобы использовать программное обеспечение в полной мере и иметь полный контроль над своими Биткоинами, вам нужно научиться использовать окно консоли.
Далее мы покажем вам, как использовать окно консоли отладки в кошельке Bitcoin-qt.
Но, прежде чем вы перейдете к этому руководству и перед тем, как начнете вводить какие-либо команды в окне консоли, мы надеемся, что ваш кошелек зашифрован и у вас есть резервная копия.
Окно консоли Bitcoin core
В более старой версии кошелька Bitcoin вы должны увидеть окно отладки в разделе «Help> Debug window», где вы можете начать вводить команды bitcoin-cli.
В последней версии выберете выпадающее меню «window» и откройте «console».
Вы должны увидеть следующее предупреждение.
«Welcome to the Bitcoin Core RPC console.
Use up and down arrows to navigate history, and Ctrl-L to clear screen. Type help for an overview of available commands. For more information on using this console type help-console.»
«WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.»
Добро пожаловать в консоль Bitcoin Core RPC.
Используйте стрелки вверх и вниз для навигации по истории и Ctrl-L для очистки экрана. Введите help для обзора доступных команд. Для получения дополнительной информации об использовании этой консоли введите help-console.
ВНИМАНИЕ: существуют мошенники, которые просят пользователей вводить команды, которые крадут содержимое кошельков. Не используйте эту консоль, не понимая полностью смысл команды.
Как следует из предупреждения, не вводите команды, с которыми вы не знакомы, и не передавайте никому информацию, которая в вашем окне консоли, особенно ту, которая включает кодовую фразу кошелька и приватные ключи.
Команды консоли Bitcoin
Окно консоли Bitcoin RPC принимает множество команд. Введите «help». Вы увидите список команд, которые в настоящее время работают в консоли. Ниже мы перечислим все доступные команды.
Мы не будем вдаваться в подробности, чтобы познакомить вас с окном консоли, мы покажем несколько основных команд.
Отображает текущий блок
Отображает общий доступный баланс вашего кошелька
Отображает количество активных подключений к сети Биткойн.
Отображает объект, содержащий информацию о вашем кошельке
<
«walletname»: «»,
«walletversion»: xxxxxxx,
«balance»: 0.00000000,
«unconfirmed_balance»: 0.00000000,
«immature_balance»: 0.00000000,
«txcount»: 0,
«keypoololdest»: xxxxxxxxxx,
«keypoolsize»: xxxx,
«hdseedid»: «xxxxxxxxxxxxxxxxxxxxxxxxxx»,
«keypoolsize_hd_internal»: xxxx,
«unlocked_until»: x,
«paytxfee»: 0.00000000,
«private_keys_enabled»: true,
«avoid_reuse»: false,
«scanning»: false
>
Отображает информацию о текущем блокчейне Биткойна. Вы можете использовать эту команду для определения размера блокчейна, сложности и т. д.
<
«chain»: «main»,
«blocks»: 653527,
«headers»: 653587,
«bestblockhash»: «0000000000000000000313ef2b2930ecbc3fe05de391bc439xxxxxxxxxxxxxx»,
«difficulty»: 19996789994446.11,
«mediantime»: yyyyyyyyyyyy,
«verificationprogress»: 0.4544565953577,
«initialblockdownload»: false,
«chainwork»: «0000000000000000000000000000000000000000454dff6n25j34597dfvjkn45»,
«size_on_disk»: 656738766,
«pruned»: true,
«pruneheight»: 653202,
«automatic_pruning»: true,
«prune_target_size»: 576716800,
«softforks»: <
«bip34»: <
«type»: «buried»,
«active»: true,
«height»: 227931
>,
«bip66»: <
«type»: «buried»,
«active»: true,
«height»: 363725
>,
«bip65»: <
«type»: «buried»,
«active»: true,
«height»: 388381
>,
«csv»: <
«type»: «buried»,
«active»: true,
«height»: 419328
>,
Вы также можете использовать команду
Чтобы получить более точную информацию о количестве блоков, текущей сложности сети и найти количество транзакций в пуле транзакций (mempool).
<
«blocks»: 653597,
«difficulty»: 19994576894446.11,
«networkhashps»: 1.24389066767887e+020,
«pooledtx»: 1637,
«chain»: «main»,
«warnings»: «»
>
Есть много информации, которую вы можете получить из окна консоли Bitcoin core, используя команды, перечисленные ниже.
Вам не обязательно знать все эти команды. Однако, если вы разработчик и хотите разрабатывать приложения Биткойн, такие как block explorer или пулы для майнинга, понимание этих команд имеет важное значение.
Консоль RPC — отличный способ узнать о блокчейне Биткойн, сети, транзакциях и информации о майнинге.
Список команд консоли Bitcoin Core
Ниже мы пречислим все команды, которые нужны для различных решений: Блокчейн, Контроль, Создание (кошелька), Майнинг, Сеть (информация), Необработанные транзакции, Утилита, Кошелек, Zmq.
Блокчейн
Ниже перечислены все команды для блокчейн проверок
Контроль
Создание
Команды создания кошелька и другие функции
generatetoaddress nblocks «address» ( maxtries )
generatetodescriptor num_blocks «descriptor» ( maxtries )
Майнинг
Команды для майнинга
addnode «node» «command»
clearbanned
disconnectnode ( «address» nodeid )
getaddednodeinfo ( «node» )
getconnectioncount
getnettotals
getnetworkinfo
getnodeaddresses ( count )
getpeerinfo
listbanned
ping
setban «subnet» «command» ( bantime absolute )
setnetworkactive state
Необработанные транзакции
analyzepsbt «psbt»
combinepsbt [«psbt». ]
combinerawtransaction [«hexstring». ]
converttopsbt «hexstring» ( permitsigdata iswitness )
createpsbt [<"txid":"hex","vout":n,"sequence":n>. ] [<"address":amount>,<"data":"hex">. ] ( locktime replaceable )
createrawtransaction [<"txid":"hex","vout":n,"sequence":n>. ] [<"address":amount>,<"data":"hex">. ] ( locktime replaceable )
decodepsbt «psbt»
decoderawtransaction «hexstring» ( iswitness )
decodescript «hexstring»
finalizepsbt «psbt» ( extract )
fundrawtransaction «hexstring» ( options iswitness )
getrawtransaction «txid» ( verbose «blockhash» )
joinpsbts [«psbt». ]
sendrawtransaction «hexstring» ( maxfeerate )
signrawtransactionwithkey «hexstring» [«privatekey». ] ( [<"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount>. ] «sighashtype» )
testmempoolaccept [«rawtx». ] ( maxfeerate )
utxoupdatepsbt «psbt» ( [«»,<"desc":"str","range":n or [n,n]>. ] )
Утилиты
createmultisig nrequired [«key». ] ( «address_type» )
deriveaddresses «descriptor» ( range )
estimatesmartfee conf_target ( «estimate_mode» )
getdescriptorinfo «descriptor»
signmessagewithprivkey «privkey» «message»
validateaddress «address»
verifymessage «address» «signature» «message»
Кошелек
abandontransaction «txid»
abortrescan
addmultisigaddress nrequired [«key». ] ( «label» «address_type» )
backupwallet «destination»
bumpfee «txid» ( options )
createwallet «wallet_name» ( disable_private_keys blank «passphrase» avoid_reuse )
dumpprivkey «address»
dumpwallet «filename»
encryptwallet «passphrase»
getaddressesbylabel «label»
getaddressinfo «address»
getbalance ( «dummy» minconf include_watchonly avoid_reuse )
getbalances
getnewaddress ( «label» «address_type» )
getrawchangeaddress ( «address_type» )
getreceivedbyaddress «address» ( minconf )
getreceivedbylabel «label» ( minconf )
gettransaction «txid» ( include_watchonly verbose )
getunconfirmedbalance
getwalletinfo
importaddress «address» ( «label» rescan p2sh )
importmulti «requests» ( «options» )
importprivkey «privkey» ( «label» rescan )
importprunedfunds «rawtransaction» «txoutproof»
importpubkey «pubkey» ( «label» rescan )
importwallet «filename»
keypoolrefill ( newsize )
listaddressgroupings
listlabels ( «purpose» )
listlockunspent
listreceivedbyaddress ( minconf include_empty include_watchonly «address_filter» )
listreceivedbylabel ( minconf include_empty include_watchonly )
listsinceblock ( «blockhash» target_confirmations include_watchonly include_removed )
listtransactions ( «label» count skip include_watchonly )
listunspent ( minconf maxconf [«address». ] include_unsafe query_options )
listwalletdir
listwallets
loadwallet «filename»
lockunspent unlock ( [<"txid":"hex","vout":n>. ] )
removeprunedfunds «txid»
rescanblockchain ( start_height stop_height )
sendmany «» <"address":amount>( minconf «comment» [«address». ] replaceable conf_target «estimate_mode» )
sendtoaddress «address» amount ( «comment» «comment_to» subtractfeefromamount replaceable conf_target «estimate_mode» avoid_reuse )
sethdseed ( newkeypool «seed» )
setlabel «address» «label»
settxfee amount
setwalletflag «flag» ( value )
signmessage «address» «message»
signrawtransactionwithwallet «hexstring» ( [<"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount>. ] «sighashtype» )
unloadwallet ( «wallet_name» )
walletcreatefundedpsbt [<"txid":"hex","vout":n,"sequence":n>. ] [<"address":amount>,<"data":"hex">. ] ( locktime options bip32derivs )
walletlock
walletpassphrase «passphrase» timeout
walletpassphrasechange «oldpassphrase» «newpassphrase»
walletprocesspsbt «psbt» ( sign «sighashtype» bip32derivs )
Источник
How to get an address’s balance with the bitcoin client?
I want to see the balance of some address using bitcoind.
I set txindex=1 and did a -reindex to get all transactions indexed.
But still, there doesn’t seem to be a way to get balances of an address. getreceivedbyaddress doesn’t work with addresses out of your own wallet (I hoped it would after a -txindex=1 -reindex , but it didn’t).
I’m wondering why blockexplorer.com’s getreceivedbyaddress can do this for any address but the default client cannot. If you download and sync the whole blockchain, you should be able to query it for any information, right?
5 Answers 5
By default, what is maintained by the 0.8 blockchain engine is:
- All blocks
- A database with all block headers, and the positions on disk for each block
- A database that represents all unspent transaction outputs (UTXOs), indexed by txid, at the current tip of the block chain
- Undo files that allow rewinding the effects of blocks on this set of UTXOs.
Nothing related to addresses or balances exists at this level. That is just a client-side representation of the data. The balance of a wallet is the sum of the values of the UTXOs that are spendable with the set of keys in the wallet. You could define the balance of an address as the sum of the values of the UTXOs assigned to a script matching a given address (and this is what several sites do), but presenting it this way is quite confusing — it makes many people think that Bitcoin transactions transfer value from one address to another. This is not true, they consume specific outputs of a previous transaction, and merge and split those into new outputs.
The -txindex option you mention, adds one more thing that is maintained by the validation engine:
- A database with the positions on disk for each transaction, indexed by txid.
This was added to make the getrawtransaction command work with historical transactions, but again, this has nothing to do with addresses. A database that indexes the UTXO set by address, or even the entire block chain history by address would be possible, but it would be relatively expensive to maintain, and shouldn’t be necessary for normal operations (though it is quite useful for debugging. ).
Where such things do belong, is in the wallet. The wallet as presented by the reference client does not use «balance of an address» — it rather sees addresses as entry points into the wallet, but manages the coins in the entire wallet together, regardless of what address they were last sent to. This also confuses people who are used to look at blockexplorer-like websites, when they realize that for example change is always sent to a fresh address.
So, to give a real answer: if you really want to track a balance, you need the wallet interface. Right now, this is quite unflexible, but there are plans to improve this situation soon. We’ll hopefully soon get support for multiple wallets, and watch-only wallets, where you can just add addresses you’d like to track, without having their keys.
Источник