Bitcoin Forum
May 29, 2024, 06:55:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 [4] 5 6 »
61  Bitcoin / Development & Technical Discussion / connect two bitcoin core nodes on different machine, using regtest on: March 14, 2018, 09:20:06 AM
I have setup one bitcoin core node on machine A, and one bitcoin core node on machine B. The two machines can ping each other.

On machine A (10.0.0.11):
bitcoind -regtest -port=18332 -rpcport=8331
Bitcoin server starting

On machine B (11.0.0.12):
bitcoind -regtest -port=18332 -rpcport=8331 -connect=10.0.0.11:18332
Bitcoin server starting

Then on machine B, i run the command:
"bitcoin-cli -regtest  -port=18332 -rpcport=8331 getconnectioncount"

It returns 0. Is there any mistakes in my steps ?
62  Bitcoin / Development & Technical Discussion / Re: Some testnet questions on: February 19, 2018, 02:25:38 AM
When i run a bitcoin core node in testnet, how do i mine bitcoin in testnet? What is the settings in bitcoin.conf ? 

The setgenerate is not working, see below:
./bitcoin-cli -testnet setgenerate true
63  Bitcoin / Development & Technical Discussion / Re: bitcoind mining in testnet on: February 17, 2018, 02:34:29 PM

You might want to read this article written by James Loop, one of the knowledgeable people in crypto community: https://medium.com/@lopp/how-to-solo-mine-on-bitcoin-s-testnet-6073c917b495

You should be able to run the bitcoin client locally and create the blockchain only for you from scratch. This might be a good idea if you want to play with code as then you control mining, difficulty etc.

Thanks. What is the disk space that is needed to run testnet? According to https://bitcoin.org/en/bitcoin-core/features/requirements  , it is 145 GB disk space for mainnet.

https://en.bitcoin.it/wiki/Testnet  , it is 14 GB for testnet.
64  Bitcoin / Development & Technical Discussion / Re: get bitcoin address balance on: February 17, 2018, 12:43:29 AM
However here is the link for one of your addresses and we can see that it has balance on the test-net, note that for this I used blockcypher explorer as they have an option for test-net as well as for main-net:

https://live.blockcypher.com/btc-testnet/address/2MxoU6Sz8gyWfLCF2b8a8Wv56VT1MHdSB2x/ - balance 1.1btc at the moment of checking.

Thank you !! I am a beginner in bitcoin, the forum helps a lot.
65  Bitcoin / Development & Technical Discussion / get bitcoin address balance on: February 16, 2018, 02:13:36 PM
From bitcoin core:

ubuntu@ip-172-31-16-165:~/bitcoin/src$ ./bitcoin-cli  -testnet getaddressesbyaccount ""
[
  "2MxoU6Sz8gyWfLCF2b8a8Wv56VT1MHdSB2x",
  "2NEquFrdTthcctUv3tUkeNU7FbbkgMT2812"
]

Then, i go to https://blockchain.info/search?search=2NEquFrdTthcctUv3tUkeNU7FbbkgMT2812%22

The webpage told me unrecognized search pattern.

Is the bitcoin core address not recognised ?

I go to https://blockexplorer.com/

The webpage told me "no matching records found".

Which address format should i use
66  Bitcoin / Development & Technical Discussion / bitcoind mining in testnet on: February 16, 2018, 12:56:43 PM
I use bitcoin core version 0.16.0

