Bitcoin Forum
May 11, 2024, 01:03:08 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 »
1  Local / Кодеры / Как вытащить из hex raw транзакции комиссию и по on: September 24, 2023, 09:21:58 AM
Как вытащить из hex raw транзакции комиссию и получить входные суммы?

020000000001012ed19c0d7cee13d32e36a0b3f42e07404e0db43ac589962693264f9b764c38a50 100000000fdffffff023b770a000000000017a914252c6ccd8c3d8f72d5ac424fa05daf7db7e9f8 b5875a17fc6800000000160014f60834ef165253c571b11ce9fa74e46692fc5ec10248304502210 086b64a551e68fdea629930ab7590da58cbec8b5ec6648100cb69eacd87410ca402204b4afe518c 84874b03e31246542d8a41e3e18e8157c4fee71b26f94610bd7c7c0121026e5628506ecd33242e5 ceb5fdafe4d3066b5c0f159b3c05a621ef65f177ea28600000000

{
    "Version": "02000000",
    "IsCoinBase": "False",
    "IsWitness": "True",
    "WitnessCount": "0001",
    "InputCount": "01",
    "Inputs": [
        {
            "ID": "2ed19c0d7cee13d32e36a0b3f42e07404e0db43ac589962693264f9b764c38a5",
            "AddressType": "Hash160",
            "Address": "f60834ef165253c571b11ce9fa74e46692fc5ec1",
            "VOUT": "01000000",
            "ScriptSigSize": "",
            "ScriptSig": "",
            "WitnessDataSig": [
                "48304502210086b64a551e68fdea629930ab7590da58cbec8b5ec6648100cb69eacd87410ca4022 04b4afe518c84874b03e31246542d8a41e3e18e8157c4fee71b26f94610bd7c7c01",
                "21026e5628506ecd33242e5ceb5fdafe4d3066b5c0f159b3c05a621ef65f177ea286"
            ],
            "Sequence": "fdffffff"
        }
    ],
    "OutputCount": "02",
    "Outputs": [
        {
            "AddressType": "Hash160",
            "Address": "252c6ccd8c3d8f72d5ac424fa05daf7db7e9f8b5",
            "Value": "3b770a0000000000",
            "ScriptPubKeySize": "17",
            "ScriptPubKey": "a914252c6ccd8c3d8f72d5ac424fa05daf7db7e9f8b587"
        },
        {
            "AddressType": "Hash160",
            "Address": "f60834ef165253c571b11ce9fa74e46692fc5ec1",
            "Value": "5a17fc6800000000",
            "ScriptPubKeySize": "16",
            "ScriptPubKey": "0014f60834ef165253c571b11ce9fa74e46692fc5ec1"
        }
    ],
    "LockTime": "00000000"
}
2  Local / Кодеры / Как мне вытащить Pkscript(P2WSH) публичный ключ из witness data в т&# on: September 23, 2023, 12:40:16 PM
Как мне вытащить Pkscript(P2WSH) публичный ключ из witness data в транзакции из входа?

Транзакция:
https://www.blockchain.com/ru/explorer/transactions/btc/3cddfcd05a151d4b42df6505da7c2725772ba75663f2bd4bd2b37ef263f942bc



"WitnessDataSig": [
   "00",
   "4730440220196d759a59107aab4fd62eb3b2998befee5766312da5fd62e1068c0c35f7b2f102203 960b328ac8d65b541db3848e4d5f01f88ec690aaeb92fe1ff33ef40d5518d7101",
    "47304402207eeae87a737bb78dea5479413b2bd361387a5f27fab3193a0cf87d5a742b056802202 655926ee18aea4d47fd5d836554e04a466906bd0e378130c718f12e86e7c31701",
    "69522102755a063ef9223a86ecd06e1cb3c149d69de240542197a30900439543bec621f72102e62 c172505d9c48f57383257b6cc5f22e4cb04d0fe1ed9e4785b3593ab83eb6a210300329f881907a2 49d8c4af0c6a9d4fe158f3e14f8d3e1254e4ef3038af52b88653ae"
]

