Repository navigation
Spend your coin remake - #104
Conversation
Changed many things including the followings: * changed the tutorial to make sure that they use the TestNet first * fixed all the links the TestNet blockchain explorer * re-did the tutorial myself, and replaced the addresses your more recent ones * adjusted the bitcoin amounts in the transactions to reflect the price/fee changes * also changed the amount to make it easier to follow the logic * fixed the link title for the CodeProject articles * created a new image to reflect the changes of BTC amounts
Changed wording according to issue ProgrammingBlockchain#93
| What happens to the remaining **70 µBTC**? This is the _miner fee_. | ||
| The miner fee incentivizes the miners to add this transaction into their next block. The higher the miner fee the more motivated the miner is to include your transaction in the next block, meaning that your transaction will be confirmed faster. If you set the miner fee to zero, your transaction might never be confirmed. | ||
|
|
||
|  |
There was a problem hiding this comment.
I don't like the new illustration. There is no consensus on uBTC. Plus the miner fee was previously illustrated by having a smaller coin that goes for the miner.
There was a problem hiding this comment.
Hmm, interesting, I thought that the different sizes for the icons were just a mistake, it looked funny and pixelarated to me. Alright, I can change it back to various sizes. The amount of the miner fee was missing from the previous version, that wasn't intentional I suppose?
There was a problem hiding this comment.
It was intentional, denoting "it's so small, it doesn't matter." Unfortunately it's not the case anymore :(
There was a problem hiding this comment.
Agree with @nopara73 about the size, I think you could use bits though.
There was a problem hiding this comment.
Ok, so I'll change the size of the coins back and I'll use bits instead on uBTC.
| So now that you know what a **bitcoin address**, a **ScriptPubKey**, a **private key** and a **miner** are, you will make your first **transaction** by hand. | ||
|
|
||
| As you proceed through this lesson you will add code line by line as it is presented to build a method that will leave feedback for the book in a Twitter style message. | ||
| As you proceed through this lesson you will add code line by line as it is presented to build a method that will leave feedback for the book in a Twitter style message. I _highly recommend_ you to follow the instructions first on the TestNet and after do them again on the Main Bitcoin network. |
There was a problem hiding this comment.
Mainnet practice is more memorable. If you have money on the line you are more inclined to pay attention.
There was a problem hiding this comment.
I agree, but all the samples in the chapter were and are on TestNet, so to avoid confusion I wanted to make clear that it is better to start with the testnet and then go on and repeat them on mainnet.
There was a problem hiding this comment.
On my side I am OK with switching to testnet. The first chapter is still using Mainnet which is enough to "feel" your money on the line. Also now, with the high fees, such experience everywhere could be very costly. :)
There was a problem hiding this comment.
Ah wait! This is the first chapter.
|
|
||
| ```cs | ||
| var network = Network.Main; | ||
| // Replace this with Network.Main to do this on Bitcoin MainNet |
| ``` | ||
|
|
||
| Note the **bitcoinPrivateKey** and the **address**, send some coins there and note the transaction id \(you can find it, probably, in your wallet software or with a blockexplorer, like [blockchain.info](http://blockchain.info/)\). | ||
| Note that we use the TestNet first, but you will probably do this on the MainNet as well, so you are going to spend real money! **Be careful!** In any case, write down the **bitcoinPrivateKey** and the address! Send a few dollars of coins there and save the transaction ID \(you can find it in your wallet software or with a blockexplorer, like [blockchain.info](http://blockchain.info/) for MainNet or [blockcypher.com](https://live.blockcypher.com) for both MainNet and TestNet). |
There was a problem hiding this comment.
Same comment about mainnet vs testnet as above. Also I believe the "be careful, pay attention" is unnecessary hand holding. If they got to this point they must be aware of the risks. Also personally I prefer recommending SmartBit, instead of blockchain.info or blockcypher, since it's written with NBitcoin, and its API is vastly superior to every other bc explorer api.
There was a problem hiding this comment.
Alright, I'll remove the be careful line, I thought that it's better to err on the safe side, but it's probably unnecessary.
Regarding SmartBit: I didn't know that you prefer that, I just found a comment (#1) yesterday after created this pull request. I'll change all the links to that, no problem.
Please note, that it is terribly slow from Europe at the moment, I hope it's much better from overseas.
There was a problem hiding this comment.
+1000 for using smartbit instead on Blockchain info!
|
|
||
| Console.WriteLine(bitcoinPrivateKey); // cSZjE4aJNPpBtU6xvJ6J4iBzDgTmzTjbq8w2kqnYvAprBCyTsG4x | ||
| Console.WriteLine(address); // mzK6Jy5mer3ABBxfHdcxXEChsn3mkv8qJv | ||
| Console.WriteLine(bitcoinPrivateKey); |
There was a problem hiding this comment.
I believe, leaving a comment on the expected output is a good practice, since most people will not follow the book while coding.
There was a problem hiding this comment.
Alright, I can agree on this one too. The only reason I thought that it is not so important here, because the user will have different values when he is doing the exercise (because of the different private key he generated for himself).
I'll put it back.
| TxOut changeTxOut = new TxOut() | ||
| { | ||
| Value = new Money((decimal)0.4999, MoneyUnit.BTC), | ||
| Value = new Money(530, MoneyUnit.Bit), |
| * the currently advised mining fee, | ||
| * you may consider to increase or decrease it. | ||
| */ | ||
| var minerFee = new Money(70, MoneyUnit.Bit); |
|
|
||
| Now add your feedback! This must be less than 40 bytes, or it will crash the application. | ||
| This feedback, along with your transaction will appear \(after your transaction is confirmed\) in the [Hall of The Makers](http://n.bitcoin.ninja/). | ||
| Now add your personal feedback! This must be less than 80 bytes or your transaction will be rejected. |
There was a problem hiding this comment.
Isn't it maximum 80 bytes?
There was a problem hiding this comment.
Let's pay attention to the details :)
There was a problem hiding this comment.
You mean the right wording would be "less then or equal to"?
| ```json | ||
| { | ||
| "hash": "b7803df4b90fd615532bcbdb3b63eb1af5a2e4ae36f29a6fbf9f57d0a1842e0a", | ||
| "hash": "579ae72016c02691a9e47258d65705575d0a6a5f265b137c67ef6be7b2a35659", |
There was a problem hiding this comment.
Please pay attention for these to be consistent. I'm kind of confused during this review so I'm not sure I requested modification in the previous lines or not.
There was a problem hiding this comment.
That's again different because of the new transaction with the new values. It is consistent with the data in the block explorer.
| Let's check out the **hash** of **prev\_out** in a blockexplorer: [http://tbtc.blockr.io/api/v1/tx/info/e44587cf08b4f03b0e8b4ae7562217796ec47b8c91666681d71329b764add2e3](http://tbtc.blockr.io/api/v1/tx/info/e44587cf08b4f03b0e8b4ae7562217796ec47b8c91666681d71329b764add2e3) | ||
| In **prev\_out** **n** is 1. Since we are indexing from 0, this means I want to spend the second output of the transaction. | ||
| In the blockexplorer we can see the corresponding address is `mzK6Jy5mer3ABBxfHdcxXEChsn3mkv8qJv` and I can get the scriptSig from the address like this: | ||
| Let's check out the **hash** of **prev\_out** in a TestNet blockexplorer: [prev\_out tx details](https://live.blockcypher.com/btc-testnet/tx/0acb6e97b228b838049ffbd528571c5e3edd003f0ca8ef61940166dc3081b78a/). You can see that 0.001 BTC, so 1'000 µBTC was transferred to our address. |
There was a problem hiding this comment.
As I said SmartBit would be nicer.
|
|
||
| ```cs | ||
| var hallOfTheMakersAddress = BitcoinAddress.Create("mzp4No5cmCXjZUpf112B1XWsvWBfws5bbB"); | ||
| var hallOfTheMakersAddress = BitcoinAddress.Create("mzp4No5cmCXjZUpf112B1XWsvWBfws5bbB", Network.TestNet); |
There was a problem hiding this comment.
NBitcoin is intelligent enough to know it is testnet without hint, but it is better practice to specify it.
|
Ok so in overall I think:
|
* Removed the "be careful" expression * Replaced all blockchain explorer links with SmartBit * Added back the console output comments * Fixed a few typos * Rewrote the unit description section * Changed microBTC to bits * Modified the SpendTx.png picture
|
I hope it got better, let me know what other changes you would prefer. |
|
@nopara73 seems good to you? |
|
@NicolasDorier Maybe. It's a little confusing. I let you decide. Issue 1: Fix typos. Anyway, if you really want to go with bits then so be it, I'm strongly against it, but I respect the consensus. |
|
BTC is fine with me too, I just need to spare a little time to change it back. You guys are the experts, so now that you have an agreement on it and you think bits are confusing then I remove it, no problem at all. Would you like me to remove the units section that introduces bits and satoshis as well? @nopara73 After we started to talk about this PR I realized that I made a mistake by not splitting it into a few smaller ones, so I will definitely take your advice next time :) I'll do the changes in the next few days as soon as I have a time for it. I just need a quick reply from you guys, if you want to keep the unit introduction section. Thanks! |
|
@andrasfuchs As I said I am strongly against it. But if Nicolas insist to bits, so be it, I don't think it's that important to go to war for it. |
|
@andrasfuchs yes you can introduce bits and satoshi. I am quite 50/50% on using Bit or BTC in examples. Someone throw a coin! @andrasfuchs let us know when ready to merge. |
Changed bits to BTC
|
@NicolasDorier @nopara73 I changed the text, please check it out. I'm leaving for 2 weeks tomorrow morning and I will have very limited internet access, but I will try my best if you need me to change anything else. Thank you for your patience! |
Changed many things including the followings: