Bitcoin Forum
May 24, 2024, 06:21:34 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Posting Transaction with C# NBitcoin  (Read 307 times)
Mz88 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
November 04, 2017, 09:26:05 PM
 #1

Hy Everybody,

I have to admit that i am new to blockchain and bitcoin, butt this is what happend.
I used the NBitcoin Core = C# Object for creating bitcoin transactions.

I run throug the book == Great book, awsome explanation:
https://programmingblockchain.gitbooks.io/programmingblockchain/content/foreword.html

And created the transaction below:

{
  "hash": "129ebc483d161ffd1c1897f53a7d5818b84df938e10a96866d066f3d6e520712",
  "ver": 1,
  "vin_sz": 1,
  "vout_sz": 2,
  "lock_time": 0,
  "size": 225,
  "in": [
    {
      "prev_out": {
        "hash": "64c1fe8c9ebc8193b5f876e7aefdf5099661faaba3b73c6901f7433818ca5572",
        "n": 0
      },
      "scriptSig": "304402201642ec85f742462944f844dc80189cf028e88d4e984a1dec97f4103d87890e0c0220164 7ed9ace9bd04e3587294d16ab91d537c40979d7f7304c27d9e2ffb17e16ba01 0388739ebff541314d8aef003affa1482af9c6977e701ed55caf5cf2c7b9ddb234"
    }
  ],
  "out": [
    {
      "value": "0.00496229",
      "scriptPubKey": "OP_DUP OP_HASH160 a2d0096799fad13e61318a2e5fb7fa7b8e0c3ebf OP_EQUALVERIFY OP_CHECKSIG"
    },
    {
      "value": "0.00474081",
      "scriptPubKey": "OP_DUP OP_HASH160 d0a63ce1772ee44ff5d3330e790a6e7e0d6ae94a OP_EQUALVERIFY OP_CHECKSIG"
    }
  ]
}

And i posted it on the network via:

//BroadcastResponse broadcastResponse = client.Broadcast(transaction).Result

It returns:

//Success! You can check out the hash of the transaciton in any block explorer: 129ebc483d161ffd1c1897f53a7d5818b84df938e10a96866d066f3d6e520712

Now i tried to find the transcation, but without any succes.
Could u guys guide me in the right direction, cause i can't seem to find the error in this transaction.

Thanks in advance,

Best regards,

Mathias

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6648


Just writing some code


View Profile WWW
November 05, 2017, 03:36:40 AM
 #2

You transaction is completely invalid and a double spend.

Your transaction spends from the 0'th output of 64c1fe8c9ebc8193b5f876e7aefdf5099661faaba3b73c6901f7433818ca5572 which has a value of 0.00496229 BTC. However you are creating two outputs with values 0.00496229 and 0.00474081. However this is clearly invalid because the value of your outputs is greater than the value of your inputs (i.e. spending more money than you are allowed to).

Furthermore, the input that you are spending was spent in 3e342736e6c2472327c8d925e56f02b213f2d79a65015957a2f1b68d8ecda9cd which is already confirmed, so your transaction is a double spend and thus even more invalid.

Mz88 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
November 05, 2017, 01:01:10 PM
 #3

You transaction is completely invalid and a double spend.

Your transaction spends from the 0'th output of 64c1fe8c9ebc8193b5f876e7aefdf5099661faaba3b73c6901f7433818ca5572 which has a value of 0.00496229 BTC. However you are creating two outputs with values 0.00496229 and 0.00474081. However this is clearly invalid because the value of your outputs is greater than the value of your inputs (i.e. spending more money than you are allowed to).

Furthermore, the input that you are spending was spent in 3e342736e6c2472327c8d925e56f02b213f2d79a65015957a2f1b68d8ecda9cd which is already confirmed, so your transaction is a double spend and thus even more invalid.

Thanks a lot man !
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!