Нужно получить Pkscript: 8b262f778fe8ceb21e93bdef10ff19fca5bd3b06066980ec70a2c9916779eb1b
3  Local / Новички / Re: Bitcoin TestNet CLI RPC Почему не получается импортировать п on: September 17, 2023, 09:52:36 PM
А я оказывается не тестовой сети WIF ключ вписывал. Спасибо
4  Local / Новички / Re: Bitcoin TestNet CLI RPC Почему не получается импортировать п on: September 17, 2023, 09:30:55 PM
Получилось) А как получить из этого созданного адрес кошелька и как импортировать private key?

D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf getwalletinfo
{
  "walletname": "Test",
  "walletversion": 169900,
  "format": "bdb",
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 0,
  "keypoololdest": 1694985896,
  "keypoolsize": 0,
  "keypoolsize_hd_internal": 0,
  "unlocked_until": 1695045232,
  "paytxfee": 0.00000000,
  "private_keys_enabled": true,
  "avoid_reuse": false,
  "scanning": false,
  "descriptors": false,
  "external_signer": false
}



Пробовал hex/wif:
D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf importprivkey "0000000000000000000000000000000000000000000000000000000000000001"
error code: -5
error message:
Invalid private key encoding



D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf getnewaddress "" legacy
error code: -4
error message:
Error: This wallet has no available keys
5  Local / Новички / Bitcoin TestNet CLI RPC Почему не получается импортировать п on: September 17, 2023, 07:40:22 PM
Я пытаюсь импортировать хоть какой-то приватный ключ в кошелек но в результате получаю ошибку: Эта команда поддерживает только устаревшие кошельки.
И при создание кошелька много раз менял disable_private_keys: true/false и ничего не помогло

D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf createwallet Test false false "1"
{
  "name": "Test"
}

D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf getwalletinfo
{
  "walletname": "Test",
  "walletversion": 169900,
  "format": "sqlite",
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 0,
  "keypoolsize": 4000,
  "keypoolsize_hd_internal": 4000,
  "unlocked_until": 0,
  "paytxfee": 0.00000000,
  "private_keys_enabled": true,
  "avoid_reuse": false,
  "scanning": false,
  "descriptors": true,
  "external_signer": false
}

D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf walletpassphrase 1 6000

D:\Bitcoin\daemon>bitcoin-cli -conf=D:\Bitcoin\bitcoin.conf importprivkey 1
error code: -4
error message:
Эта команда поддерживает только устаревшие кошельки.


CONFIG:

debug=blockchain,net,mempool

testnet=1

rpcpassword=Test
rpcuser=Test

datadir=D:\Bitcoin\BitcoinData

txindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubhashtx=tcp://127.0.0.1:28332
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
zmqpubsequence=tcp://127.0.0.1:28332

server=1

====================================================================

Я хочу отслеживать транзакции в нескольких кошельках одновременно с проверкой баланса.
Пытаюсь реализовать аналогичный принцип проверки транзакций как на обменниках.

6  Local / Кодеры / Re: 🤔Как Создается nBits в блоке?🤔 on: December 16, 2022, 10:22:48 AM
Сложности 1 соответствуют биты 1D00FFFF (hex), что следует читать в данном случае как шестнадцатеричное число длиной 1D байт (29 в десятичной), начинающееся с 00FFFF, то есть 00FFFF0000000000000000000000000000000000000000000000000000. Если поделить это число на сложность из вашего примера, получится 319D7000000000000000000000000000000000000000000000, то есть число длиной в 25 байт (19 в hex), начинающееся на 319D70, или, по тому же принципу, 19319D70. 19319D70 в десятичной системе - это 422681968.

А 1D00FFFF постоянное?
И 1D00FFFF под основную сеть подходит?

Или как получить 1D00FFFF?
7  Local / Кодеры / 🤔Как Создается nBits в блоке?🤔 on: December 15, 2022, 03:01:35 PM
Как Создается nBits в блоке?
Я так понимаю значение nBits получаем из сложности?

https://www.blockchain.com/explorer/blocks/btc-testnet/2411364

из Difficulty:
86564599.52

в Bits:
422681968

Как это сделать?
8  Bitcoin / Development & Technical Discussion / How to get <target> values ​​for a block? The question is closed. on: December 14, 2022, 11:12:03 PM
You provided nbits = 422681968
If you convert that integer value to hex, you get the 4 bytes (32 bits) that nbits is made up of:
422681968 = hex value 0x19319D70

