Created
April 13, 2020 11:03
-
-
Save SFzxc/7b6b69deb0ed72ef3ed83823780ec2af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pubspec.yaml | |
// dev_dependencies: | |
// dio: 3.0.9 | |
// Blocypher Docs: https://www.blockcypher.com/dev/bitcoin/?javascript#push-raw-transaction-endpoint | |
// https://github.com/flutterchina/dio#super-simple-to-use | |
import 'package:dio/dio.dart'; | |
void broadcastTx(String hex) async { | |
try { | |
Response response = await Dio().post("https://api.blockcypher.com/v1/bcy/test/txs/push?token=<your-secret-blockypher-token-here>", data: { tx: hex } ); | |
print(response); | |
} catch (e) { | |
print(e); | |
} | |
} | |
main() { | |
broadcastTx("your-tx-hex here: 01000000011935b41d12936df99d322...."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment