上QQ阅读APP看书,第一时间看更新
Method 2 – build a raw bitcoin transaction in JavaScript
At this point, I would guess that you want to write some code. Your wish is my command.
In this section, we will build a simple Node.Js script to perform what we have performed manually before: to send a raw transaction over the testnet. You can stop running Electrum and Bitcoin Core, as we will use an online REST API (chain.so/api) as a middle tier to interact with bitcoin's network.
By using an online API, we are losing the biggest advantage of blockchain: d isintermediation. Instead of trusting our own blockchain copy, we have to trust a third party to read the data for us and send the transaction on our behalf. What would happen if the service provider provided wrong or outdated data?