{"id":16234,"date":"2021-08-28T18:39:02","date_gmt":"2021-08-28T13:09:02","guid":{"rendered":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/?p=16234"},"modified":"2022-05-06T10:53:43","modified_gmt":"2022-05-06T05:23:43","slug":"python-bitcoinlib","status":"publish","type":"post","link":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/","title":{"rendered":"The Ultimate Guide on Python-Bitcoinlib"},"content":{"rendered":"\n<p>We&#8217;re all familiar with the powerful network of Bitcoin and the way it utilizes transactions. Each of these transactions has a different hash that can be used to verify these transactions. Even though there are multiple ways of using blockchain development and smart contracts (by using solidarity), if you&#8217;re trying to make a system on bitcoin data structure and protocol, then python-bitcoinlib is the best way to use it.<\/p>\n\n\n\n<p><strong>python-bitcoinlib is a python library created by <a href=\"https:\/\/github.com\/petertodd\/python-bitcoinlib\/\" rel=\"noreferrer noopener nofollow\" target=\"_blank\">Peter Todd<\/a> to support the bitcoin data structure and use the workflow in the same way as bitcoin. This module has different classes to handle the data structures and validation processes. In this post, we&#8217;ll look at some examples in this library and try to understand them.<\/strong><\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #990303;color:#990303\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #990303;color:#990303\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#How_to_Install_python-bitcoinlib\" title=\"How to Install python-bitcoinlib?\">How to Install python-bitcoinlib?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#Operating_Chain\" title=\"Operating Chain\">Operating Chain<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#Examples_of_python-bitcoinlib\" title=\"Examples of python-bitcoinlib\">Examples of python-bitcoinlib<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#1_Create_a_SSL_RPC_Connection\" title=\"1. Create a SSL RPC Connection\">1. Create a SSL RPC Connection<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#2_Verify_Base58_Hash\" title=\"2. Verify Base58 Hash\">2. Verify Base58 Hash<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#3_Sign_A_Message_Using_Python-Bitcoinlib\" title=\"3. Sign A Message Using Python-Bitcoinlib\">3. Sign A Message Using Python-Bitcoinlib<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#4_Generate_Signature_Hash_For_a_Transaction\" title=\"4. Generate Signature Hash For a Transaction\">4. Generate Signature Hash For a Transaction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#4_Spend_P2PKH_Transaction\" title=\"4. Spend P2PKH Transaction\">4. Spend P2PKH Transaction<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#Final_Words\" title=\"Final Words\">Final Words<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#Trending_Python_Articles\" title=\"Trending Python Articles\">Trending Python Articles<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-how-to-install-python-bitcoinlib\"><span class=\"ez-toc-section\" id=\"How_to_Install_python-bitcoinlib\"><\/span>How to Install python-bitcoinlib?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>If you&#8217;re working on Linux, then open up your terminal and enter the following commands to install python-bitcoinlib &#8211;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo apt-get install libssl-dev\npip install python-bitcoinlib\n<\/pre><\/div>\n\n\n<p>To install the latest version from GitHub &#8211;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nsudo apt-get install libssl-dev\npip install git+https:\/\/github.com\/petertodd\/python-bitcoinlib\n<\/pre><\/div>\n\n\n<p>Make sure that you install libssl-dev. Otherwise, your SSL and TLS protocols won&#8217;t work correctly as intended.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-operating-chain\"><span class=\"ez-toc-section\" id=\"Operating_Chain\"><\/span>Operating Chain<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Currently, the module operates on the &#8216;mainnet&#8217; chain of bitcoin. This chain is used by most of the applications built on the network. But if you want to change the chain, you can do it by using the following command &#8211;<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport bitcoin\nbitcoin.SelectParams('testnet')\n<\/pre><\/div>\n\n\n<p>&#8216;mainnet&#8217;, &#8216;testnet&#8217;, and &#8216;regtest&#8217; are the available chains from which you can select.<\/p>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-mike monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-image\"><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/typeerror-cant-compare-datetime.datetime-to-datetime.date_.webp 1200w \" alt=\"[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date\" \/><\/a><\/div><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Trending<\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\">[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-examples-of-python-bitcoinlib\"><span class=\"ez-toc-section\" id=\"Examples_of_python-bitcoinlib\"><\/span>Examples of python-bitcoinlib<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-create-a-ssl-rpc-connection\"><span class=\"ez-toc-section\" id=\"1_Create_a_SSL_RPC_Connection\"><\/span>1. Create a SSL RPC Connection<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Code<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport bitcoin.rpc\n\nproxy = bitcoin.rpc.Proxy()\nprint(proxy.getnewaddress())\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$.$.$.$<\/code><\/pre>\n\n\n\n<p><strong>Explanation<\/strong>:<\/p>\n\n\n\n<p>We first start by importing the bitcoin RPC support. This way, we can handle the proxy connections and SSL over them. python-bitcoinlib handles this easily by using a global proxy setup. By calling bitcoin.rpc.Proxy() we can set a proxy over module usage. Make sure that you have the .conf file setup on \/root\/.bitcoin\/bitcoin.conf.<\/p>\n\n\n\n<p>If not, then you&#8217;ll not be able to use it. Also, make sure that you have set the RPC password correctly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-verify-base58-hash\"><span class=\"ez-toc-section\" id=\"2_Verify_Base58_Hash\"><\/span>2. Verify Base58 Hash<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Code<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom bitcoin.wallet import CBitcoinSecret\nfrom bitcoin.base58 import Base58ChecksumError\n\nkey = &quot;5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn&quot;\nkey2 = &quot;5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcnada&quot;\ntry:\n    secret = CBitcoinSecret(key)\n    print(secret)\n    secret2 = CBitcoinSecret(key2)\nexcept Base58ChecksumError:\n    print(&quot;Invalid Base 58 Key&quot;)\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn\nInvalid Base 58 Key<\/code><\/pre>\n\n\n\n<p><strong>Explanation<\/strong>:<\/p>\n\n\n\n<p>We start by importing the main class to hold the key, i.e., CBitcoinSecret. Also, import the Base58ChecksumError exception from python-bitcoinlib so that we can handle the conditions properly. <\/p>\n\n\n\n<p>In the above example, &#8220;key&#8221; is a correct Base 58 key whereas, &#8220;key2&#8221; is an incorrect Base 58 key. We&#8217;ll use the try-except block to handle the Invalid Base 58 condition. As we can see in the output, key1 is correctly parsed, whereas while parsing the key2, we get the desired exception output.<\/p>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-kilo monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Popular now<\/span><span class=\"monsterinsights-inline-popular-posts-border\" ><\/span><span class=\"monsterinsights-inline-popular-posts-border-2\" ><\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\">[Fixed] nameerror: name Unicode is not defined<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-sign-a-message-using-python-bitcoinlib\"><span class=\"ez-toc-section\" id=\"3_Sign_A_Message_Using_Python-Bitcoinlib\"><\/span>3. Sign A Message Using Python-Bitcoinlib<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"810\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/Sign-A-Message-Using-Python-Bitcoinlib-1024x810.webp\" alt=\"Sign A Message Using Python-Bitcoinlib\" class=\"wp-image-16257\" srcset=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/Sign-A-Message-Using-Python-Bitcoinlib-1024x810.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/Sign-A-Message-Using-Python-Bitcoinlib-300x237.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/Sign-A-Message-Using-Python-Bitcoinlib-768x607.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/Sign-A-Message-Using-Python-Bitcoinlib-1536x1214.webp 1536w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/Sign-A-Message-Using-Python-Bitcoinlib.webp 1801w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Code<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom bitcoin.wallet import CBitcoinSecret, P2PKHBitcoinAddress\nfrom bitcoin.signmessage import BitcoinMessage, VerifyMessage, SignMessage\n\nkey = &quot;5J3mBbAH58CpQ3Y5RNJpUKPE62SQ5tfcvU2JpbnkeyhfsYB1Jcn&quot;\nmsg = &quot;message to sign&quot;\n\nsecret = CBitcoinSecret(key)\nmessage = BitcoinMessage(msg)\nsignature = SignMessage(secret, message)\n\naddress = P2PKHBitcoinAddress.from_pubkey(secret.pub)\nmessage = BitcoinMessage(msg)\nverify = VerifyMessage(address, message, signature)\nprint('Address: %s' % address)\nprint('Message: %s' % msg)\nprint('Signature: %s' % signature)\nprint('Verified: %s' % verify)\nprint(&quot;\\n&quot;)\nprint('Verify using bitcoin core this command:')\nprint('\\n`bitcoin-cli verifymessage %s \\'%s\\' \\'%s\\'`\\n' % (address, signature.decode('ascii'), msg))\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Address: 1424C2F4bC9JidNjjTUZCbUxv6Sa1Mt62x\nMessage: message to sign\nSignature: b'HPNSvmhhD+h\/myKkU+2yCuPNzGwio8A+n0rUKYxU3m6FSDyOPWTttlN7ATpr\/5O5ibraZsB9J\/qX7oxXkFpgtpw='\nVerified: True\n\n\nVerify using bitcoin core this command:\n\n`bitcoin-cli verifymessage 1424C2F4bC9JidNjjTUZCbUxv6Sa1Mt62x 'HPNSvmhhD+h\/myKkU+2yCuPNzGwio8A+n0rUKYxU3m6FSDyOPWTttlN7ATpr\/5O5ibraZsB9J\/qX7oxXkFpgtpw=' 'message to sign'`<\/code><\/pre>\n\n\n\n<p><strong>Explanation<\/strong>:<\/p>\n\n\n\n<p>We start by creating a secret of the key by using CBitcoinSecret. Next, the message has to be created as an object of BitcoinMessage. Then, every message has to be signed with the help of the secret. This can be done by using the SignMessage() object. Now the basic signing of the message is completed.<\/p>\n\n\n\n<p>Furthermore, we verify the information by printing it in the desired format and using the VerifyMessage().<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-4-generate-signature-hash-for-a-transaction\"><span class=\"ez-toc-section\" id=\"4_Generate_Signature_Hash_For_a_Transaction\"><\/span>4. Generate Signature Hash For a Transaction<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Code<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&lt;pre class=&quot;wp-block-syntaxhighlighter-code&quot;&gt;import hashlib\n\nimport bitcoin \nfrom bitcoin.core import Hash160\nfrom bitcoin.core.script import CScript, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG, SignatureHash, SIGHASH_ALL\nfrom bitcoin.wallet import CBitcoinSecret\n\nbitcoin.SelectParams('mainnet')\n\nh = hashlib.sha256(b'wallet secret key').digest()\nseckey = CBitcoinSecret.from_secret_bytes(h)\n\n# Creating Script Pub Key\ntxin_scriptPubKey = CScript(&#x5B;OP_DUP, OP_HASH160, Hash160(seckey.pub), OP_EQUALVERIFY, OP_CHECKSIG])\n\n# Create the unsigned transaction.\ntx = CMutableTransaction(&#x5B;txin], &#x5B;txout])\n\n# Calculate the signature &lt;a href=&quot;https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-oshash-module\/&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;hash&lt;\/a&gt; for that transaction\nsighash = SignatureHash(txin_scriptPubKey, tx, 0, SIGHASH_ALL)\nprint(sighash)&lt;\/pre&gt;\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>b'\\x9eD\\xb6-\\x80o\\xc7\\x87\\x0c+Q*]z{\\xcd\\xa8\\x90.\\x13\\x01\\x17\\xc1\\xf5\\xa4\\x0e\\xb0\\x13\\x11S\\x9e\\x13'<\/code><\/pre>\n\n\n\n<p><strong>Explanation<\/strong>:<\/p>\n\n\n\n<p>Signature <a href=\"https:\/\/www.pythonpool.com\/python-oshash-module\/\" target=\"_blank\" rel=\"noopener\">Hash<\/a> is necessary to initiate any transaction. Unfortunately, there is no single-step process to generate the signature hash.<\/p>\n\n\n\n<p>Firstly, we import all the necessary functions and set the chain to &#8216;mainnet&#8217;. Then we generate a secret key by using a wallet secret key. Make sure that you create a <a href=\"https:\/\/www.pythonpool.com\/python-sha256\/\" target=\"_blank\" rel=\"noreferrer noopener\"><span style=\"text-decoration: underline;\">SHA256<\/span><\/a> of the wallet secret key. In this example, we used hashlib for this purpose. <\/p>\n\n\n\n<p>Next, we have to generate a Script Pub key by using the CScript method. And finally, you can use this script pub key to generate a signature hash by using SignatureHash() from python-bitcoinlib.<\/p>\n\n\n<div class=\"monsterinsights-inline-popular-posts monsterinsights-inline-popular-posts-beta monsterinsights-popular-posts-styled\" ><div class=\"monsterinsights-inline-popular-posts-image\"><a href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\"><img decoding=\"async\" src=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp\" srcset=\" https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-300x157.webp 300w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-1024x536.webp 1024w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal-768x402.webp 768w, https:\/\/www.pythonpool.com\/wp-content\/uploads\/2024\/01\/Solved-runtimeerror-cuda-error-invalid-device-ordinal.webp 1200w \" alt=\"[Solved] runtimeerror: cuda error: invalid device ordinal\" \/><\/a><\/div><div class=\"monsterinsights-inline-popular-posts-text\"><span class=\"monsterinsights-inline-popular-posts-label\" >Trending<\/span><div class=\"monsterinsights-inline-popular-posts-post\"><a class=\"monsterinsights-inline-popular-posts-title\"  href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\">[Solved] runtimeerror: cuda error: invalid device ordinal<\/a><\/div><\/div><\/div><p><\/p>\n\n\n<h3 class=\"wp-block-heading\" id=\"h-4-spend-p2pkh-transaction\"><span class=\"ez-toc-section\" id=\"4_Spend_P2PKH_Transaction\"><\/span>4. Spend P2PKH Transaction<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p><strong>Code<\/strong>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport hashlib\n\nimport bitcoin, bitcoin.core, bitcoin.core.script, bitcoin.core.scripteval, bitcoin.wallet\n\nbitcoin.SelectParams('mainnet')\n\nh = hashlib.sha256(b'wallet secret key').digest()\nseckey = CBitcoinSecret.from_secret_bytes(h)\n\n# lx corresponds to little endian hex\ntxid = lx('010862f9588f760b4a007cc316baa38890d5e102dc8cee923aae396260e13cb1')\nvout = 0\n\n# Create the txin structure, which includes the outpoint\ntxin = CMutableTxIn(COutPoint(txid, vout))\nprint(txin)\n\n# Creating Script Pub Key\nparam = &#x5B;OP_DUP, OP_HASH160, Hash160(seckey.pub), OP_EQUALVERIFY, OP_CHECKSIG]\ntxin_scriptPubKey = CScript(param)\n\n# Create txout object\ntxout = CMutableTxOut(0.001*COIN, CBitcoinAddress('1CaJbGDKkk2DzWNAgHs6sgMdMJZ9eXvCs7').to_scriptPubKey())\n\n# Create unsigned transaction\ntx = CMutableTransaction(&#x5B;txin], &#x5B;txout])\n\nsighash = SignatureHash(txin_scriptPubKey, tx, 0, SIGHASH_ALL)\n\nsig = seckey.sign(sighash) + bytes(&#x5B;SIGHASH_ALL])\n\ntxin.scriptSig = CScript(&#x5B;sig, seckey.pub])\n\nVerifyScript(txin.scriptSig, txin_scriptPubKey, tx, 0, (SCRIPT_VERIFY_P2SH,))\n\nprint(bitcoin.core.b2x(tx.serialize()))\n<\/pre><\/div>\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>CTxIn(COutPoint(lx('010862f9588f760b4a007cc316baa38890d5e102dc8cee923aae396260e13cb1'), 0), CScript(&#91;]), 0xffffffff)\n0100000001b13ce1606239ae3a92ee8cdc02e1d59088a3ba16c37c004a0b768f58f9620801000000006b483045022100c3e51dd0bdc949c99933aa2cadf7e7e3cfd3c4c717eee676c54d8bb01343b91e02203f0db8003d8c9fb09b6e8d35bb6ee93eec1d90b87ca6b0563295720c02bb38c5012103abb2ba802645d29cba4e1485b9458964f25b2bd5dc899e7cff2ba6db4e58e38bffffffff01a0860100000000001976a9147ef5cb5b4a195abc9acb97afaa70dcf8e594e49188ac00000000<\/code><\/pre>\n\n\n\n<p><strong>Explanation<\/strong>:<\/p>\n\n\n\n<p>P2PKH is one of the ways to transact over the network. Using the <a href=\"https:\/\/www.ibm.com\/docs\/en\/ztpf\/1.1.0.14?topic=concepts-digital-signatures\" target=\"_blank\" rel=\"noreferrer noopener\">Signature Hash<\/a> that we generated in the previous example, we can easily carry out the transaction. <\/p>\n\n\n\n<p>Firstly, we create a little-endian hex by using lx(). This txid, txin, and txout will togetherly carry out the transaction as mentioned in the example. In the end, VerifyScript() helps to check the transaction status.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-final-words\"><span class=\"ez-toc-section\" id=\"Final_Words\"><\/span>Final Words<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Blockchain Programming is one of the tricky and hard to understand things. But by useful modules and Python, you can carry out the transactions on Bitcoin data structure and protocol with ease. python-bitcoinlib has provided a good API for signing, transacting, and validating over the chain.<\/p>\n\n\n\n<p>Please let us know in the comments if you have more doubts regarding the library\/module.<\/p>\n\n\n<div class=\"monsterinsights-widget-popular-posts monsterinsights-widget-popular-posts-charlie monsterinsights-popular-posts-styled monsterinsights-widget-popular-posts-columns-1\"><h2 class=\"monsterinsights-widget-popular-posts-widget-title\"><span class=\"ez-toc-section\" id=\"Trending_Python_Articles\"><\/span>Trending Python Articles<span class=\"ez-toc-section-end\"><\/span><\/h2><ul class=\"monsterinsights-widget-popular-posts-list\"><li style=\"background-color:#91D2FA;border-color:#CD3034;\"><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-cant-compare-datetime-datetime-to-datetime-date\/\"><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" style=\"color:#000000;font-size:18px;\">[Fixed] typeerror can&#8217;t compare datetime.datetime to datetime.date<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><\/div><\/div><\/a><\/li><li style=\"background-color:#91D2FA;border-color:#CD3034;\"><a href=\"https:\/\/www.pythonpool.com\/fixed-nameerror-name-unicode-is-not-defined\/\"><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" style=\"color:#000000;font-size:18px;\">[Fixed] nameerror: name Unicode is not defined<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><\/div><\/div><\/a><\/li><li style=\"background-color:#91D2FA;border-color:#CD3034;\"><a href=\"https:\/\/www.pythonpool.com\/solved-runtimeerror-cuda-error-invalid-device-ordinal\/\"><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" style=\"color:#000000;font-size:18px;\">[Solved] runtimeerror: cuda error: invalid device ordinal<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><\/div><\/div><\/a><\/li><li style=\"background-color:#91D2FA;border-color:#CD3034;\"><a href=\"https:\/\/www.pythonpool.com\/fixed-typeerror-type-numpy-ndarray-doesnt-define-__round__-method\/\"><div class=\"monsterinsights-widget-popular-posts-text\"><span class=\"monsterinsights-widget-popular-posts-title\" style=\"color:#000000;font-size:18px;\">[Fixed] typeerror: type numpy.ndarray doesn&#8217;t define __round__ method<\/span><div class=\"monsterinsights-widget-popular-posts-meta\" ><\/div><\/div><\/a><\/li><\/ul><\/div><p><\/p>","protected":false},"excerpt":{"rendered":"<p>We&#8217;re all familiar with the powerful network of Bitcoin and the way it utilizes transactions. Each of these transactions has a different hash that can &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"The Ultimate Guide on Python-Bitcoinlib\" class=\"read-more button\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#more-16234\" aria-label=\"More on The Ultimate Guide on Python-Bitcoinlib\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":16289,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[4345],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.1 (Yoast SEO v22.4) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The Ultimate Guide on Python-Bitcoinlib - Python Pool<\/title>\n<meta name=\"description\" content=\"python-bitcoinlib is a python library created by Peter Todd to support the bitcoin data structure and use the workflow in the same way as...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Ultimate Guide on Python-Bitcoinlib\" \/>\n<meta property=\"og:description\" content=\"We&#039;re all familiar with the powerful network of Bitcoin and the way it utilizes transactions. Each of these transactions has a different hash that can be\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\" \/>\n<meta property=\"og:site_name\" content=\"Python Pool\" \/>\n<meta property=\"article:published_time\" content=\"2021-08-28T13:09:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-06T05:23:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Python Pool\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:site\" content=\"@pythonpool\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Python Pool\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\"},\"author\":{\"name\":\"Python Pool\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\"},\"headline\":\"The Ultimate Guide on Python-Bitcoinlib\",\"datePublished\":\"2021-08-28T13:09:02+00:00\",\"dateModified\":\"2022-05-06T05:23:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\"},\"wordCount\":730,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp\",\"articleSection\":[\"Module\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\",\"url\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\",\"name\":\"The Ultimate Guide on Python-Bitcoinlib - Python Pool\",\"isPartOf\":{\"@id\":\"https:\/\/www.pythonpool.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp\",\"datePublished\":\"2021-08-28T13:09:02+00:00\",\"dateModified\":\"2022-05-06T05:23:43+00:00\",\"description\":\"python-bitcoinlib is a python library created by Peter Todd to support the bitcoin data structure and use the workflow in the same way as...\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp\",\"width\":1200,\"height\":628,\"caption\":\"python-bitcoinlib\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pythonpool.com\/python-bitcoinlib\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pythonpool.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Ultimate Guide on Python-Bitcoinlib\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pythonpool.com\/#website\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"name\":\"Python Pool\",\"description\":\"Your One-Stop Python Learning Destination\",\"publisher\":{\"@id\":\"https:\/\/www.pythonpool.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pythonpool.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pythonpool.com\/#organization\",\"name\":\"Python Pool\",\"url\":\"https:\/\/www.pythonpool.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"contentUrl\":\"https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png\",\"width\":452,\"height\":185,\"caption\":\"Python Pool\"},\"image\":{\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/twitter.com\/pythonpool\",\"https:\/\/www.youtube.com\/c\/pythonpool\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998\",\"name\":\"Python Pool\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g\",\"caption\":\"Python Pool\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The Ultimate Guide on Python-Bitcoinlib - Python Pool","description":"python-bitcoinlib is a python library created by Peter Todd to support the bitcoin data structure and use the workflow in the same way as...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/","og_locale":"en_US","og_type":"article","og_title":"The Ultimate Guide on Python-Bitcoinlib","og_description":"We're all familiar with the powerful network of Bitcoin and the way it utilizes transactions. Each of these transactions has a different hash that can be","og_url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/","og_site_name":"Python Pool","article_published_time":"2021-08-28T13:09:02+00:00","article_modified_time":"2022-05-06T05:23:43+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp","type":"image\/webp"}],"author":"Python Pool","twitter_card":"summary_large_image","twitter_creator":"@pythonpool","twitter_site":"@pythonpool","twitter_misc":{"Written by":"Python Pool","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#article","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/"},"author":{"name":"Python Pool","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998"},"headline":"The Ultimate Guide on Python-Bitcoinlib","datePublished":"2021-08-28T13:09:02+00:00","dateModified":"2022-05-06T05:23:43+00:00","mainEntityOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/"},"wordCount":730,"commentCount":2,"publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#organization"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp","articleSection":["Module"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/","url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/","name":"The Ultimate Guide on Python-Bitcoinlib - Python Pool","isPartOf":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage"},"thumbnailUrl":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp","datePublished":"2021-08-28T13:09:02+00:00","dateModified":"2022-05-06T05:23:43+00:00","description":"python-bitcoinlib is a python library created by Peter Todd to support the bitcoin data structure and use the workflow in the same way as...","breadcrumb":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#primaryimage","url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp","contentUrl":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2021\/08\/The-Ultimate-Guide-on-Python-Bitcoinlib.webp","width":1200,"height":628,"caption":"python-bitcoinlib"},{"@type":"BreadcrumbList","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/python-bitcoinlib\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/"},{"@type":"ListItem","position":2,"name":"The Ultimate Guide on Python-Bitcoinlib"}]},{"@type":"WebSite","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#website","url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/","name":"Python Pool","description":"Your One-Stop Python Learning Destination","publisher":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#organization","name":"Python Pool","url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/","url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","contentUrl":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-content\/uploads\/2020\/08\/aa.png","width":452,"height":185,"caption":"Python Pool"},"image":{"@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/twitter.com\/pythonpool","https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.youtube.com\/c\/pythonpool"]},{"@type":"Person","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#\/schema\/person\/f87448ee54c0ffd2889fbf2408c18998","name":"Python Pool","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/#\/schema\/person\/image\/","url":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g","contentUrl":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/secure.gravatar.com\/avatar\/b170f9f39a7cad6ab2d2b1c4bc7b79f5?s=96&d=wavatar&r=g","caption":"Python Pool"}}]}},"_links":{"self":[{"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/16234"}],"collection":[{"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/comments?post=16234"}],"version-history":[{"count":13,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/16234\/revisions"}],"predecessor-version":[{"id":24552,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/posts\/16234\/revisions\/24552"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media\/16289"}],"wp:attachment":[{"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/media?parent=16234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/categories?post=16234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/www.pythonpool.com\/wp-json\/wp\/v2\/tags?post=16234"}],"curies":[{"name":"wp","href":"https:\/\/web.archive.org\/web\/20240926033552\/https:\/\/api.w.org\/{rel}","templated":true}]}}