Skip to content

Instantly share code, notes, and snippets.

@SFzxc
Created April 13, 2020 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SFzxc/7b6b69deb0ed72ef3ed83823780ec2af to your computer and use it in GitHub Desktop.
Save SFzxc/7b6b69deb0ed72ef3ed83823780ec2af to your computer and use it in GitHub Desktop.
// 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