Can i change my bitcoin.conf file, so that i can get bitcoins in testnet from mining?
67  Bitcoin / Development & Technical Discussion / Re: Bitcoin core “bad-txns-in-belowout” on: January 15, 2018, 10:28:18 AM
(I haven't checked the code, if this is really possible...)

Thank you for your reply. I am writing the code. It is possible that i can send the code to you. Please send a message to me with your email, i will send the code to you.

The transactions are sent out successfully by the code now.

[opening]
vic@ubuntu:~/Downloads/bitcoin$ ./src/bitcoin-cli -regtest decoderawtransaction 010000000108fad212da1a0f5f361346d76d35a19d3a1d11f80dab8d010ee0e0f48855190a00000 0006a47304402203d7de998eb2ba1fab32cd61acaa2662a77ec9d11c043ac59afe906acdca2db37 022058981084f1e85f9fcbb6916d33e2f94c83ea1ef1dd561c78ec6ddf3e385b9739012102b0fca dc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281bffffffff0260d4ff2901 0000001976a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac801a06000000000017a91 45e01d5143c397a78abb4bd5ee3459615a99aa8a48700000000
{
  "txid": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
  "hash": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
  "version": 1,
  "size": 223,
  "vsize": 223,
  "locktime": 0,
  "vin": [
    {
      "txid": "0a195588f4e0e00e018dab0df8111d3a9da1356dd74613365f0f1ada12d2fa08",
      "vout": 0,
      "scriptSig": {
        "asm": "304402203d7de998eb2ba1fab32cd61acaa2662a77ec9d11c043ac59afe906acdca2db370220589 81084f1e85f9fcbb6916d33e2f94c83ea1ef1dd561c78ec6ddf3e385b9739[ALL] 02b0fcadc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b",
        "hex": "47304402203d7de998eb2ba1fab32cd61acaa2662a77ec9d11c043ac59afe906acdca2db3702205 8981084f1e85f9fcbb6916d33e2f94c83ea1ef1dd561c78ec6ddf3e385b9739012102b0fcadc485 0e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 49.99599200,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 befa430b26b29cd72d55d3a7b9da70abac76f61c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mxvkV17H5X8Kc6msvSwb6tfTnk2tqyahJq"
        ]
      }
    },
    {
      "value": 0.00400000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 5e01d5143c397a78abb4bd5ee3459615a99aa8a4 OP_EQUAL",
        "hex": "a9145e01d5143c397a78abb4bd5ee3459615a99aa8a487",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2N1pHhdSyb6D8b6TAea26CWX6KbWfHkDxQ4"
        ]
      }
    }
  ]
}

[refund]
vic@ubuntu:~/Downloads/bitcoin$ ./src/bitcoin-cli -regtest decoderawtransaction 010000000170b9da483b29ac2cb09b38f9dc24bd4317bde60d6679fbf5beb097a167a8c34601000 000da0047304402205af0c4506b679c2d668246a5019f8cba6cbd42076cf5964d77f7230020e3b8 b002202da677710b2c328a55128375360ac5ca2aba7733cb174d63a2794fc50ee4b250014830450 221008b45af9b246713177b153833d7067b3266c2e67f4f1ccadd6664e3d04ac3140c022072a484 b83c97554c076035c1159f6f0a8d764a535021cd395033d6a0d720de110147522102b0fcadc4850 e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a024 d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae0000000001801a0600000000001976a91 4befa430b26b29cd72d55d3a7b9da70abac76f61c88ac54010000
{
  "txid": "e65826dae4ea499eb5e085e0d3e9b02fd3f9caa0be26115f019db2ea02a71d4d",
  "hash": "e65826dae4ea499eb5e085e0d3e9b02fd3f9caa0be26115f019db2ea02a71d4d",
  "version": 1,
  "size": 303,
  "vsize": 303,
  "locktime": 340,
  "vin": [
    {
      "txid": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
      "vout": 1,
      "scriptSig": {
        "asm": "0 304402205af0c4506b679c2d668246a5019f8cba6cbd42076cf5964d77f7230020e3b8b002202da 677710b2c328a55128375360ac5ca2aba7733cb174d63a2794fc50ee4b250[ALL] 30450221008b45af9b246713177b153833d7067b3266c2e67f4f1ccadd6664e3d04ac3140c02207 2a484b83c97554c076035c1159f6f0a8d764a535021cd395033d6a0d720de11[ALL] 522102b0fcadc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d 5fb74a8fa0383a024d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae",
        "hex": "0047304402205af0c4506b679c2d668246a5019f8cba6cbd42076cf5964d77f7230020e3b8b0022 02da677710b2c328a55128375360ac5ca2aba7733cb174d63a2794fc50ee4b25001483045022100 8b45af9b246713177b153833d7067b3266c2e67f4f1ccadd6664e3d04ac3140c022072a484b83c9 7554c076035c1159f6f0a8d764a535021cd395033d6a0d720de110147522102b0fcadc4850e3086 45ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a024d5e55 671d2d3c45ed1fd8aea97a27a6a2e01926df852ae"
      },
      "sequence": 0
    }
  ],
  "vout": [
    {
      "value": 0.00400000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 befa430b26b29cd72d55d3a7b9da70abac76f61c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mxvkV17H5X8Kc6msvSwb6tfTnk2tqyahJq"
        ]
      }
    }
  ]
}

