{"id":13650603,"url":"https://github.com/coinspark/php-OP_RETURN","last_synced_at":"2025-04-22T18:32:04.359Z","repository":{"id":21452322,"uuid":"24770714","full_name":"coinspark/php-OP_RETURN","owner":"coinspark","description":"Simple PHP commands and library for using bitcoin OP_RETURNs.","archived":false,"fork":false,"pushed_at":"2020-03-09T03:48:54.000Z","size":34,"stargazers_count":80,"open_issues_count":7,"forks_count":58,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-08-02T02:04:25.404Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coinspark.png","metadata":{"files":{"readme":"README.txt","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-03T19:20:46.000Z","updated_at":"2022-12-30T03:07:39.000Z","dependencies_parsed_at":"2022-08-21T13:40:33.588Z","dependency_job_id":null,"html_url":"https://github.com/coinspark/php-OP_RETURN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinspark%2Fphp-OP_RETURN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinspark%2Fphp-OP_RETURN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinspark%2Fphp-OP_RETURN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinspark%2Fphp-OP_RETURN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinspark","download_url":"https://codeload.github.com/coinspark/php-OP_RETURN/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223903124,"owners_count":17222493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T02:00:38.307Z","updated_at":"2024-11-10T01:30:57.163Z","avatar_url":"https://github.com/coinspark.png","language":"PHP","funding_links":[],"categories":["PHP Libraries","Ruby Tools","awesome Bitcoin"],"sub_categories":["E-Books"],"readme":"php-OP_RETURN v2\n================\nSimple PHP commands and libraries for using OP_RETURNs in bitcoin transactions.\n\nCopyright (c) Coin Sciences Ltd - http://coinsecrets.org/\n\nMIT License (see headers in files)\n\n\nREQUIREMENTS\n------------\n* PHP 5.x or later\n* Bitcoin Core 0.9 or later\n\n\nBEFORE YOU START\n----------------\nCheck the constant settings at the top of OP_RETURN.php.\nIf you just installed Bitcoin Core, wait for it to download and verify old blocks.\nIf using as a library, include/require 'OP_RETURN.php' in your PHP script file.\n\n\nTO SEND A BITCOIN TRANSACTION WITH SOME OP_RETURN METADATA\n----------------------------------------------------------\n\nOn the command line:\n\n* php send-OP_RETURN.php \u003csend-address\u003e \u003csend-amount\u003e \u003cmetadata\u003e \u003ctestnet (optional)\u003e\n\n  \u003csend-address\u003e is the bitcoin address of the recipient\n  \u003csend-amount\u003e is the amount to send (in units of BTC)\n  \u003cmetadata\u003e is a hex string or raw string containing the OP_RETURN metadata\n             (auto-detection: treated as a hex string if it is a valid one)\n  \u003ctestnet\u003e should be 1 to use the bitcoin testnet, otherwise it can be omitted\n\n* Outputs an error if one occurred or the txid if sending was successful\n\n* Wait a few seconds then check http://coinsecrets.org/ for your OP_RETURN transaction.\n\n* Examples:\n\n  php send-OP_RETURN.php 149wHUMa41Xm2jnZtqgRx94uGbZD9kPXnS 0.001 'Hello, blockchain!'\n  php send-OP_RETURN.php 149wHUMa41Xm2jnZtqgRx94uGbZD9kPXnS 0.001 48656c6c6f2c20626c6f636b636861696e21\n  php send-OP_RETURN.php mzEJxCrdva57shpv62udriBBgMECmaPce4 0.001 'Hello, testnet!' 1\n\n\nAs a library:\n\n* OP_RETURN_send($send_address, $send_amount, $metadata, $testnet=false)\n\n  $send_address is the bitcoin address of the recipient\n  $send_amount is the amount to send (in units of BTC)\n  $metadata is a string of raw bytes containing the OP_RETURN metadata\n  $testnet is whether to use the bitcoin testnet network (false if omitted)\n\n* Returns: array('error' =\u003e '[some error string]')\n       or: array('txid' =\u003e '[sent txid]')\n\n* Examples\n\n  OP_RETURN_send('149wHUMa41Xm2jnZtqgRx94uGbZD9kPXnS', 0.001, 'Hello, blockchain!')\n  OP_RETURN_send('149wHUMa41Xm2jnZtqgRx94uGbZD9kPXnS', 0.001, 'Hello, testnet!', true)\n\n\n\nTO STORE SOME DATA IN THE BLOCKCHAIN USING OP_RETURNs\n-----------------------------------------------------\n\nOn the command line:\n\n* php store-OP_RETURN.php \u003cdata\u003e \u003ctestnet (optional)\u003e\n\n  \u003cdata\u003e is a hex string or raw string containing the data to be stored\n         (auto-detection: treated as a hex string if it is a valid one)\n  \u003ctestnet\u003e should be 1 to use the bitcoin testnet, otherwise it can be omitted\n\n* Outputs an error if one occurred or if successful, the txids that were used to store\n  the data and a short reference that can be used to retrieve it using this library.\n\n* Wait a few seconds then check http://coinsecrets.org/ for your OP_RETURN transactions.\n\n* Examples:\n\n  php store-OP_RETURN.php 'This example stores 47 bytes in the blockchain.'\n  php store-OP_RETURN.php 'This example stores 44 bytes in the testnet.' 1\n  \n  \nAs a library:\n\n* OP_RETURN_store($data, $testnet=false)\n\n  $data is the string of raw bytes to be stored\n  $testnet is whether to use the bitcoin testnet network (false if omitted)\n  \n* Returns: array('error' =\u003e '[some error string]')\n       or: array('txids' =\u003e array('[1st txid]', '[2nd txid]', ...),\n                 'ref' =\u003e '[ref for retrieving data]')\n           \n* Examples:\n\n  OP_RETURN_store('This example stores 47 bytes in the blockchain.')\n  OP_RETURN_store('This example stores 44 bytes in the testnet.', true)\n\n\n\nTO RETRIEVE SOME DATA FROM OP_RETURNs IN THE BLOCKCHAIN\n-------------------------------------------------------\n\nOn the command line:\n\n* php retrieve-OP_RETURN.php \u003cref\u003e \u003ctestnet (optional)\u003e\n\n  \u003cref\u003e is the reference that was returned by a previous storage operation\n  \u003ctestnet\u003e should be 1 to use the bitcoin testnet, otherwise it can be omitted\n  \n* Outputs an error if one occurred or if successful, the retrieved data in hexadecimal\n  and ASCII format, a list of the txids used to store the data, a list of the blocks in\n  which the data is stored, and (if available) the best ref for retrieving the data\n  quickly in future. This may or may not be different from the ref you provided.\n  \n* Examples:\n\n  php retrieve-OP_RETURN.php 356115-052075\n  php retrieve-OP_RETURN.php 396381-059737 1\n  \n  \nAs a library:\n\n* OP_RETURN_retrieve($ref, $max_results=1, $testnet=false)\n\n  $ref is the reference that was returned by a previous storage operation\n  $max_results is the maximum number of results to retrieve (in general, omit for 1)\n  $testnet is whether to use the bitcoin testnet network (false if omitted)\n\n* Returns: array('error' =\u003e '[some error string]')\n       or: array('data' =\u003e '[raw binary data]',\n                 'txids' =\u003e array('[1st txid]', '[2nd txid]', ...),\n                 'heights' =\u003e array([block 1 used], [block 2 used], ...),\n                 'ref' =\u003e '[best ref for retrieving data]',\n                 'error' =\u003e '[error if data only partially retrieved]')\n           \n           A value of 0 in the 'heights' array means some data is still in the mempool.      \n           The 'ref' and 'error' elements are only present if appropriate.\n                 \n* Examples:\n\n  OP_RETURN_retrieve('356115-052075')\n  OP_RETURN_retrieve('396381-059737', 1, true)\n  \n  \n\nVERSION HISTORY\n---------------\nv2.0.2 - 27 June 2015\n* Use Bitcoin Core getblock API to get raw block content instead of wire protocol\n\nv2.0.1 - 14 May 2015\n* More efficient checking of mempool for the first transaction in the chain\n\nv2.0 - 12 May 2015\n* Added functions for general storage and retrieval of data in the blockchain\n* Now uses Bitcoin Core JSON-RPC API (bitcoin-cli still an option), so supports Windows\n\nv1.0.2 - 9 December 2014\n* Now really fixed that issue (fixed typo in the fix!)\n\nv1.0.1 - 3 December 2014\n* Fixed issue when running under 32-bit PHP\n\nv1.0 - 3 October 2014\n* First release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinspark%2Fphp-OP_RETURN","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinspark%2Fphp-OP_RETURN","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinspark%2Fphp-OP_RETURN/lists"}