BitcoinJS
簡介:
操作相關bitcoin的API提供者
https://blockexplorer.com/api-ref
https://github.com/blockchain/service-my-wallet-v3 (此為跑在自己local端的server)
https://blockchain.info/api/blockchain_api
https://chainquery.com/bitcoin-api/getinfo
https://github.com/bitcoinj/bitcoinj (Java寫的Bitcoin核心 也可使用Nashore來執行javascript)
https://www.smartbit.com.au/api
直接與本地的Bitcoind 啟動的JSON-RPC溝通
https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)使用BitcoinJS
範例:
npm install bitcoinjs-lib產生隨機地址
產生一組萊特幣的address跟WIF
之後可到此確認https://live.blockcypher.com/ltc/
把WIF格式的私鑰轉換為地址
產生多重簽章的地址2-of-3 multisig P2SH address
https://en.bitcoin.it/wiki/Multisignature
產生交易
產生較複雜的交易,並廣播到Bitcoin Test Network
之後會看到如下輸出
進入到此網站https://live.blockcypher.com/btc-testnet
然後在右上角輸入地址 即可查看剛才的交易紀錄(需要稍等一段時間)
查看上次交易的Txid:
到上面網站的輸入框輸入你的比特幣地址即可看到
把產生的交易hex廣播到bitcoin network
先到
https://live.blockcypher.com/btc/pushtx/
(另外一個廣播交易的blockchain.info其廣播後的訊息較不明確,只會產生例如code=-25,-26等訊息,blockcypher會明確顯示原因)
1.貼上如下 (此為確實發生的以前交易,但unspend已經被花掉了)
接著
2.試看看如下
(此為確實發生的以前交易,已經發生過此交易,但unspend尚存在)
3.然後試著把一些字隨便改掉上按送出看看
Last updated
Was this helpful?