[commitment]
vic@ubuntu:~/Downloads/bitcoin$ ./src/bitcoin-cli -regtest decoderawtransaction 010000000170b9da483b29ac2cb09b38f9dc24bd4317bde60d6679fbf5beb097a167a8c34601000 000db004830450221009e5d98cf5aaa6ea65bf9bab0b24031e1ea7f750f0aaf6040b497d42d96ce 671c02204f6888bae3603b88c4f1ad67a417c1da76007b4420394122f5420b784dc215100148304 50221008460f60e8187e2f429751e33c1201edab11a33d117c1b17e3517c1f7bd0bf20f02205934 911dd13919d9994090c38fc44b32550882aa38080c12977fbfe973d19f040147522102b0fcadc48 50e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a0 24d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae0000000002dc050000000000001976a 9143f8262c9c4fcc5285ff4d54ac5eb243180a2523588ac84110600000000001976a914befa430b 26b29cd72d55d3a7b9da70abac76f61c88ac00000000
{
  "txid": "14068565188fd3e7bea5cdfadc6377cf5db47f559e508a4e9926331e020967fd",
  "hash": "14068565188fd3e7bea5cdfadc6377cf5db47f559e508a4e9926331e020967fd",
  "version": 1,
  "size": 338,
  "vsize": 338,
  "locktime": 0,
  "vin": [
    {
      "txid": "46c3a867a197b0bef5fb79660de6bd1743bd24dcf9389bb02cac293b48dab970",
      "vout": 1,
      "scriptSig": {
        "asm": "0 30450221009e5d98cf5aaa6ea65bf9bab0b24031e1ea7f750f0aaf6040b497d42d96ce671c02204 f6888bae3603b88c4f1ad67a417c1da76007b4420394122f5420b784dc21510[ALL] 30450221008460f60e8187e2f429751e33c1201edab11a33d117c1b17e3517c1f7bd0bf20f02205 934911dd13919d9994090c38fc44b32550882aa38080c12977fbfe973d19f04[ALL] 522102b0fcadc4850e308645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d 5fb74a8fa0383a024d5e55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae",
        "hex": "004830450221009e5d98cf5aaa6ea65bf9bab0b24031e1ea7f750f0aaf6040b497d42d96ce671c0 2204f6888bae3603b88c4f1ad67a417c1da76007b4420394122f5420b784dc21510014830450221 008460f60e8187e2f429751e33c1201edab11a33d117c1b17e3517c1f7bd0bf20f02205934911dd 13919d9994090c38fc44b32550882aa38080c12977fbfe973d19f040147522102b0fcadc4850e30 8645ecb8e9fc9d6cd7401c27de20b9bfd3b4bfb8f9d9e1281b21030fa1d5fb74a8fa0383a024d5e 55671d2d3c45ed1fd8aea97a27a6a2e01926df852ae"
      },
      "sequence": 0
    }
  ],
  "vout": [
    {
      "value": 0.00001500,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 3f8262c9c4fcc5285ff4d54ac5eb243180a25235 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9143f8262c9c4fcc5285ff4d54ac5eb243180a2523588ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mmJm4WXW3u1mUj2rihPoDYp4GsPit6Ng8W"
        ]
      }
    },
    {
      "value": 0.00397700,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 befa430b26b29cd72d55d3a7b9da70abac76f61c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914befa430b26b29cd72d55d3a7b9da70abac76f61c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mxvkV17H5X8Kc6msvSwb6tfTnk2tqyahJq"
        ]
      }
    }
  ]
}

68  Bitcoin / Development & Technical Discussion / Re: Bitcoin core “bad-txns-in-belowout” on: January 13, 2018, 01:04:01 PM
the complete raw transaction hex string can be seen below:
 
