forked from coinspark/php-OP_RETURN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
56 lines (33 loc) · 2.01 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
php-OP_RETURN v1.0
A simple PHP script to generate OP_RETURN bitcoin transactions.
Please use this responsibly and DO NOT bloat the blockchain!
Copyright (c) 2014 Coin Sciences Ltd - http://coinspark.org/
MIT License (see headers in files)
REQUIREMENTS:
* PHP 5.x or later
* bitcoin-cli installed on the server (does not use JSON-RPC)
* Must be run as a user who is permitted to run bitcoin-cli
USAGE ON THE COMMAND LINE:
* Ensure CONST_BITCOIN_CMD and CONST_BITCOIN_FEE in php-OP_RETURN.php are correct.
* php send-OP_RETURN.php <send-address> <send-amount> <metadata> <testnet (optional)>
- <send-address> is the bitcoin address of the recipient
- <send_amount> is the amount to send (in units of BTC)
- <metadata> is a hex string or raw string containing the OP_RETURN metadata
(auto-detection: treated as a hex string if it is a valid one)
- <testnet> should be 1 to use the bitcoin testnet, otherwise it can be omitted
- Outputs an error if one occurred or the txid if sending was successful
* Examples:
php send-OP_RETURN.php 149wHUMa41Xm2jnZtqgRx94uGbZD9kPXnS 0.001 'Hello, blockchain!'
php send-OP_RETURN.php 149wHUMa41Xm2jnZtqgRx94uGbZD9kPXnS 0.001 48656c6c6f2c20626c6f636b636861696e21
php send-OP_RETURN.php mzEJxCrdva57shpv62udriBBgMECmaPce4 0.001 'Hello, testnet blockchain!' 1
* Wait a few seconds then check http://coinsecrets.org/ for your OP_RETURN transaction.
USAGE AS A LIBRARY:
* Ensure CONST_BITCOIN_CMD and CONST_BITCOIN_FEE in php-OP_RETURN.php are correct.
* Include/require 'php-OP_RETURN.php' in another script.
* coinspark_OP_RETURN_send($send_address, $send_amount, $metadata, $testnet=false)
- $send_address is the bitcoin address of the recipient
- $send_amount is the amount to send (in units of BTC)
- $metadata is a string of raw bytes containing the OP_RETURN metadata
- $testnet is whether to use the bitcoin testnet
- Returns: array('error' => '[some error string]') OR array('txid' => '[sent txid]')
* Wait a few seconds then check http://coinsecrets.org/ for your OP_RETURN transaction.