Split the first byte off of nbits to get hex value 0x19 leaving behind the remaining 3 bytes of 0x319D70
These are the two pieces that are used to calculate the target hash value and the difficulty using this formula:
TARGET = 0x319D70 * 2(8(0x19 - 3))

To make the math a bit easier to understand, we can convert those hex values back to integers for the purposes of this discussion:
= 3251568 * 2(8(25-3))
= 3251568 * 2(8(22))
= 3251568 * 2176
= 3251568 * 95780971304118053647396689196894323976171195136475136
TARGET = 311438341301388531462158357898567283222551020627518185013248

Convert this value back to hex to get the hash value that the block hash is compared to:
TARGET = 0x00000000000000319d7000000000000000000000000000000000000000000000

You may notice that hex value of TARGET is 0x319D70 shifted to the left until the 31 is in the 25'th (0x19) byte from the right. That's what that formula above does. It takes the last 3 bytes (6 characters) from nbits, and shifts them to the left until the first byte of that block of 3 bytes is exactly the number of bytes from the right that is specified by the first byte of nbits.

Now that you have the TARGET, the DIFFICULTY is just:
DIFFICULTY = (0xffff * 2208)/TARGET

Let's convert the formula above into integers to make the math easier to follow:
(65535 * 2208)/TARGET

We have the integer value of TARGET above so:
(65535 * 2208)/311438341301388531462158357898567283222551020627518185013248
= 86564599.52 = DIFFICULTY

Regarding my most recent message to you...

You didn't ask for it, but it's the calculation of the expected hash rate for a given difficulty is closely related, so I figured I'd share it.

The average number of hashes needed to find an acceptable hash at a given difficulty can be calculated as:
DIFFICULTY * 2256 / (0xffff * 2208)

Since the difficulty on the previous example was:
86564599.52

The average number of hashes that need to be calculated per block is:
= 86564599.52 * 2256 / (0xffff * 2208)
= 86564599.52 * 2256 / (65535 * 2208)
= 371797797113897361

Since blocks are intended to occur on average every 10 minutes (and there are 600 seconds in 10 minutes), this means that a difficulty of 86564599.52 would be set when the global average hash rate is:
371797797113897361 total hashes / 600 seconds = 619662995189828 hashes per second.

That's about 619.663 Thash/sec

The question is closed.
9  Bitcoin / Mining / Re: 🤔Why does <getrawmempool> return empty?🤔 on: December 14, 2022, 08:04:32 PM
Why does <getrawmempool> return empty?

Code:
testnet=1
[test]
addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151

blocksdir=D:\\Bitcoin
datadir=D:\\Bitcoin

dbcache=4000
maxorphantx=1000
maxmempool=1000
blockreconstructionextratxn=1000
maxsigcachesize=100
blockmaxweight=4000000

#debug=1
#natpmp=1
blocksonly=1
logips=1
deprecatedrpc=validateaddress
deprecatedrpc=signrawtransaction
deprecatedrpc=addwitnessaddress
deprecatedrpc=accounts
acceptnonstdtxn=1
server=1
rest=1

Screen: https://pastenow.ru/f335e33eef49c18306448a298f326972

FIX Bitcoin Config: blocksonly=1 TO blocksonly=0
10  Bitcoin / Mining / Re: 🤔Why does <getrawmempool> return empty?🤔 on: December 14, 2022, 05:04:30 PM
Shouldn't you use the command "bitcoin-cli getrawmempool true" ?

I am getting empty array or json
https://pastenow.ru/613f47d92635e1c9256d1d08a512e409
11  Local / Майнеры / 🤔Почему <getrawmempool> возвращает пустое значение?🤔 on: December 12, 2022, 01:34:51 PM
Почему <getrawmempool> возвращает пустое значение?
BTC-TESTNET синхронизирован

FIX Bitcoin Config: blocksonly=1 TO blocksonly=0
12  Bitcoin / Mining / 🤔Why does <getrawmempool> return empty?🤔 on: December 09, 2022, 11:44:11 AM
Why does <getrawmempool> return empty?