ubuntu:$ ./bitcoin-cli -regtest decoderawtransaction 01000000015b1544826bccad06ffa14902877fd367dd74289e8460bf9eb90da6315941462100000 000db00483045022100d8cc7539af4eb0e779434098ee5a5fb61d0de3947aafda0b5bc36b97c944 c50602201dfc82f276f8fc23ae3b8926a893c3a0abb9c42a75c8d1f274ab7a9b7c90c76d0148304 5022100d8cc7539af4eb0e779434098ee5a5fb61d0de3947aafda0b5bc36b97c944c50602201dfc 82f276f8fc23ae3b8926a893c3a0abb9c42a75c8d1f274ab7a9b7c90c76d0147522103d01115d54 8e7561b15c38f004d734633687cf4419620095bc5b0f47070afe85a2103d01115d548e7561b15c3 8f004d734633687cf4419620095bc5b0f47070afe85a52ae000000000260e31600000000001976a 914dd100be7d9aea5721158ebde6d6a1fd8fff93bb188ac60e31600000000001976a914dd100be7 d9aea5721158ebde6d6a1fd8fff93bb188ac00000000

Sending this raw transaction gives "bad-txns-in-belowout" error.

The funding transaction was created using bitcoin-cli generatetoaddress  command.
69  Bitcoin / Development & Technical Discussion / Re: Bitcoin core “bad-txns-in-belowout” on: January 13, 2018, 12:39:51 PM
as the address is "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL ", it looks like you are on testnet, or even on regtest?
I couldn't find the tx number in any of the testnet explorers.

Did you create the previous tx, from which you want to spend?


Yes, the address is on regtest.
70  Bitcoin / Development & Technical Discussion / Bitcoin core “bad-txns-in-belowout” on: January 13, 2018, 11:36:30 AM
When i want to send a raw transaction, i got the error of “bad-txns-in-belowout”.

Using decoderawtransaction, i got the txid of the only one vin, and the value of two vout are set at 0.015 BTC.
 
