Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double spending ? #23

Closed
fe1t opened this issue Mar 9, 2018 · 4 comments
Closed

Double spending ? #23

fe1t opened this issue Mar 9, 2018 · 4 comments

Comments

@fe1t
Copy link

fe1t commented Mar 9, 2018

============ Block 03336ca7d60ba5344265de897b055fc2472681524a1751679c6ec17dc734ae70 ============
Height: 2
Prev. block: 09d26e7629fb8f5918faf0623351ba1f5740406fe29e6b433522b7441b34958e
PoW: true

--- Transaction e734d0dd763d10f1e4bb175bad312de1de51a6f08e7ddbc18300412f003f4654:
     Input 0:
       TXID:      598b4e12b0bd16e87f7cdd108a4361c27c147e943fe7742a807dd3d8d0a7f2db
       Out:       0
       Signature: 9802715ce2c6be6b5893c0ad6e77e13b9d6cf1a798b85e7597665edb297cf1e5f2af34a5c43235276bfd3215e6f3d1bf7e063538cec33d07e0b4e1dfce03e335
       PubKey:    7f3310fd561c9d414b9869c31431b649b304cf0177c743c9c3932584e9421102069a563840f3d076070a47c36479f56aa0453451e29e67b3e113c8d86ffa64a8
     Output 0:
       Value:  2
       Script: cf4459389be8f77df9ac2d41bb29e80f5f4120d0
     Output 1:
       Value:  8
       Script: 12facdbb0eb291427b4b9a4745b2553c5e659dc2
--- Transaction 3bb3cd1345d276e8e76345c8aa109089c9f06d37f471f0603e97fd38bdb88905:
     Input 0:
       TXID:      598b4e12b0bd16e87f7cdd108a4361c27c147e943fe7742a807dd3d8d0a7f2db
       Out:       0
       Signature: 0dae57ad9c2385a0977a758c4b0fb184a44cdf0558d768653b4b8669a47814c9c0df39a64fe913a8cab653b90a3cbbae2c56c92520da66892d522863e11f31b6
       PubKey:    7f3310fd561c9d414b9869c31431b649b304cf0177c743c9c3932584e9421102069a563840f3d076070a47c36479f56aa0453451e29e67b3e113c8d86ffa64a8
     Output 0:
       Value:  1
       Script: c9f24de063058507e8ada37a93b02e8f02218ebf
     Output 1:
       Value:  9
       Script: 12facdbb0eb291427b4b9a4745b2553c5e659dc2
--- Transaction e9e68fb36ddb0fb40f6dd7f24f2a867f33eb692c435765398257f8cc8e46cd55:
     Input 0:
       TXID:
       Out:       -1
       Signature:
       PubKey:    64353138386533393361346434363432306636316136333861636634386463656562343236643430
     Output 0:
       Value:  10
       Script: 85d3eb79bdacda199724477c03807f64de9db9ce
$ ./blockchain_go getbalance -address 12jMcbWjGr9nPKj4QvKGyjgDyLeBqwLjeG
Balance of '12jMcbWjGr9nPKj4QvKGyjgDyLeBqwLjeG': 17

As you can see, transaction input (598b4e12b0bd16e87f7cdd108a4361c27c147e943fe7742a807dd3d8d0a7f2db) was used 2 times.
Assume I have 3 wallets: A(10 coins), B(0 coins), C(0 coins). then i'm trying to send from A -> B(1 coins) and A -> C(2 coins).
first transaction: A -> B (1 coins) and A -> A (9 coins)
second transaction: A -> C (2 coins) and A -> A (8 coins)
that will result A will have 17 coins instead of having only 7 coins left.
A(17 coins), B(1 coin), C(2 coins) ??
P.S. both transactions happened in NODE_ID=3001
P.S.2 NODE_ID=3002 was miner node.

@alexwishes
Copy link

Same issue as you, I think it's a bug.
But this project is considered as a tutorial, bugs can be accepted...

@fe1t
Copy link
Author

fe1t commented Mar 16, 2018

Okay, but do you have any solution for the case?
I've been trying to fix the bug many days but still got no luck :'(

@alexwishes
Copy link

Sorry, I only treat it as a tutorial and give it up...
I'll start to learn ethereum's code next step

@acehow
Copy link

acehow commented Apr 23, 2018

It's just a tutorial. In real bitcoin, there need 6 more confirms to write blocks to chain.
And only longest chain will be affected. That's why bitcoin transaction speed is so low.
This tutorial not teach us those content.

@fe1t fe1t closed this as completed Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants