blockcypher / blockcypher-python

Python library for the BlockCypher web services
https://www.blockcypher.com/dev/bitcoin
Apache License 2.0
215 stars 123 forks source link

Create $ pip3 install blockcypher$ pip3 install blockcypher #170

Open Spunky13184 opened 2 days ago

Spunky13184 commented 2 days ago

   import requests
   from flask import Flask, request, jsonify

   app = Flask(__name__)

   # Replace with your actual values
   API_TOKEN = 'ca48b6efcdb240d1bfa01e8c7643bc01'  # BlockCypher API token
   ADDRESS = 'bc1q4m6yfqwlu6gwq20fuxrx37p7kze9a2fnts5aq0'  # Your cryptocurrency address
   WEBHOOK_URL = 'https://abc123.ngrok.io/webhook'  # Replace with your actual Ngrok URL

   def create_webhook():
       """Create a webhook with BlockCypher."""
       url = 'https://api.blockcypher.com/v1/btc/main/hooks'
       data = {
           "url": WEBHOOK_URL,
           "event": "tx-confirmation