Code:
testnet=1
[test]
addnode=104.237.131.138
addnode=151.80.205.132
addnode=192.155.82.123
addnode=74.220.255.190
addnode=80.100.203.151

blocksdir=D:\\Bitcoin
datadir=D:\\Bitcoin

dbcache=4000
maxorphantx=1000
maxmempool=1000
blockreconstructionextratxn=1000
maxsigcachesize=100
blockmaxweight=4000000

#debug=1
#natpmp=1
blocksonly=1
logips=1
deprecatedrpc=validateaddress
deprecatedrpc=signrawtransaction
deprecatedrpc=addwitnessaddress
deprecatedrpc=accounts
acceptnonstdtxn=1
server=1
rest=1

Screen: https://pastenow.ru/f335e33eef49c18306448a298f326972
13  Bitcoin / Mining / Del on: December 06, 2022, 05:03:30 PM
del
14  Bitcoin / Development & Technical Discussion / Why is it empty when sending rpc via curl? on: October 10, 2022, 03:35:40 PM
None
15  Bitcoin / Development & Technical Discussion / Re: What is the best language to write a miner in? on: October 10, 2022, 06:49:54 AM
What is the best language to write a miner in?

If you're really expert and know what you're doing, for sure C is the most powerful programming language that allows you to think as a "machine". Assembly would be more performant but good luck not loosing your mind Cheesy

For people suggesting any OOP-based language or GC-based language, you're going to waste some helpful CPU burst on checking pointers, and allocations. C is a nightmare for pointers but it can allow you to write very efficient program without too much efforts. Unfortunately you need to master pointers management and you need to carefully think about the instruction cycle (fetch, decode, execute), pipelines and much more to waste CPU burst as few as possible.

I think I can understand it because I already know html/css/js/php/mysql web languages ​​and know python/c# and for learning blockchain mining I used python for test.



What is the best language for hash generation speed? Is it worth learning C++?
If you don't already know the language you will not be able to write the most efficient code needed for mining in that language that you would be learning the basics for! Optimization is a complicated topic that you can start on at an advanced level.
Try using the existing code that other experts have already written.
Can I have a couple of links to them? C is best learned by example.

[moderator's note: consecutive posts merged]
16  Bitcoin / Development & Technical Discussion / Re: What is the best language to write a miner in? on: October 09, 2022, 05:27:25 PM
The one you're most comfortable writing with. Most of the time the language you use doesn't matter, most systems have APIs that allow you to call other programs in other languages too (like how python's os module lets you run command line tasks).

If you're fairly new to programming there's ups and downs to using langiages that are statically typed (like c based languages and java) and ones that are dynamically typed (like python).

If you find you're very comfortable (/enjoying) programming one specific language, whatever it is, write it in that. If you don't care, you could always try both types.


What is the best language for hash generation speed? Is it worth learning C++?
17  Bitcoin / Development & Technical Discussion / What is the best language to write a miner in? on: October 09, 2022, 04:40:16 PM
What is the best language to write a miner in?
18  Bitcoin / Bitcoin Technical Support / Re: Is it possible to somehow send a new block to the btc network without using port on: October 08, 2022, 07:11:11 PM
There is no way to open at least 1 port( No access
19  Bitcoin / Bitcoin Technical Support / Is it possible to somehow send a new block to the btc network without using port on: October 08, 2022, 01:26:27 PM
Is it possible to somehow send a new block to the btc network without using ports?
20  Bitcoin / Development & Technical Discussion / Re: Pls Help!! How to get an outpoint in a transaction? #blockchain on: October 06, 2022, 07:43:38 AM
I take the json object itself from blockchain.info
Code:
-snip-
You can't get it from that transaction.
You can get it from this transaction: blockstream.info/tx/ed9ed571d9213cb62f019e0e8d93ab3854c97237512797f9b3bef41ec378bced?output:22 which is what that outpoint is referring to.

You or your wallet should already know that hash in order to "add it to the structure", you can't get it from the transaction being built
For example, you can get a txid from your wallet's inbound transactions which you can also get with listunspent RPC, then use the txid of the one you want to spend as the outpoint.

ok thanks good forum)
Pages: [1] 2 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!