./bitcoin-cli -regtest decoderawtransaction "hexvalue"
{
  "txid": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "hash": "35d2e765217d71db34fd0cd1cf52f419fc525069ac87ed9f413b194851c70849",
  "version": 1,
  "size": 338,
  "vsize": 338,
  "locktime": 0,
  "vin": [
    {
      "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
      "vout": 0,
'''
    }
  "vout": [
    {
      "value": 0.01500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 dd100be7d9aea5721158ebde6d6a1fd8fff93bb1 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914dd100be7d9aea5721158ebde6d6a1fd8fff93bb188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n1fprNxRhWrpkJ34A4cNsSZbHsnzhob2KL"
        ]
      }
    },
    {
      "value": 0.01500000,
      "n": 1,
...
    }
}

Using the command, i can see the amount and fee of vin.

./bitcoin-cli -regtest gettransaction 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b
{
  "amount": -0.08000000,
  "fee": -0.00100000,
  "confirmations": 0,
  "trusted": true,
  "txid": "2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244155b",
...
}
   
Is there a command to check the output 0 value of txid 2146415931a60db99ebf60849e2874dd67d37f870249a1ff06adcc6b8244‌​155b ? It is the txid of vin.
71  Bitcoin / Development & Technical Discussion / Re: main() in bitcoin-tx.cpp on: November 13, 2017, 05:19:18 AM
So in "bitcoin-tx -create in=0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b:0 ...."
The 0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b is the txid.

Thank you.

We can use the command "bitcoin-tx -create --help"  to see the explanation of the options in the command.
72  Bitcoin / Development & Technical Discussion / Re: main() in bitcoin-tx.cpp on: November 12, 2017, 01:40:31 PM
What about the in format ? what is 0fb9df56..... ? It is previous tx or scriptSig?
Read https://bitcoin.org/en/developer-reference#raw-transaction-format

I read the link about raw transaction format. It says raw transaction has version, tx_in count, Tx_in, TX_out count, Tx_out and lock time.

I can't relate this format to the hex value in the input part.
73  Bitcoin / Bitcoin Discussion / Re: Simple bitcoin core tutorial on: November 12, 2017, 02:26:23 AM
You are welcome. I shall continue to write when i have time.

It is updated. Welcome to check it
https://embedded-design-vic.blogspot.com/
74  Bitcoin / Development & Technical Discussion / Re: Pay to Script Hash on: November 12, 2017, 02:24:38 AM
where are the bitcoin core files that handle P2SH transaction ?

i figure it out.
75  Bitcoin / Development & Technical Discussion / Re: main() in bitcoin-tx.cpp on: November 12, 2017, 02:22:41 AM
Thank you. Now I use the bitcoin-tx binary.

bitcoin-tx -create in=0fb9df5614be8b33be0434ce4062750d83f1b7ce05cc1296604f82eb9abf802b:0 outscript=0.00159999:"DUP HASH160 0x14 0x6793a38f79b8cd51dbb6face6dc75a4af5c1bf29 EQUALVERIFY CHECKSIG"

and got the return value
02000000012b80bf9aeb824f609612cc05ceb7f1830d756240ce3404be338bbe1456dfb90f00000 00000ffffffff01ff700200000000001976a9146793a38f
79b8cd51dbb6face6dc75a4af5c1bf2988ac00000000

i understand the outscript format. 0.00159999 is the value to be spent. What about the in format ? what is 0fb9df56..... ? It is previous tx or scriptSig?
76  Bitcoin / Development & Technical Discussion / Re: Pay to Script Hash on: November 11, 2017, 03:14:24 PM
where are the bitcoin core files that handle P2SH transaction ?
77  Bitcoin / Development & Technical Discussion / Re: Pay to Script Hash on: November 11, 2017, 01:25:43 PM
Looks like the formatting is a bit shuffled, can't get it clearly.
 
I try to draw the table row and column line, but i don't know how to draw the line using the post reply formatter.

Quote
(from Andreas' book "Mastering Bitcoin"):
The two scripts are combined in two stages. First, the redeem script is checked against the locking script to make sure the hash matches.
I found his book online, the scripting chapter is at
https://github.com/bitcoinbook/bitcoinbook/blob/second_edition/ch07.asciidoc

78  Bitcoin / Development & Technical Discussion / Pay to Script Hash on: November 11, 2017, 08:06:27 AM
For P2SH, i understand it lets the sender funds a transaction using 20 byte hash. The script supplied to redeem must hash to the scriptHash.

scriptPubKey: OP_HASH160 <scriptHash> OP_EQUAL
scriptSig: 0 <sig1> ... <script> OP_m <pubKey1> ... OP_n OP_CHECKMULTISIG

For this example, the processing is:

The checking process:
Stack   Script   Description
Empty.0 <sig1> <sig2> OP_2 <pubKey1> <pubKey2> <pubKey3> OP_3 OP_CHECKMULTISIG OP_HASH160 <scriptHash> OP_EQUAL   locking script combined with redeem script
0 <sig1> <sig2> OP_2 <pubKey1> <pubKey2> <pubKey3> OP_3   OP_CHECKMULTISIG OP_HASH160 <scriptHash> OP_EQUAL   Constants are added to the stack.
trueOP_HASH160 <scriptHash> OP_EQUAL   Signatures validated in the order of the keys in the script.

what happens after OP_CHECKMULTISIG, what value does OP_HASH160 hash to?



79  Bitcoin / Development & Technical Discussion / Re: Pay to public key hash on: November 11, 2017, 07:24:12 AM

The scriptSig part is what the receiver uses to spend the money that they got from pay-to-public-key-hash. Because they're spending the money, at that point they'd be the new sender. The <pubKey> for this new transaction hashes to the receiver's <pubKeyHash> from the old transaction when they first got the money.


Thank you very much. finally understand it.
80  Bitcoin / Development & Technical Discussion / Re: Pay to public key hash on: November 11, 2017, 02:26:34 AM
next to bitcoin.org and the developpers section and  Andreas' book "Mastering Bitcoin", this helped me alot to understand the underlying details:
http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html



I read the link. I am still not clear. In
scriptPubKey: OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG
scriptSig: <sig> <pubKey>

The scriptSig contains the <sig> sender signature and <pubKey> sender public key, the scriptPubKey contains <pubKeyHash> which is the hash of receiver public key.

Then, how can the hash of sender <pubKey> matches with the receiver <pubKeyHash>  ?
Pages: « 1 2 3 [4] 5 6 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!