https://tests.bitcoin.it/w/api.php?action=feedcontributions&user=Jnewbery&feedformat=atom
Bitcoin Wiki - User contributions [en]
2024-03-28T17:55:09Z
User contributions
MediaWiki 1.30.0
https://tests.bitcoin.it/w/index.php?title=IRC_channels&diff=66647
IRC channels
2019-07-25T15:42:24Z
<p>Jnewbery: Add #bitcoin-builds and #bitcoin-core-pr-reviews</p>
<hr />
<div>Most of the following Bitcoin-related IRC channels are available on [http://www.freenode.net Freenode]:<br />
<br />
Please read: [[Bitcoin IRC Channel Guidelines]] before joining.<br />
<br />
==Bitcoin Project==<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|bitcoin}} || General Bitcoin-related discussion and support. ([[Bitcoin_IRC_Channel_Guidelines | guidelines]]).<br />
|-<br />
| {{Freenode IRC|bitcoin-builds}} || Discussion of the Bitcoin Core build system.<br />
|-<br />
| {{Freenode IRC|bitcoin-commits}} || Real-time notification of commits to Bitcoin projects.<br />
|-<br />
| {{Freenode IRC|bitcoin-core-dev}} || For development of Bitcoin Core. Log sources; [http://www.erisian.com.au/bitcoin-core-dev/ 1], [http://gnusha.org/bitcoin-core-dev/ 2]<br />
|-<br />
| {{Freenode IRC|bitcoin-core-pr-reviews}} || Weekly PR review club for discussing Bitcoin Core Pull Requests.<br />
|-<br />
| {{Freenode IRC|bitcoin-dev}} || Dead. Formerly for Bitcoin software development. ([http://bitcoinstats.com/irc/bitcoin-dev/logs/ history]. [[Bitcoin-dev | guidelines]])<br />
|-<br />
| {{Freenode IRC|bitcoin-gaming}} || Bitcoin gamers hangout.<br />
|-<br />
| {{Freenode IRC|bitcoin-gentoo}} || Gentoo community.<br />
|-<br />
| {{Freenode IRC|bitcoin-marketing}} || Marketing and promotion of bitcoin<br />
|-<br />
| {{Freenode IRC|bitcoin-news}} || RSS News related to Bitcoin.<br />
|-<br />
| {{Freenode IRC|bitcoin-politics}} || Discuss politics with other Bitcoin users.<br />
|-<br />
| {{Freenode IRC|#bitcoin-pricetalk|text=&#35;bitcoin-pricetalk}} || ALL Discussion Remotely Related to Bitcoin Price or other offtopic goes here<br />
|-<br />
| {{Freenode IRC|bitcoin-watch|text=[[Bitcoin-Watch|#bitcoin-watch]]}} || Streaming Bitcoin transactions, including market data.<br />
|-<br />
| {{Freenode IRC|bitcoin-wiki}} || Bitcoin Wiki support<br />
|-<br />
| {{Freenode IRC|bitcoin-wizards}} || Bitcoin experts and futurists ([http://gnusha.org/bitcoin-wizards/ history])<br />
|-<br />
| {{Freenode IRC|lightning-dev}} || Lightning protocol development<br />
|-<br />
| {{Freenode IRC|lnd}} || Lightning only version of #bitcoin-commits<br />
|-<br />
| {{Freenode IRC|sidechains-dev}} || Sidechains development<br />
|}<br />
<br />
===Local communities===<br />
<br />
{| class="wikitable"<br />
| {{Freenode IRC|bitcoin-otc-eu}} || European OTC trading marketplace.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-ru}} || Russian OTC trading marketplace.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-uk}} ||United kingdom OTC Trading Marketplace.Founder Angus Bates.<br />
|-<br />
| {{Freenode IRC|bitcoin-aus}} || Aussie bitcoin community.<br />
|-<br />
| {{Freenode IRC|AustinBitcoin}} || Austin, TX bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-bra}} || Brazilian bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-cad}} || Canadian bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-cn}} || Chinese bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-dk}} || Danish bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-de}} || German bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-eastcoastusa}} || East Coast USA bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-il}} || Israeli bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-nl}} || Dutch bitcoin community. <br />
|-<br />
| {{Freenode IRC|bitcoin-pl}} || Polish bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-romania}} || Romanian bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-ve}} || Venezuelan bitcoin community.<br />
|-<br />
| {{Freenode IRC|btc.chat}} || Russian bitcoin community.<br />
|-<br />
| #bitcoins.fi @ IRCNet || Finnish bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-hr}} || Croatian language bitcoin community.<br />
<br />
|}<br />
<br />
==Mining Related Communities==<br />
<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|avalon}} || Discussion and support specific to [[Avalon]] mining machine<br />
|-<br />
| {{Freenode IRC|bitcoin-mining}} || Discussion and support related to mining.<br />
|-<br />
| {{Freenode IRC|bitcoin-fpga}} || Discussion and support specific to FPGA mining.<br />
|-<br />
| {{Freenode IRC|btcguild}} || [[BTCGuild]] mining pool community<br />
|-<br />
| {{Freenode IRC|butterflylabs}} || [[Butterfly Labs]] chat<br />
|-<br />
| {{Freenode IRC|cgminer}} || Discussion and support specific to [[CGMiner]].<br />
|-<br />
| {{Freenode IRC|eligius}} || [[Eligius]] mining pool community (also support for [[BFGMiner]] and [[Eloipool]])<br />
|-<br />
| {{Freenode IRC|mining.bitcoin.cz}} || Slush's mining pool community<br />
|-<br />
| {{Freenode IRC|ozcoin}} || [[Ozco.in]] mining pool community<br />
|-<br />
| <small>[irc://irc.foonetic.net/xkcd-bitcoin IRC] [http://irc.lc/foonetic/xkcd-bitcoin/Miner@@@ Web]</small> #xkcd-bitcoin || [https://en.bitcoin.it/wiki/XKCD_Pool XKCD Pool]<br />
|-<br />
| <small>[irc://irc.quakenet.org/bitcoins.lc IRC] [http://irc.lc/quakenet/bitcoins.lc/Miner@@@ Web]</small> #bitcoins.lc @ Quakenet || [http://www.bitcoins.lc Bitcoins.lc Pool] <br />
|-<br />
| {{Freenode IRC|p2pool}} || [[P2Pool]] decentralized mining pool<br />
|-<br />
| {{Freenode IRC|bitminter}} || [[BitMinter]] Mining Pool Community<br />
|-<br />
| {{Freenode IRC|kncminer}} || [[KNCMiner]] ASIC Mining Hardware Vendor Discussion<br />
|}<br />
<br />
==Communities for Exchanges and Trading==<br />
<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|bitcoin-assets}} || Discussion of securities and other asset investments. [http://bitcoin-assets.com bitcoin-assets.com].<br />
|-<br />
| {{Freenode IRC|bitcoin-assets-trades}} || Streaming assets market data (only), no chat.<br />
|-<br />
| {{Freenode IRC|bitcoin-auction}} || Live auctions over IRC.<br />
|-<br />
| {{Freenode IRC|bitcoin-market}} || Streaming market data (only), no chat.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc|text=[[bitcoin-otc|#bitcoin-otc]]}} || Over-the-counter trading marketplace and discussion. ([http://bitcoinstats.com/irc/bitcoin-otc/logs/ history])<br />
|-<br />
| {{Freenode IRC|bitcoin-escrow}} || Third party escrow agents.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-ticker|bitcoin-otc-ticker}} || Streaming market data form the [[#bitcoin-otc]] order book.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-ratings|bitcoin-otc-ratings}} || Updates to ratings on the [[#bitcoin-otc]] Web of Trust.<br />
|-<br />
| {{Freenode IRC|bitcoin-pit}} || Only over-the-counter trading.<br />
|-<br />
| {{Freenode IRC|bitcoin-wot|bitcoin-wot}} || Distributed Web of Trust (WoT) system for [[#bitcoin-otc]].<br />
|-<br />
| {{Freenode IRC|btc.chat.traders}} || Russian community discussion about trades/exchanges.<br />
|-<br />
| {{Freenode IRC|coinbase}} || [[Coinbase]] chat<br />
|-<br />
| {{Freenode IRC|bitcoin-rt}} || Real-time tape (executed trades).<br />
|-<br />
| {{Freenode IRC|localbitcoins-chat}} || [[LocalBitcoins.com]] exchange support<br />
|-<br />
| {{Freenode IRC|Coinabul}} || [http://Coinabul.com Coinabul]'s customer support and news channel. Selling gold and silver for Bitcoin.<br />
|}<br />
<br />
==Related Communities==<br />
<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|opentransactions}} || [[Open Transactions]] project.<br />
|-<br />
| {{Freenode IRC|namecoin}} || [[Namecoin]] and the [[Dot-bit]] project.<br />
|-<br />
| {{Freenode IRC|twister}} || [[Twister]], P2P microblogging discussion.<br />
|-<br />
| {{Freenode IRC|joinmarket}} || [[JoinMarket]], A [[CoinJoin]] implementation<br />
|-<br />
| {{Freenode IRC|darkwallet}} || [[DarkWallet]] and libbitcoin/Obelisk discussion & development channel.<br />
|-<br />
| {{Freenode IRC|electrum}} || [[Electrum]], lightweight bitcoin client.<br />
|-<br />
| {{Freenode IRC|copay}} || [[Copay]], lightweight bitcoin client.<br />
|-<br />
| {{Freenode IRC|bitcoin-stackexchange}} || Discussion complementing [http://bitcoin.stackexchange.com Bitcoin StackExchange].<br />
<br />
|}<br />
<br />
==See Also==<br />
<br />
* [[Bitcoin_Wiki:Community_portal]]<br />
<br />
[[fr:Canaux IRC]]<br />
[[pl:Kanały IRC]]<br />
[[ro:Canale]]</div>
Jnewbery
https://tests.bitcoin.it/w/index.php?title=IRC_channels&diff=66646
IRC channels
2019-07-25T15:39:33Z
<p>Jnewbery: Order IRC channels alphabetically</p>
<hr />
<div>Most of the following Bitcoin-related IRC channels are available on [http://www.freenode.net Freenode]:<br />
<br />
Please read: [[Bitcoin IRC Channel Guidelines]] before joining.<br />
<br />
==Bitcoin Project==<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|bitcoin}} || General Bitcoin-related discussion and support. ([[Bitcoin_IRC_Channel_Guidelines | guidelines]]).<br />
|-<br />
| {{Freenode IRC|bitcoin-commits}} || Real-time notification of commits to Bitcoin projects.<br />
|-<br />
| {{Freenode IRC|bitcoin-core-dev}} || For development of Bitcoin Core. Log sources; [http://www.erisian.com.au/bitcoin-core-dev/ 1], [http://gnusha.org/bitcoin-core-dev/ 2]<br />
|-<br />
| {{Freenode IRC|bitcoin-dev}} || Dead. Formerly for Bitcoin software development. ([http://bitcoinstats.com/irc/bitcoin-dev/logs/ history]. [[Bitcoin-dev | guidelines]])<br />
|-<br />
| {{Freenode IRC|bitcoin-gaming}} || Bitcoin gamers hangout.<br />
|-<br />
| {{Freenode IRC|bitcoin-gentoo}} || Gentoo community.<br />
|-<br />
| {{Freenode IRC|bitcoin-marketing}} || Marketing and promotion of bitcoin<br />
|-<br />
| {{Freenode IRC|bitcoin-news}} || RSS News related to Bitcoin.<br />
|-<br />
| {{Freenode IRC|bitcoin-politics}} || Discuss politics with other Bitcoin users.<br />
|-<br />
| {{Freenode IRC|#bitcoin-pricetalk|text=&#35;bitcoin-pricetalk}} || ALL Discussion Remotely Related to Bitcoin Price or other offtopic goes here<br />
|-<br />
| {{Freenode IRC|bitcoin-watch|text=[[Bitcoin-Watch|#bitcoin-watch]]}} || Streaming Bitcoin transactions, including market data.<br />
|-<br />
| {{Freenode IRC|bitcoin-wiki}} || Bitcoin Wiki support<br />
|-<br />
| {{Freenode IRC|bitcoin-wizards}} || Bitcoin experts and futurists ([http://gnusha.org/bitcoin-wizards/ history])<br />
|-<br />
| {{Freenode IRC|lightning-dev}} || Lightning protocol development<br />
|-<br />
| {{Freenode IRC|lnd}} || Lightning only version of #bitcoin-commits<br />
|-<br />
| {{Freenode IRC|sidechains-dev}} || Sidechains development<br />
|}<br />
<br />
===Local communities===<br />
<br />
{| class="wikitable"<br />
| {{Freenode IRC|bitcoin-otc-eu}} || European OTC trading marketplace.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-ru}} || Russian OTC trading marketplace.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-uk}} ||United kingdom OTC Trading Marketplace.Founder Angus Bates.<br />
|-<br />
| {{Freenode IRC|bitcoin-aus}} || Aussie bitcoin community.<br />
|-<br />
| {{Freenode IRC|AustinBitcoin}} || Austin, TX bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-bra}} || Brazilian bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-cad}} || Canadian bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-cn}} || Chinese bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-dk}} || Danish bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-de}} || German bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-eastcoastusa}} || East Coast USA bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-il}} || Israeli bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-nl}} || Dutch bitcoin community. <br />
|-<br />
| {{Freenode IRC|bitcoin-pl}} || Polish bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-romania}} || Romanian bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-ve}} || Venezuelan bitcoin community.<br />
|-<br />
| {{Freenode IRC|btc.chat}} || Russian bitcoin community.<br />
|-<br />
| #bitcoins.fi @ IRCNet || Finnish bitcoin community.<br />
|-<br />
| {{Freenode IRC|bitcoin-hr}} || Croatian language bitcoin community.<br />
<br />
|}<br />
<br />
==Mining Related Communities==<br />
<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|avalon}} || Discussion and support specific to [[Avalon]] mining machine<br />
|-<br />
| {{Freenode IRC|bitcoin-mining}} || Discussion and support related to mining.<br />
|-<br />
| {{Freenode IRC|bitcoin-fpga}} || Discussion and support specific to FPGA mining.<br />
|-<br />
| {{Freenode IRC|btcguild}} || [[BTCGuild]] mining pool community<br />
|-<br />
| {{Freenode IRC|butterflylabs}} || [[Butterfly Labs]] chat<br />
|-<br />
| {{Freenode IRC|cgminer}} || Discussion and support specific to [[CGMiner]].<br />
|-<br />
| {{Freenode IRC|eligius}} || [[Eligius]] mining pool community (also support for [[BFGMiner]] and [[Eloipool]])<br />
|-<br />
| {{Freenode IRC|mining.bitcoin.cz}} || Slush's mining pool community<br />
|-<br />
| {{Freenode IRC|ozcoin}} || [[Ozco.in]] mining pool community<br />
|-<br />
| <small>[irc://irc.foonetic.net/xkcd-bitcoin IRC] [http://irc.lc/foonetic/xkcd-bitcoin/Miner@@@ Web]</small> #xkcd-bitcoin || [https://en.bitcoin.it/wiki/XKCD_Pool XKCD Pool]<br />
|-<br />
| <small>[irc://irc.quakenet.org/bitcoins.lc IRC] [http://irc.lc/quakenet/bitcoins.lc/Miner@@@ Web]</small> #bitcoins.lc @ Quakenet || [http://www.bitcoins.lc Bitcoins.lc Pool] <br />
|-<br />
| {{Freenode IRC|p2pool}} || [[P2Pool]] decentralized mining pool<br />
|-<br />
| {{Freenode IRC|bitminter}} || [[BitMinter]] Mining Pool Community<br />
|-<br />
| {{Freenode IRC|kncminer}} || [[KNCMiner]] ASIC Mining Hardware Vendor Discussion<br />
|}<br />
<br />
==Communities for Exchanges and Trading==<br />
<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|bitcoin-assets}} || Discussion of securities and other asset investments. [http://bitcoin-assets.com bitcoin-assets.com].<br />
|-<br />
| {{Freenode IRC|bitcoin-assets-trades}} || Streaming assets market data (only), no chat.<br />
|-<br />
| {{Freenode IRC|bitcoin-auction}} || Live auctions over IRC.<br />
|-<br />
| {{Freenode IRC|bitcoin-market}} || Streaming market data (only), no chat.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc|text=[[bitcoin-otc|#bitcoin-otc]]}} || Over-the-counter trading marketplace and discussion. ([http://bitcoinstats.com/irc/bitcoin-otc/logs/ history])<br />
|-<br />
| {{Freenode IRC|bitcoin-escrow}} || Third party escrow agents.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-ticker|bitcoin-otc-ticker}} || Streaming market data form the [[#bitcoin-otc]] order book.<br />
|-<br />
| {{Freenode IRC|bitcoin-otc-ratings|bitcoin-otc-ratings}} || Updates to ratings on the [[#bitcoin-otc]] Web of Trust.<br />
|-<br />
| {{Freenode IRC|bitcoin-pit}} || Only over-the-counter trading.<br />
|-<br />
| {{Freenode IRC|bitcoin-wot|bitcoin-wot}} || Distributed Web of Trust (WoT) system for [[#bitcoin-otc]].<br />
|-<br />
| {{Freenode IRC|btc.chat.traders}} || Russian community discussion about trades/exchanges.<br />
|-<br />
| {{Freenode IRC|coinbase}} || [[Coinbase]] chat<br />
|-<br />
| {{Freenode IRC|bitcoin-rt}} || Real-time tape (executed trades).<br />
|-<br />
| {{Freenode IRC|localbitcoins-chat}} || [[LocalBitcoins.com]] exchange support<br />
|-<br />
| {{Freenode IRC|Coinabul}} || [http://Coinabul.com Coinabul]'s customer support and news channel. Selling gold and silver for Bitcoin.<br />
|}<br />
<br />
==Related Communities==<br />
<br />
{| class="wikitable"<br />
! Channel !! Description<br />
|-<br />
| {{Freenode IRC|opentransactions}} || [[Open Transactions]] project.<br />
|-<br />
| {{Freenode IRC|namecoin}} || [[Namecoin]] and the [[Dot-bit]] project.<br />
|-<br />
| {{Freenode IRC|twister}} || [[Twister]], P2P microblogging discussion.<br />
|-<br />
| {{Freenode IRC|joinmarket}} || [[JoinMarket]], A [[CoinJoin]] implementation<br />
|-<br />
| {{Freenode IRC|darkwallet}} || [[DarkWallet]] and libbitcoin/Obelisk discussion & development channel.<br />
|-<br />
| {{Freenode IRC|electrum}} || [[Electrum]], lightweight bitcoin client.<br />
|-<br />
| {{Freenode IRC|copay}} || [[Copay]], lightweight bitcoin client.<br />
|-<br />
| {{Freenode IRC|bitcoin-stackexchange}} || Discussion complementing [http://bitcoin.stackexchange.com Bitcoin StackExchange].<br />
<br />
|}<br />
<br />
==See Also==<br />
<br />
* [[Bitcoin_Wiki:Community_portal]]<br />
<br />
[[fr:Canaux IRC]]<br />
[[pl:Kanały IRC]]<br />
[[ro:Canale]]</div>
Jnewbery
https://tests.bitcoin.it/w/index.php?title=OP_CHECKSIG&diff=66023
OP CHECKSIG
2019-01-16T21:44:21Z
<p>Jnewbery: Corrections to the sighash algorithm, and a note that sighash is calculated differently for segwit scripts.</p>
<hr />
<div>''This article describes the operation of OP_CHECKSIG in non-segwit scripts. The hash digest for OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY in segwit scripts is calculated differently, as described in [https://github.com/bitcoin/bips/blob/master/bip-0143.mediawiki BIP 143].''<br />
<br />
'''OP_CHECKSIG''' is [[Script|script]] opcode used to verify that the signature for a tx input is valid. OP_CHECKSIG expects two values to be on the stack. These are, in order of stack depth, the public key and the signature of the script. These two values are normally obtained by running the scriptSig script of the transaction input we are attempting to validate. The scriptSig script is deleted after it is run, but the stack is left as is. Then, the scriptPubKey script from the previous transaction output that is now being spent is run, generally concluding in an OP_CHECKSIG. <br />
<br />
The standard scriptPubKey checks that the public key (actually a hash of) is a particular value, and that OP_CHECKSIG passes.<br />
<br />
For normal transaction inputs, if the creator of the current transaction can successfully create a ScriptSig signature that uses the right public key for the ScriptPubKey of the transaction output they are attempting to spend, that transaction input is considered valid. <br />
<br />
== Parameters ==<br />
<br />
In addition to the stack parameters and the script code itself, in order to operate correctly OP_CHECKSIG needs to know the current transaction and the index of current transaction input.<br />
<br />
== How it works ==<br />
Firstly always this (the default) procedure is applied:<br />
[[File:Bitcoin_OpCheckSig_InDetail.png|thumb|right|Signature verification process of the default procedure]]<br />
# the public key and the signature are popped from the stack, in that order. Signature format is [<DER signature> <1 byte hash-type>]. Hashtype value is last byte of the sig.<br />
# A new subScript is created from the scriptCode (the scriptCode is the actually executed script - either the scriptPubKey for non-segwit, non-P2SH scripts, or the redeemscript in non-segwit P2SH scripts). The script from the immediately after the most recently parsed OP_CODESEPARATOR to the end of the script is the subScript. If there is no OP_CODESEPARATOR the entire script becomes the subScript<br />
# Any occurrences of sig are deleted from subScript, if present (it is ''not standard'' to have a signature in an input script of a transaction)<br />
# Any remaining OP_CODESEPARATORS are removed from subScript<br />
# The hashtype is removed from the last byte of the sig and stored<br />
# A copy is made of the current transaction (hereby referred to txCopy)<br />
# The scripts for all transaction inputs in txCopy are set to empty scripts (exactly 1 byte 0x00)<br />
# The script for the current transaction input in txCopy is set to subScript (lead in by its length as a var-integer encoded!)<br />
<br />
Now depending on the hashtype various things can happen to txCopy, these will be discussed individually.<br />
<br />
'''Hashtype Values (from script.h):'''<br />
{|class="wikitable"<br />
! Name !! Value<br />
|-<br />
| SIGHASH_ALL || 0x00000001<br />
|-<br />
| SIGHASH_NONE || 0x00000002<br />
|-<br />
| SIGHASH_SINGLE || 0x00000003<br />
|-<br />
| SIGHASH_ANYONECANPAY || 0x00000080<br />
|}<br />
<br />
<ol><br />
<li> If (hashtype&31) = SIGHASH_NONE then apply the SIGHASH_NONE-procedure<br />
<li> If (hashtype&31) = SIGHASH_SINGLE then apply the SIGHASH_SINGLE-procedure<br />
<li> If hashtype & SIGHASH_ANYONECANPAY then apply the SIGHASH_ANYONECANPAY-procedure<br />
</ol><br />
Hence, hashtype SIGHASH_ANYONECANPAY may be applied also after any other hashtype-procedure<ref>[http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.7.1/bitcoin-0.7.1-linux.tar.gz file src/src/script.cpp in bitcoin-0.7.1]</ref>. Besides the four listed hashtypes only a hashtype of value 0 appears a few times in the (main) block chain (and is handled like SIGHASH_ALL).<br />
<br />
=== Hashtype SIGHASH_ALL (default) ===<br />
<br />
No special further handling occurs in the default case. Think of this as "sign '''all''' of the outputs." Which is already done by the default procedure.<br />
<br />
=== Procedure for Hashtype SIGHASH_NONE ===<br />
<br />
# The output of txCopy is set to a vector of zero size.<br />
# All other inputs aside from the current input in txCopy have their nSequence index set to zero<br />
<br />
Think of this as "sign '''none''' of the outputs-- I don't care where the bitcoins go."<br />
<br />
=== Procedure for Hashtype SIGHASH_SINGLE ===<br />
<br />
# The output of txCopy is resized to the size of the current input index+1.<br />
# All other txCopy outputs aside from the output that is the same as the current input index are set to a blank script and a value of (long) -1.<br />
# All other txCopy inputs aside from the current input are set to have an nSequence index of zero.<br />
<br />
Think of this as "sign '''one''' of the outputs-- I don't care where the other outputs go".<br />
<br />
Note: The transaction that uses SIGHASH_SINGLE type of signature should not have more inputs than outputs.<br />
However if it does (because of the pre-existing implementation), it shall not be rejected, but instead for every "illegal" input (meaning: an input that has an index bigger than the maximum output index) the node should still verify it, though assuming the hash of 0000000000000000000000000000000000000000000000000000000000000001 [https://bitcointalk.org/index.php?topic=260595.0]<br />
<br />
=== Procedure for Hashtype SIGHASH_ANYONECANPAY ===<br />
<br />
# The txCopy input vector is resized to a length of one.<br />
# The current transaction input (with scriptPubKey modified to subScript) is set as the first and only member of this vector.<br />
<br />
Think of this as "Let other people add inputs to this transaction, I don't care where the rest of the bitcoins come from."<br />
<br />
===Final signature check===<br />
<br />
An array of bytes is constructed from the serialized txCopy appended by four bytes for the hash type. This array is sha256 hashed twice, then the public key is used to check the supplied signature against the hash.<br />
The secp256k1 elliptic curve is used for the verification with the given public key.<br />
<br />
== Return values ==<br />
<br />
OP_CHECKSIG will push true to the stack if the check passed, false otherwise.<br />
OP_CHECKSIG_VERIFY leaves nothing on the stack but will cause the script eval to fail immediately if the check does not pass.<br />
<br />
== Code samples and raw dumps ==<br />
<br />
Taking the first transaction in Bitcoin which is in block number 170, we would get after serialising the transaction but before we hash+sign (or verify) it:<br />
<br />
* http://blockexplorer.com/block/00000000d1145790a8694403d4063f323d499e655c83426834d4ce2f8dd4a2ee<br />
* http://blockexplorer.com/tx/f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16<br />
<br />
See also [https://gitorious.org/libbitcoin/libbitcoin libbitcoin] for code samples.<br />
<br />
<pre><br />
01 00 00 00 version<br />
01 number of inputs (var_uint)<br />
<br />
input 0:<br />
c9 97 a5 e5 6e 10 41 02 input transaction hash (from block 9)<br />
fa 20 9c 6a 85 2d d9 06 <br />
60 a2 0b 2d 9c 35 24 23 <br />
ed ce 25 85 7f cd 37 04<br />
00 00 00 00 input index (index of txout in block 9 that's being spent)<br />
<br />
48 size of script (var_uint)<br />
47 push 71 bytes to stack<br />
30 44 02 20 4e 45 e1 69<br />
32 b8 af 51 49 61 a1 d3<br />
a1 a2 5f df 3f 4f 77 32<br />
e9 d6 24 c6 c6 15 48 ab<br />
5f b8 cd 41 02 20 18 15<br />
22 ec 8e ca 07 de 48 60<br />
a4 ac dd 12 90 9d 83 1c<br />
c5 6c bb ac 46 22 08 22<br />
21 a8 76 8d 1d 09 01<br />
ff ff ff ff sequence<br />
<br />
02 number of outputs (var_uint)<br />
<br />
output 0:<br />
00 ca 9a 3b 00 00 00 00 amount = 10.00000000<br />
43 size of script (var_uint)<br />
script for output 0:<br />
41 push 65 bytes to stack<br />
04 ae 1a 62 fe 09 c5 f5 <br />
1b 13 90 5f 07 f0 6b 99 <br />
a2 f7 15 9b 22 25 f3 74 <br />
cd 37 8d 71 30 2f a2 84 <br />
14 e7 aa b3 73 97 f5 54 <br />
a7 df 5f 14 2c 21 c1 b7 <br />
30 3b 8a 06 26 f1 ba de <br />
d5 c7 2a 70 4f 7e 6c d8 <br />
4c <br />
ac OP_CHECKSIG<br />
<br />
output 1:<br />
00 28 6b ee 00 00 00 00 amount = 40.00000000<br />
43 size of script (var_uint)<br />
script for output 1:<br />
41 push 65 bytes to stack<br />
04 11 db 93 e1 dc db 8a <br />
01 6b 49 84 0f 8c 53 bc <br />
1e b6 8a 38 2e 97 b1 48 <br />
2e ca d7 b1 48 a6 90 9a<br />
5c b2 e0 ea dd fb 84 cc <br />
f9 74 44 64 f8 2e 16 0b <br />
fa 9b 8b 64 f9 d4 c0 3f <br />
99 9b 86 43 f6 56 b4 12 <br />
a3 <br />
ac OP_CHECKSIG<br />
<br />
00 00 00 00 locktime<br />
01 00 00 00 hash_code_type (added on)<br />
<br />
result =<br />
01 00 00 00 01 c9 97 a5 e5 6e 10 41 02 fa 20 9c 6a 85 2d d9 06 60 a2 0b 2d 9c 35 <br />
24 23 ed ce 25 85 7f cd 37 04 00 00 00 00 43 41 04 11 db 93 e1 dc db 8a 01 6b 49 <br />
84 0f 8c 53 bc 1e b6 8a 38 2e 97 b1 48 2e ca d7 b1 48 a6 90 9a 5c b2 e0 ea dd fb <br />
84 cc f9 74 44 64 f8 2e 16 0b fa 9b 8b 64 f9 d4 c0 3f 99 9b 86 43 f6 56 b4 12 a3 <br />
ac ff ff ff ff 02 00 ca 9a 3b 00 00 00 00 43 41 04 ae 1a 62 fe 09 c5 f5 1b 13 90 <br />
5f 07 f0 6b 99 a2 f7 15 9b 22 25 f3 74 cd 37 8d 71 30 2f a2 84 14 e7 aa b3 73 97 <br />
f5 54 a7 df 5f 14 2c 21 c1 b7 30 3b 8a 06 26 f1 ba de d5 c7 2a 70 4f 7e 6c d8 4c <br />
ac 00 28 6b ee 00 00 00 00 43 41 04 11 db 93 e1 dc db 8a 01 6b 49 84 0f 8c 53 bc <br />
1e b6 8a 38 2e 97 b1 48 2e ca d7 b1 48 a6 90 9a 5c b2 e0 ea dd fb 84 cc f9 74 44 <br />
64 f8 2e 16 0b fa 9b 8b 64 f9 d4 c0 3f 99 9b 86 43 f6 56 b4 12 a3 ac 00 00 00 00 <br />
01 00 00 00 <br />
</pre><br />
<br />
To understand where that raw dump has come from, it may be useful to examine tests/ec-key.cpp in [https://gitorious.org/libbitcoin/libbitcoin libbitcoin],<br />
<br />
[https://gitorious.org/libbitcoin/libbitcoin libbitcoin] has a unit test under tests/ec-key.cpp (make ec-key && ./bin/tests/ec-key). There is also a working OP_CHECKSIG implementation in src/script.cpp under script::op_checksig(). See also the unit test: tests/script-test.cpp<br />
<br />
<source lang="cpp"><br />
#include <iostream><br />
#include <iomanip><br />
#include <bitcoin/util/serializer.hpp><br />
#include <bitcoin/util/elliptic_curve_key.hpp><br />
#include <bitcoin/util/sha256.hpp><br />
#include <bitcoin/util/assert.hpp><br />
#include <bitcoin/util/logger.hpp><br />
#include <bitcoin/types.hpp><br />
#include <openssl/ecdsa.h><br />
#include <openssl/obj_mac.h><br />
using libbitcoin::elliptic_curve_key;<br />
using libbitcoin::serializer;<br />
using libbitcoin::hash_digest;<br />
using libbitcoin::data_chunk;<br />
using libbitcoin::log_info;<br />
using libbitcoin::log_fatal;<br />
<br />
int main()<br />
{<br />
serializer ss;<br />
// blk number 170, tx 1, input 0<br />
// version = 1<br />
ss.write_4_bytes(1);<br />
// 1 inputs<br />
ss.write_var_uint(1);<br />
<br />
// input 0<br />
// prevout hash<br />
ss.write_hash(hash_digest{0x04, 0x37, 0xcd, 0x7f, 0x85, 0x25, 0xce, 0xed, 0x23, 0x24, 0x35, 0x9c, 0x2d, 0x0b, 0xa2, 0x60, 0x06, 0xd9, 0x2d, 0x85, 0x6a, 0x9c, 0x20, 0xfa, 0x02, 0x41, 0x10, 0x6e, 0xe5, 0xa5, 0x97, 0xc9});<br />
// prevout index <br />
ss.write_4_bytes(0);<br />
<br />
// input script after running OP_CHECKSIG for this tx is a single<br />
// OP_CHECKSIG opcode<br />
data_chunk raw_data;<br />
raw_data = {0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3};<br />
data_chunk raw_script;<br />
raw_script = data_chunk();<br />
raw_script.push_back(raw_data.size());<br />
libbitcoin::extend_data(raw_script, raw_data);<br />
raw_script.push_back(172);<br />
ss.write_var_uint(raw_script.size());<br />
ss.write_data(raw_script);<br />
// sequence<br />
ss.write_4_bytes(0xffffffff);<br />
<br />
// 2 outputs for this tx<br />
ss.write_var_uint(2);<br />
<br />
// output 0<br />
ss.write_8_bytes(1000000000);<br />
// script for output 0<br />
raw_data = {0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, 0x71, 0x30, 0x2f, 0xa2, 0x84, 0x14, 0xe7, 0xaa, 0xb3, 0x73, 0x97, 0xf5, 0x54, 0xa7, 0xdf, 0x5f, 0x14, 0x2c, 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c};<br />
// when data < 75, we can just write it's length as a single byte ('special'<br />
// opcodes)<br />
raw_script = data_chunk();<br />
raw_script.push_back(raw_data.size());<br />
libbitcoin::extend_data(raw_script, raw_data);<br />
// OP_CHECKSIG<br />
raw_script.push_back(172);<br />
// now actually write the script<br />
ss.write_var_uint(raw_script.size());<br />
ss.write_data(raw_script);<br />
<br />
// output 1<br />
ss.write_8_bytes(4000000000);<br />
// script for output 0<br />
raw_data = {0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3};<br />
// when data < 75, we can just write it's length as a single byte ('special'<br />
raw_script.push_back(raw_data.size());<br />
libbitcoin::extend_data(raw_script, raw_data);<br />
// OP_CHECKSIG<br />
raw_script.push_back(172);<br />
// now actually write the script<br />
ss.write_var_uint(raw_script.size());<br />
ss.write_data(raw_script);<br />
<br />
// End of 2 outputs<br />
<br />
// locktime<br />
ss.write_4_bytes(0);<br />
<br />
// write hash_type_code<br />
ss.write_4_bytes(1);<br />
<br />
// Dump hex to screen<br />
log_info() << "hashing:";<br />
{<br />
auto log_obj = log_info();<br />
log_obj << std::hex;<br />
for (int val: ss.get_data())<br />
log_obj << std::setfill('0') << std::setw(2) << val << ' ';<br />
}<br />
log_info();<br />
<br />
data_chunk raw_tx = {0x01, 0x00, 0x00, 0x00, 0x01, 0xc9, 0x97, 0xa5, 0xe5, 0x6e, 0x10, 0x41, 0x02, 0xfa, 0x20, 0x9c, 0x6a, 0x85, 0x2d, 0xd9, 0x06, 0x60, 0xa2, 0x0b, 0x2d, 0x9c, 0x35, 0x24, 0x23, 0xed, 0xce, 0x25, 0x85, 0x7f, 0xcd, 0x37, 0x04, 0x00, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, 0xac, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0xca, 0x9a, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, 0xae, 0x1a, 0x62, 0xfe, 0x09, 0xc5, 0xf5, 0x1b, 0x13, 0x90, 0x5f, 0x07, 0xf0, 0x6b, 0x99, 0xa2, 0xf7, 0x15, 0x9b, 0x22, 0x25, 0xf3, 0x74, 0xcd, 0x37, 0x8d, 0x71, 0x30, 0x2f, 0xa2, 0x84, 0x14, 0xe7, 0xaa, 0xb3, 0x73, 0x97, 0xf5, 0x54, 0xa7, 0xdf, 0x5f, 0x14, 0x2c, 0x21, 0xc1, 0xb7, 0x30, 0x3b, 0x8a, 0x06, 0x26, 0xf1, 0xba, 0xde, 0xd5, 0xc7, 0x2a, 0x70, 0x4f, 0x7e, 0x6c, 0xd8, 0x4c, 0xac, 0x00, 0x28, 0x6b, 0xee, 0x00, 0x00, 0x00, 0x00, 0x43, 0x41, 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3, 0xac, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00};<br />
BITCOIN_ASSERT(raw_tx == ss.get_data());<br />
<br />
hash_digest tx_hash = libbitcoin::generate_sha256_hash(ss.get_data());<br />
<br />
data_chunk pubkey{0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, 0xf6, 0x56, 0xb4, 0x12, 0xa3};<br />
// Leave out last byte since that's the hash_type_code (SIGHASH_ALL in this<br />
// case)<br />
data_chunk signature{0x30, 0x44, 0x02, 0x20, 0x4e, 0x45, 0xe1, 0x69, 0x32, 0xb8, 0xaf, 0x51, 0x49, 0x61, 0xa1, 0xd3, 0xa1, 0xa2, 0x5f, 0xdf, 0x3f, 0x4f, 0x77, 0x32, 0xe9, 0xd6, 0x24, 0xc6, 0xc6, 0x15, 0x48, 0xab, 0x5f, 0xb8, 0xcd, 0x41, 0x02, 0x20, 0x18, 0x15, 0x22, 0xec, 0x8e, 0xca, 0x07, 0xde, 0x48, 0x60, 0xa4, 0xac, 0xdd, 0x12, 0x90, 0x9d, 0x83, 0x1c, 0xc5, 0x6c, 0xbb, 0xac, 0x46, 0x22, 0x08, 0x22, 0x21, 0xa8, 0x76, 0x8d, 0x1d, 0x09};<br />
BITCOIN_ASSERT(signature.size() == 70);<br />
<br />
elliptic_curve_key key;<br />
if (!key.set_public_key(pubkey))<br />
{<br />
log_fatal() << "unable to set EC public key";<br />
return -1;<br />
}<br />
<br />
log_info() << "checksig returns: " << (key.verify(tx_hash, signature) ? "true" : "false");<br />
return 0;<br />
}<br />
<br />
</source><br />
<br />
==References==<br />
<references/><br />
<br />
[[Category:Technical]]<br />
[[Category:Developer]]<br />
{{DISPLAYTITLE:OP_CHECKSIG}}</div>
Jnewbery