{"id":13425566,"url":"https://github.com/ffsolutions/php-algorand-sdk","last_synced_at":"2025-03-15T20:30:45.380Z","repository":{"id":43305266,"uuid":"344343210","full_name":"ffsolutions/php-algorand-sdk","owner":"ffsolutions","description":"A PHP library (SDK) for interacting with the Algorand network.","archived":false,"fork":false,"pushed_at":"2023-08-23T16:34:12.000Z","size":3699,"stargazers_count":21,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-01-24T04:14:06.873Z","etag":null,"topics":["algod","algorand","algorand-algod","algorand-codeigniter","algorand-indexer","algorand-kmd","algorand-laravel","algorand-lumen","algorand-network","algorand-php","algorand-php-sdk","algorand-symfony","algorand-yii","api","indexer","kmd","php","php-algorand-sdk","sdk","wallet"],"latest_commit_sha":null,"homepage":"https://github.com/ffsolutions/php-algorand-sdk","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ffsolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-03-04T03:55:35.000Z","updated_at":"2024-01-24T04:14:06.874Z","dependencies_parsed_at":"2024-01-03T05:26:30.675Z","dependency_job_id":null,"html_url":"https://github.com/ffsolutions/php-algorand-sdk","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffsolutions%2Fphp-algorand-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffsolutions%2Fphp-algorand-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffsolutions%2Fphp-algorand-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffsolutions%2Fphp-algorand-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ffsolutions","download_url":"https://codeload.github.com/ffsolutions/php-algorand-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243790926,"owners_count":20348377,"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":["algod","algorand","algorand-algod","algorand-codeigniter","algorand-indexer","algorand-kmd","algorand-laravel","algorand-lumen","algorand-network","algorand-php","algorand-php-sdk","algorand-symfony","algorand-yii","api","indexer","kmd","php","php-algorand-sdk","sdk","wallet"],"created_at":"2024-07-31T00:01:14.930Z","updated_at":"2025-03-15T20:30:45.373Z","avatar_url":"https://github.com/ffsolutions.png","language":"PHP","funding_links":[],"categories":["Development \u0026 Tools","Development Tools"],"sub_categories":["Language SDKs \u0026 Tools","Languages"],"readme":"# PHP Algorand SDK 2.0 (algod, algokey, kmd, transactions and indexer)\n\nA Pure PHP (no dependencies) library for interacting with the Algorand network.\n\nAll files in this directory will show you about the best pratices that you should do when implementing  **php-algorand-sdk** into your project.\n\n\n## Requirements\n- PHP 7.3 and above.\n- Built-in libcurl support.\n- Algorand node, algod, kmd, indexer or PureStake\n\n## Frameworks Compatibility\nThis SDK was developed to support several PHP Frameworks, tested with:\n- **Native Frameworks**\n- **FFS**\n- **Laravel**\n- **Lumen**\n- **Yii**\n- **Codeigniter**\n- **Symfony**\n\n\nIn the **sdk** folder you will find the setup suggestions.\n\n\n## Quick start\n\nFor running this example, you need to install `php-algorand-sdk` library before, and start the node.\n```\n$ git clone https://github.com/ffsolutions/php-algorand-sdk\n$ ./goal node start -d data\n$ ./goal kmd start -d data\n$ ./algorand-indexer daemon -h -d data\n```\n\n\nAfter cloning the repository, you need to include the `php-algorand-sdk`:\n```php\nrequire_once 'sdk/algorand.php';\nrequire_once 'sdk/algokey.php';\n\n#OR with namespace include\n\nuse App\\Algorand\\algorand;\nuse App\\Algorand\\transactions;\nuse App\\Algorand\\algokey;\nuse App\\Algorand\\b32;\nuse App\\Algorand\\msgpack;\n\n```\n\nFor use the **algod**:\n```php\n# Node\n$algorand = new Algorand(\"algod\",\"{algod-token}\",\"localhost\",53898); //get the token key in data/algod.admin.token\n\n# PureStake\n$algorand = new Algorand(\"algod\",\"{pure-stake-token}\",\"mainnet-algorand.api.purestake.io/ps2\",0,true); //External PureStake\n\n$return=$algorand-\u003eget(\"v2\",\"status\");\nprint_r($return);\n\n```\n(see all avaliable functions in **algod.php**)\n\n\nFor use the **kmd**:\n```php\n#Node only\n$algorand_kmd = new  Algorand(\"kmd\",\"{kmd-token}\",\"localhost\",7833); //get the token key in data/kmd-{version}/kmd.token and port in data/kmd-{version}/kmd.net\n$return=$algorand_kmd-\u003eget(\"versions\");\nprint_r($return);\n```\n(see all avaliable functions in **kmd.php**)\n\n\nFor use the **indexer**:\n```php\n#Node\n$algorand_indexer = new Algorand(\"indexer\",\"{algorand-indexer-token}\",\"localhost\",8089);\n\n#PureStake\n$algorand_indexer = new Algorand(\"indexer\",\"{pure-stake-token}\",\"mainnet-algorand.api.purestake.io/idx2\",0,true); //true for External PureStake\n\n$return=$algorand_indexer-\u003eget(\"health\");\nprint_r($return);\n```\n(see all avaliable functions in **indexer.php**)\n\nFor use the **algokey**:\n```php\n$algokey=new  algokey;\n\n$key=$algokey-\u003egenerate();\nprint_r($key);\n```\n(see all avaliable functions in **algokey.php**)\n\nFor use the **transactions**:\n```php\n$algorand_transactions = new  Algorand_transactions;\n#Build and Sign a transaction, for details: https://developer.algorand.org/docs/features/transactions\n\n#Payment Transaction (ALGO)\n\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"pay\", //Tx Type\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 27151092, //First Valid\n                \"gen\" =\u003e \"mainnet-v1.0\", // GenesisID\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 27152092, //Last Valid\n                \"note\" =\u003e \"Testes\", //You note\n                \"snd\" =\u003e \"3DKZLYQJXSUAE7ZCFZN7ODZSOA6733PI5BFM4L7WI4S3K6KEVOOA6KDN2I\", //Sender\n                \"rcv\" =\u003e \"IYVZLDFIF6KUMSDFVIKHPBT3FI5QVZJKJ6BPFSGIJDUJGUUASKNRA4HUHU\", //Receiver\n                \"amt\" =\u003e 1000, //Amount\n            ),\n);\n\n```\n(see all avaliable functions in **transactions.php**)\n\n## Vídeo Tutorial\n\n[![PHP Algorand SDK Vídeo Tutorial](https://img.youtube.com/vi/7ZoDY6av1-4/0.jpg)](https://www.youtube.com/watch?v=7ZoDY6av1-4)\n\nhttps://www.youtube.com/watch?v=7ZoDY6av1-4\n\n\n## Application Examples\nSee at examples folder.\n\nhttps://github.com/ffsolutions/php-algorand-sdk/tree/main/examples\n\n![Algorand Wallet PHP GUI](https://raw.githubusercontent.com/ffsolutions/php-algorand-sdk/main/examples/wallet-gui/preview.png \"Algorand Wallet PHP GUI\")\nhttps://www.youtube.com/watch?v=Ju1f5MrwJKA\n\n![Algorand Asset Manager PHP GUI](https://raw.githubusercontent.com/ffsolutions/php-algorand-sdk/main/examples/asset-manager-gui/preview.png)\nhttps://www.youtube.com/watch?v=b__DhRzAex0\n\n![Algorand Explorer PHP GUI](https://raw.githubusercontent.com/ffsolutions/php-algorand-sdk/main/examples/explorer-gui/preview.png)\nhttps://www.youtube.com/watch?v=b__DhRzAex0\n\n\n## Complete Guide\n\n### Node setup (macOS and Linux)\nVerified on macOS Monterey 12.5.1 and Ubuntu 22.04\n\nFor other cases, follow the instructions in Algorand's [developer resources](https://developer.algorand.org/docs/run-a-node/setup/install/) to install a node on your computer.\n\n### Steps:\n- 1- Installing Algorand Node\n- 2- Installing Algorand Indexer\n- 3- Installing and Using the **PHP Algorand SDK**\n\n\n\n### For macOS and Linux:\nCreate a temporary folder to hold the install package and files:\n```\n$ mkdir ~/node\n$ cd ~/node\n```\n\n\nDownload the updater script:\n\n#### macOS\n```\n$ curl https://raw.githubusercontent.com/algorand/go-algorand/rel/stable/cmd/updater/update.sh -O\n```\n\n#### Linux\n```\n$ wget https://raw.githubusercontent.com/algorand/go-algorand/rel/stable/cmd/updater/update.sh\n```\n\nEnsure that your system knows it's an executable file:\n```\n$ chmod 744 update.sh\n```\n\n\nRun the installer from within your node directory:\n```\n$ ./update.sh -i -c stable -p ~/node -d ~/node/data -n\n```\n\n\nCreate and change the config.json\n```\n$ cp data/config.json.example data/config.json\n$ chmod 777 data/config.json\n$ cp data/kmd-v{version}/kmd_config.json.example data/kmd-v{version}/kmd_config.json\n$ chmod 777 data/kmd-v{version}/kmd_config.json\n$ vim data/config.json\n```\n\n\nChange the line, press I to enable edition, make changes, press ESC and type :w + [enter], :q + [enter] to finish.\n```\n\"EndpointAddress\": \"127.0.0.1:0\",  \nto\n\"EndpointAddress\": \"127.0.0.1:53898\",\n```\n\n\nStart Node:\n```\n./goal node start -d data\n./goal kmd start -d data\n./algorand-indexer daemon -P \"host=127.0.0.1 port=5432 user={user} password={password} dbname=algorand sslmode=disable\"  --no-algod\n```\n\n\nTo see if the node is running:\n```\n$ htop\n```\nPress F10 to close the htop\n\n\n\n### Sync Node Network using Fast Catchup\nFast Catchup is a new feature and will rapidly update a node using catchpoint snapshots. A new command on goal node is now available for catchup. The entire process should sync a node in minutes rather than hours or days.\n\n\n### Get the catchpoint\n```\n$ wget -qO- https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/mainnet/latest.catchpoint\n```\n\n\nUse the sync point captured above and paste into the catchup option\n```\n./goal node catchup 12400000#ZHHAYEVVUXHMDVIRFUFQLI7DUUMJAEDCJN7WPG6OD4DRBBIWK5UA -d data\n```\n\n\nNode Status:\n``\n./goal node status -d data\n``\nResults should show 5 Catchpoint status lines for Catchpoint, total accounts, accounts processed, total blocks , downloaded blocks.\nNotice that the 5 Catchpoint status lines will disappear when completed, and then only a few more minutes are needed so sync from that point to the current block. ***Once there is a Sync Time of 0, the node is synced and if fully usable***.\n```\nLast committed block: 11494\nSync Time: 58.1s\nCatchpoint: 12400000#ZHHAYEVVUXHMDVIRFUFQLI7DUUMJAEDCJN7WPG6OD4DRBBIWK5UA\nCatchpoint total accounts: 9133629\nCatchpoint accounts processed: 7786496\nCatchpoint accounts verified: 0\nGenesis ID: mainnet-v1.0\nGenesis hash: wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\n```\n\n## Installing the Algorand Indexer\n\nFor more details: https://developer.algorand.org/docs/run-a-node/setup/indexer/\n\n## Installing and Using the Algorand PHP SDK\nGet the node tokens and address:\n```\n$ cat data/algod.token\n$ cat data/kmd-{version}/kmd.token\n$ cat data/kmd-{version}/kmd.net\n```\n\n\nClone Git Hub Project\n```\n$ git clone https://github.com/ffsolutions/php-algorand-sdk.git\n```\n\n\nAfter cloning the repository, you need to include the `php-algorand-sdk`:\n```php\nrequire_once 'sdk/algorand.php';\nrequire_once 'sdk/algokey.php';\nrequire_once 'sdk/transactions.php';\n\n#OR with namespace include\n\nuse App\\Algorand\\algorand;\nuse App\\Algorand\\algokey;\nuse App\\Algorand\\transactions;\nuse App\\Algorand\\b32;\nuse App\\Algorand\\msgpack;\n```\n\n## For use the **Algokey**:\n\n### Start the Algokey\n```php\n$algokey=new  algokey;\n```\n\n### Generate New Key/Account/Address\n```php\n$key=$algokey-\u003egenerate();\nprint_r($key);\necho \"Words to string: \".implode(\" \",$key['words']).\"\\n\";\n```\n\n### Words to Private Key and Public Key (Array)\n```php\n$words=explode(\" \",\"connect produce defense output sibling idea oil siege decline dentist faint electric method notice style cook unlock rice confirm host tone test vehicle able keen\"); //2OEZACD77WSR5C2HFEHO2BYHQEATOGFIUW3REGKOGNPPNYPPLROHDU2CQE\n$privateKey=$algokey-\u003eWordsToPrivateKey($words); //Array\n$privateKey_decoded=base64_decode($privateKey);\n$publicKey=$algokey-\u003epublicKeyFromPrivateKey($privateKey);\n$publicKey_decoded=$algokey-\u003epublicKeyFromPrivateKey($privateKey,false);\necho \"Private Key: \".$privateKey.\"\\n\";\necho \"Private Key decoded: \".$privateKey_decoded.\"\\n\";\necho \"Public Key B32: \".$publicKey.\"\\n\";\necho \"Public Key decoded: \".$publicKey_decoded.\"\\n\";\n```\n\n### Private Key to Words\n```php\n$privateKey=\"eenqctbZ48E5E8jHoc6jdhTGW/q6L3BP7l3gJnJ+P17TiZAIf/2lHotHKQ7tBweBATcYqKW3EhlOM1724e9cXA==\";\n$return_words=$algokey-\u003eprivateKeyToWords($privateKey);\nprint_r($return_words);\necho \"Words: \".implode(\" \",$return_words).\"\\n\";\n```\n\n### Sign Transaction with Algokey PHP\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"pay\", //Tx Type\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 28237321, //First Valid\n                \"gen\" =\u003e \"mainnet-v1.0\", // GenesisID\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 28238321, //Last Valid\n                \"note\" =\u003e \"\", //You note\n                \"snd\" =\u003e \"2QAXTOHQJQH6I4FM6RWUIISXKFJ2QA4NVWELMIJ5XAKZB4N4XIEX7F5KPU\", //Sender\n                \"rcv\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Receiver\n                \"amt\" =\u003e 1003, //Amount\n            ),\n);\n\n$transaction_raw=$algorand_transactions-\u003eencode($transaction);\n$signature=$algokey-\u003esign($transaction_raw,$privateKey);\n```\n\n### Broadcasts a raw transaction to the network.\n```php\n$transaction_raw_signed=$algorand_transactions-\u003eencode($transaction,true,$signature);\n\n$algorand = new Algorand(\"algod\",\"4820e6e45f339e0026eaa2b74c2aa7d8735cbcb2db0cf0444fb492892e1c09b7\",\"localhost\",53898);\n$params['transaction']=$transaction_raw_signed;\nprint_r($params);\n$return=$algorand-\u003epost(\"v2\",\"transactions\",$params);\nprint_r($return);\n```\n\n## For use the **Algod**:\nStart the SDK\n```php\n#Node\n$algorand = new  Algorand(\"algod\",'{algod-token}',\"localhost\",53898); //get the token key in data/algod.token\n\n#PureStake\n$algorand = new Algorand(\"algod\",\"{pure-stake-token}\",\"mainnet-algorand.api.purestake.io/ps2\",0,true); //true for External PureStake\n```\n\n### Get the versions\n```php\n$return=$algorand-\u003eget(\"versions\");\n```\n\n\n### Gets the current node status.\n```php\n$return=$algorand-\u003eget(\"v2\",\"status\");\n```\n\n\n### Gets the node status after waiting for the given round.\n```php\n$return=$algorand-\u003eget(\"v2\",\"status\",\"wait-for-block-after\",{block});\n```\n\n### Gets the genesis information.\n```php\nreturn=$algorand-\u003eget(\"genesis\");\n```\n\n### Returns 200 (OK) if healthy.\n```php\n$return=$algorand-\u003eget(\"health\");\n```\n\n### Return metrics about algod functioning.\n```php\n$return=$algorand-\u003eget(\"metrics\");\n```\n\n### Gets the current swagger spec.\n```php\n$return=$algorand-\u003eget(\"swagger.json\");\n```\n\n### Get account information and balances.\n```php\n$return=$algorand-\u003eget(\"v2\",\"accounts\",\"{address}\",\"?exclude=none\u0026?format=json\"); //?exclude=none or all. When set to all will exclude asset holdings, \u0026format=json or msgpack (opcional, default json)\n```\n\n### Get account information about a given app.\n```php\n$return=$algorand-\u003eget(\"v2\",\"accounts\",\"{address}\",\"applications\",\"{application-id}\");\n```\n\n### Get account information about a given asset.\n```php\n$return=$algorand-\u003eget(\"v2\",\"accounts\",\"{address}\",\"assets\",\"{asset-id}\");\n```\n\n### Get a list of unconfirmed transactions currently in the transaction pool by address.\n```php\n$return=$algorand-\u003eget(\"v2\",\"accounts\",\"{address}\",\"transactions\",\"pending\",\"?format=json\u0026max=2\");\n```\n\n### Get application information.\n```php\n$return=$algorand-\u003eget(\"v2\",\"applications\",\"{application-id}\");\n```\n\n### Get box information for a given application.\n```php\n$return=$algorand-\u003eget(\"v2\",\"applications\",\"{application-id}\",\"box\",\"?name=\");\n```\n\n### Get all box names for a given application.\n```php\n$return=$algorand-\u003eget(\"v2\",\"applications\",\"{application-id}\",\"boxes\",\"?max=\");\n```\n\n### Get asset information.\n```php\n$return=$algorand-\u003eget(\"v2\",\"assets\",\"{asset-id}\");\n```\n\n### Get the block for the given round.\n```php\n$return=$algorand-\u003eget(\"v2\",\"blocks\",\"{block}\");\n```\n\n### Get the block hash for the block on the given round.\n```php\n$return=$algorand-\u003eget(\"v2\",\"blocks\",\"{block}\",\"hash\");\n```\n\n### Gets a proof for a given light block header inside a state proof commitment\n```php\n$return=$algorand-\u003eget(\"v2\",\"blocks\",\"{block}\",\"lightheader\",\"proof\");\n```\n\n### Get a proof for a transaction in a block.\n```php\n$return=$algorand-\u003eget(\"v2\",\"blocks\",\"{round}\",\"transactions\",\"{txid}\",\"proof\");\n```\n\n### Starts a catchpoint catchup. For the last catchpoint access: https://algorand-catchpoints.s3.us-east-2.amazonaws.com/channel/mainnet/latest.catchpoint\n```php\n$return=$algorand-\u003epost(\"v2\",\"catchup\",\"{catchpoint}\");\n```\n\n### Aborts a catchpoint catchup.\n```php\n$return=$algorand-\u003edelete(\"v2\",\"catchup\",\"{catchpoint}\");\n```\n\n### Get a LedgerStateDelta object for a given round\n```php\n$return=$algorand-\u003eget(\"v2\",\"deltas\",\"{round}\");\n```\n\n### Get the current supply reported by the ledger.\n```php\n$return=$algorand-\u003eget(\"v2\",\"ledger\",\"supply\");\n```\n\n### Returns the minimum sync round the ledger is keeping in cache.\n```php\n$return=$algorand-\u003eget(\"v2\",\"ledger\",\"sync\");\n```\n\n### Removes minimum sync round restriction from the ledger.\n```php\n$return=$algorand-\u003edelete(\"v2\",\"ledger\",\"sync\");\n```\n\n### Given a round, tells the ledger to keep that round in its cache.\n```php\n$return=$algorand-\u003epost(\"v2\",\"ledger\",\"sync\",\"{round}\");\n```\n\n### Add a participation key to the node\n```php\n$params['body']=\"{participationkey}\";\n$return=$algorand-\u003epost(\"v2\",\"participation\",$params);\n```\n\n\n### Return a list of participation keys\n```php\n$return=$algorand-\u003eget(\"v2\",\"participation\");\n```\n\n### Append state proof keys to a participation key\n```php\n$params['body']=\"{keymap}\";\n$return=$algorand-\u003epost(\"v2\",\"participation\",\"{participation-id}\",$params);\n```\n\n\n### Get participation key info given a participation ID\n```php\n$return=$algorand-\u003eget(\"v2\",\"participation\",\"{participation-id}\");\n```\n\n### Delete a given participation key by ID\n```php\n$return=$algorand-\u003edelete(\"v2\",\"participation\",\"{participation-id}\");\n```\n\n### Special management endpoint to shutdown the node. Optionally provide a timeout parameter to indicate that the node should begin shutting down after a number of seconds.\n```php\n$params['params']=array(\"timeout\" =\u003e 0);\n$return=$algorand-\u003epost(\"v2\",\"shutdown\", $params);\n```\n\n### Get a state proof that covers a given round\n```php\n$return=$algorand-\u003eget(\"v2\",\"stateproofs\",\"{round}\");\n```\n\n### Compile TEAL source code to binary, produce its hash\n```php\n$params['body']=\"\";\n$return=$algorand-\u003epost(\"v2\",\"teal\",\"compile\",$params);\n```\n\n### Disassemble program bytes into the TEAL source code.\n```php\n$params['body']=\"\";\n$return=$algorand-\u003epost(\"v2\",\"teal\",\"disassemble\",$params);\n```\n\n### Provide debugging information for a transaction (or group).\n```php\n$params['$params']=array(\n                        \"accounts\" =\u003e array(), //Account\n                        \"apps\" =\u003e array(), //Application\n                        \"latest-timestamp\" =\u003e 0, //integer\n                        \"protocol-version\" =\u003e \"\", //string\n                        \"round\" =\u003e 0, //integer\n                        \"sources\" =\u003e array(), //DryrunSource\n                        \"txns\" =\u003e \"\", //string (json) \u003e array\n                   );\n$return=$algorand-\u003epost(\"v2\",\"teal\",\"dryrun\",$params);\n```\n\n### Broadcasts a raw transaction to the network.\n```php\n#Generate and Sign the transaction with cli or this sdk:\n//CLI sample\n#./goal clerk send -a 1000 -f {address_from} -t {address_to} -d data -o transactions/tran.txn\n#./goal clerk sign --infile=\"trans/tran.txn\" --outfile=\"trans/tran.stxn\" -d data\n\n\n$params['file']=\"transactions/tran.stxn\";\n$params['transaction']=\"\";\n$return=$algorand-\u003epost(\"v2\",\"transactions\",$params);\n\n```\n\n### Get parameters for constructing a new transaction\n```php\n$return=$algorand-\u003eget(\"v2\",\"transactions\",\"params\");\n```\n\n### Get a list of unconfirmed transactions currently in the transaction pool.\n```php\n$return=$algorand-\u003eget(\"v2\",\"transactions\",\"pending\",\"?format=json\u0026max=2\");\n```\n\n### Get a specific pending transaction.\n```php\n$return=$algorand-\u003eget(\"v2\",\"transactions\",\"pending\",\"{txid}\",\"?format=json\");\n```\n\n\n\nFor more details: https://developer.algorand.org/docs/reference/rest-apis/algod/v2/\n\n## For use the **KMD**:\nStart the SDK\n```php\n$algorand_kmd = new  Algorand(\"kmd\",\"{kmd-token}\",\"localhost\",7833); //get the token key in data/kmd-{version}/kmd.token and port in data/kmd-{version}/kmd.net\n\n$algorand_transactions = new  Algorand_transactions;\n```\n\n#### Get Versions\n```php\n$return=$algorand_kmd-\u003eget(\"versions\");\n```\n\n#### Get swagger.json\n```php\n$return=$algorand_kmd-\u003eget(\"swagger.json\");\n```\n\n#### Create Wallet\n```php\n$params['params']=array(\n    \"wallet_name\" =\u003e \"\",\n    \"wallet_password\" =\u003e \"\",\n    \"wallet_driver_name\" =\u003e \"sqlite\",\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",$params);\n```\n\n#### Wallet List\n```php\n$return=$algorand_kmd-\u003eget(\"v1\",\"wallets\");\n```\n\n#### Wallet Init\n```php\n$params['params']=array(\n    \"wallet_id\" =\u003e \"\",\n    \"wallet_password\" =\u003e \"\",\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",\"init\",$params);\n$return_array=json_decode($return['response']);\n$wallet_handle_token=$return_array-\u003ewallet_handle_token;\n```\n\n\n#### Wallet Info\n```php\n$params['params']=array(\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",\"info\",$params);\n```\n\n\n#### Wallet Rename\n```php\n$params['params']=array(\n    \"wallet_id\" =\u003e \"\",\n    \"wallet_name\" =\u003e \"\",\n    \"wallet_password\" =\u003e \"\",\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",\"rename\",$params);\n```\n\n\n#### Wallet Handle Token Release\n```php\n$params['params']=array(\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",\"release\",$params);\n```\n\n\n#### Wallet Handle Token Renew\n```php\n$params['params']=array(\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",\"renew\",$params);\n```\n\n\n#### Generate a key\n```php\n$params['params']=array(\n    \"display_mnemonic\" =\u003e false,\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"key\",$params);\n```\n\n\n#### Delete a key\n```php\n$params['params']=array(\n    \"address\" =\u003e \"\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n    \"wallet_password\" =\u003e \"\"\n);\n$return=$algorand_kmd-\u003edelete(\"v1\",\"key\",$params);\n```\n\n\n#### Export a key\n```php\n$params['params']=array(\n    \"address\" =\u003e \"XI56XZXQ64QD7IO5UBRC2RBZP6TQHP5WEILLFMBTKPXRKK7343R3KZAWNQ\",\n    \"wallet_password\" =\u003e \"testes\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"key\",\"export\",$params);\n\n$export=json_decode($return['response']);\n\nrequire_once 'sdk/algokey.php';\n$algokey=new algokey;\n\n$words=$algokey-\u003eprivateKeyToWords($export-\u003eprivate_key);\n\nprint_r($words);\n```\n\n\n#### Import a key\n```php\nrequire_once 'sdk/algokey.php';\n\n$algokey=new algokey;\n$words=\"ripple trap smoke crop name donor sun actor wreck disease mushroom sweet because phrase involve sail umbrella control swing uncle card phrase human absent marble\";\n$words_array=explode(\" \",$words);\n\n$privatekey=$algokey-\u003eWordsToprivateKey($words_array);\n\n$params['params']=array(\n    \"private_key\" =\u003e $privatekey,\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"key\",\"import\",$params);\n```\n\n\n#### List keys in wallet\n```php\n$params['params']=array(\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"key\",\"list\",$params);\n```\n\n\n#### Master Key export\n```php\n$params['params']=array(\n    \"wallet_password\" =\u003e \"\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"master-key\",\"export\",$params);\n```\n\n\n#### Delete a multisig\n```php\n$params['params']=array(\n    \"address\" =\u003e \"\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n    \"wallet_password\" =\u003e \"\"\n);\n$return=$algorand_kmd-\u003edelete(\"v1\",\"multisig\",$params);\n```\n\n\n#### Export a multisig\n```php\n$params['params']=array(\n    \"address\" =\u003e \"\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"multisig\",\"export\",$params);\n```\n\n\n#### Import a multisig\n```php\n$params['params']=array(\n    \"multisig_version\" =\u003e \"1\",\n    \"pks\" =\u003e array(''),\n    \"threshold\" =\u003e 1,\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"multisig\",\"import\",$params);\n```\n\n\n#### List multisig in wallet\n```php\n$params['params']=array(\n    \"wallet_handle_token\" =\u003e $wallet_handle_token\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"multisig\",\"list\",$params);\n```\n\n\n#### Sign a multisig transaction\n```php\n$params['params']=array(\n    \"partial_multisig\" =\u003e array(\n                                \"Subsigs\" =\u003e array(\n                                                    \"Key\" =\u003e array(),\n                                                    \"Sig\" =\u003e array(),\n                                ),\n                                \"Threshold\" =\u003e 1,\n                                \"Version\" =\u003e 1\n                          ),\n    \"public_key\" =\u003e array(''),\n    \"signer\" =\u003e array(''),\n    \"transaction\" =\u003e \"\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n    \"wallet_password\" =\u003e \"\"\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"multisig\",\"sign\",$params);\n```\n\n\n#### Sign a program for a multisig account\n```php\n$params['params']=array(\n    \"address\" =\u003e \"\",\n    \"data\" =\u003e \"\",\n    \"partial_multisig\" =\u003e array(\n                                \"Subsigs\" =\u003e array(\n                                                    \"Key\" =\u003e array(),\n                                                    \"Sig\" =\u003e array(),\n                                ),\n                                \"Threshold\" =\u003e 1,\n                                \"Version\" =\u003e 1\n                          ),\n    \"public_key\" =\u003e array(''),\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n    \"wallet_password\" =\u003e \"\"\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"multisig\",\"signprogram\",$params);\n```\n\n\n#### Sign program\n```php\n$params['params']=array(\n    \"address\" =\u003e \"\",\n    \"data\" =\u003e \"\",\n    \"wallet_handle_token\" =\u003e $wallet_handle_token,\n    \"wallet_password\" =\u003e \"\"\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"program\",\"sign\",$params);\n```\n\n## For use **Transactions**:\n\n### To sign with Algokey load the Private Key\n```php\n$words=explode(\" \",\"connect produce defense output sibling idea oil siege decline dentist faint electric method notice style cook unlock rice confirm host tone test vehicle able keen\"); //2OEZACD77WSR5C2HFEHO2BYHQEATOGFIUW3REGKOGNPPNYPPLROHDU2CQE\n$privateKey=$algokey-\u003eWordsToPrivateKey($words); //Array to load words\n```\n\n### To sign with KMD load the Wallet\n```php\n$algorand_kmd = new Algorand(\"kmd\",\"{kmd-token}\",\"localhost\",7833); //get the token key in data/kmd-{version}/kmd.token and port in data/kmd-{version}/kmd.net\n\n#Wallet Init  //Only if you will use the KMD.\n$params['params']=array(\n    \"wallet_id\" =\u003e \"\",\n    \"wallet_password\" =\u003e \"tests\",\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"wallet\",\"init\",$params);\n$return_array=json_decode($return['response']);\n$wallet_handle_token=$return_array-\u003ewallet_handle_token;\n```\n\n\n### Build and Sign a transaction\nFor details: https://developer.algorand.org/docs/features/transactions\n\n**Types**:\n\n**appl** = ApplicationCallTx allows creating, deleting, and interacting with an application\n\n**cert** = CompactCertTx records a compact certificate\n\n**keyreg** = KeyRegistrationTx indicates a transaction that registers participation keys\n\n**acfg** = AssetConfigTx creates, re-configures, or destroys an asset\n\n**axfer** = AssetTransferTx transfers assets between accounts (optionally closing)\n\n**afrz** = AssetFreezeTx changes the freeze status of an asset\n\n**pay** = PaymentTx indicates a payment transaction\n\n### Build Transaction\n#### Application Call Transaction\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"appl\", //Tx Type\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13029982, //First Valid\n                \"lv\" =\u003e 13023082, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"apid\" =\u003e \"\", //Application ID or empty if creating\n                \"apan\" =\u003e \"\", //OnComplete\n                \"apat\" =\u003e \"\", //Accounts\n                \"apap\" =\u003e \"\", //Approval Program\n                \"apaa\" =\u003e \"\", //App Arguments\n                \"apsu\" =\u003e \"\", //Clear State Program\n                \"apfa\" =\u003e \"\", //Foreign Apps\n                \"apas\" =\u003e \"\", //Foreign Assets\n                \"apgs\" =\u003e array( //GlobalStateSchema\n                            \"nui\" =\u003e \"\", //Number Ints\n                            \"nbs\" =\u003e \"\", //Number Byteslices\n                        ),\n                \"apls\" =\u003e array( //LocalStateSchema\n                            \"nui\" =\u003e \"\", //Number Ints\n                            \"nbs\" =\u003e \"\", //Number Byteslices\n                        ),\n            ),\n);\n```\n#### Compact Certificate\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"cert\", //Tx Type\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13029982, //First Valid\n                \"lv\" =\u003e 13023082, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"certrnd\" =\u003e \"\", //Round\n                \"certtype\" =\u003e \"\", //CompactCertType\n                \"cert\" =\u003e \"\", //Cert\n            ),\n);\n```\n\n#### Register account online\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"keyreg\", //Tx Type\n                \"selkey\" =\u003e \"X84ReKTmp+yfgmMCbbokVqeFFFrKQeFZKEXG89SXwm4=\", //SelectionPK\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13009389, //First Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 13009489, //Last Valid\n                \"votefst\" =\u003e 13009489, //VoteFirst\n                \"votelst\" =\u003e 13009589, //VoteLast\n                \"votekd\" =\u003e 1730, //VoteKeyDilution\n                \"votekey\" =\u003e \"eXq34wzh2UIxCZaI1leALKyAvSz/+XOe0wqdHagM+bw=\",\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n            ),\n);\n```\n\n#### Register account offline\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"keyreg\", //Tx Type\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13009389, //First Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 13009489, //Last Valid\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n            ),\n);\n```\n\n#### Close an Account\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"pay\", //Tx Type\n                \"close\" =\u003e \"EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4\",\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13009389, //First Valid\n                \"lv\" =\u003e 13009489, //Last Valid\n                \"gen\" =\u003e \"mainnet-v1.0\", // GenesisID\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"note\" =\u003e \"Testes\", //You note\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"rcv\" =\u003e \"EW64GC6F24M7NDSC5R3ES4YUVE3ZXXNMARJHDCCCLIHZU6TBEOC7XRSBG4\", //Receiver\n            ),\n);\n```\n\n#### Create an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"acfg\", //Tx Type\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13027977, //First Valid\n                \"lv\" =\u003e 13028977, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"apar\" =\u003e array( //AssetParams\n                        //\"am\" =\u003e \"\", //MetaDataHash\n                        \"an\" =\u003e \"MyToken\", //AssetName\n                        \"au\" =\u003e \"https://mytoken.site\", //URL\n                        \"c\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //ClawbackAddr\n                        \"dc\" =\u003e 2, //Decimals\n                        \"f\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //FreezeAddr\n                        \"m\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //ManagerAddr\n                        \"r\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //ReserveAddr\n                        \"t\" =\u003e 100000000000, //Total\n                        \"un\" =\u003e \"MTK\", //UnitName\n                    ),\n\n            ),\n);\n```\n\n#### Reconfigure an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"acfg\", //Tx Type\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13027977, //First Valid\n                \"lv\" =\u003e 13028977, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"caid\" =\u003e 185553584,\n                \"apar\" =\u003e array( //AssetParams\n                        \"c\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //ClawbackAddr\n                        \"f\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //FreezeAddr\n                        \"m\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //ManagerAddr\n                        \"r\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //ReserveAddr\n                    ),\n\n            ),\n);\n```\n\n#### Destroy an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"acfg\", //Tx Type\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13027977, //First Valid\n                \"lv\" =\u003e 13028977, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"caid\" =\u003e 185553584, //ConfigAsset ID\n            ),\n);\n```\n\n#### Opt-in to an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"axfer\", //Tx Type\n                \"arcv\" =\u003e \"DOVA6TULHNY2DCS65LVT5QYLWZGM7WC2GISPRGNDWDUH3KUX56ZLQJW3AY\", //AssetReceiver\n                \"snd\" =\u003e \"DOVA6TULHNY2DCS65LVT5QYLWZGM7WC2GISPRGNDWDUH3KUX56ZLQJW3AY\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13028464, //First Valid\n                \"lv\" =\u003e 13028564, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"xaid\" =\u003e 185553584, //XferAsset ID\n            ),\n);\n```\n\n#### Revoke an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"aamt\" =\u003e 100,\n                \"type\" =\u003e \"axfer\", //Tx Type\n                \"arcv\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //AssetReceiver\n                \"asnd\" =\u003e \"DOVA6TULHNY2DCS65LVT5QYLWZGM7WC2GISPRGNDWDUH3KUX56ZLQJW3AY\", //AssetSender\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13028982, //First Valid\n                \"lv\" =\u003e 13029982, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"xaid\" =\u003e 185553584, //XferAsset ID\n            ),\n);\n```\n\n#### Freeze an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"afrz\" =\u003e false,\n                \"type\" =\u003e \"afrz\", //Tx Type\n                \"fadd\" =\u003e \"DOVA6TULHNY2DCS65LVT5QYLWZGM7WC2GISPRGNDWDUH3KUX56ZLQJW3AY\", //FreezeAccount\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13029982, //First Valid\n                \"lv\" =\u003e 13023082, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"faid\" =\u003e 185553584, //FreezeAsset\n            ),\n);\n```\n\n#### Transfer an Asset\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"aamt\" =\u003e 100,\n                \"type\" =\u003e \"axfer\", //Tx Type\n                \"arcv\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //AssetReceiver\n                \"snd\" =\u003e \"DOVA6TULHNY2DCS65LVT5QYLWZGM7WC2GISPRGNDWDUH3KUX56ZLQJW3AY\", //Sender\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13028982, //First Valid\n                \"lv\" =\u003e 13029982, //Last Valid\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"xaid\" =\u003e 185553584, //XferAsset ID\n            ),\n);\n```\n\n#### Payment Transaction (ALGO)\n```php\n$transaction=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"pay\", //Tx Type\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 13009389, //First Valid\n                \"gen\" =\u003e \"mainnet-v1.0\", // GenesisID\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 13009489, //Last Valid\n                \"note\" =\u003e \"Testes\", //You note\n                \"snd\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Sender\n                \"rcv\" =\u003e \"IYVZLDFIF6KUMSDFVIKHPBT3FI5QVZJKJ6BPFSGIJDUJGUUASKNRA4HUHU\", //Receiver\n                \"amt\" =\u003e 1000, //Amount\n            ),\n);\n```\n\n### Sign Transaction\n```php\n$params['params']=array(\n   \"transaction\" =\u003e $algorand_kmd-\u003etxn_encode($transaction),\n   \"wallet_handle_token\" =\u003e $wallet_handle_token,\n   \"wallet_password\" =\u003e \"testes\"\n);\n\n$return=$algorand_kmd-\u003epost(\"v1\",\"transaction\",\"sign\",$params);\n$r=json_decode($return['response']);\n$txn=base64_decode($r-\u003esigned_transaction);\necho $txn;\n```\n\n#### Broadcasts a raw transaction to the network.\n```php\n$algorand = new Algorand_algod('{algod-token}',\"localhost\",53898);\n$params['transaction']=$txn;\n$return=$algorand-\u003epost(\"v2\",\"transactions\",$params);\n$txId=$return['response']-\u003etxId;\necho \"txId: $txId\";\n```\n\nFor more details: https://developer.algorand.org/docs/reference/rest-apis/kmd/\n\n## Atomic Transfers\nCreate Transactions\n```php\n$transactions=array();\n\n//Transaction 1\n$transactions[]=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"pay\", //Tx Type\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 28259644, //First Valid\n                \"gen\" =\u003e \"mainnet-v1.0\", // GenesisID\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 28260644, //Last Valid\n                \"note\" =\u003e \"Testes\", //You note\n                \"snd\" =\u003e \"3DKZLYQJXSUAE7ZCFZN7ODZSOA6733PI5BFM4L7WI4S3K6KEVOOA6KDN2I\", //Sender\n                \"rcv\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Receiver\n                \"amt\" =\u003e 102, //Amount\n            ),\n);\n\n//Transaction 2\n$transactions[]=array(\n        \"txn\" =\u003e array(\n                \"type\" =\u003e \"pay\", //Tx Type\n                \"fee\" =\u003e 1000, //Fee\n                \"fv\" =\u003e 28259644, //First Valid\n                \"gen\" =\u003e \"mainnet-v1.0\", // GenesisID\n                \"gh\" =\u003e \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\", //Genesis Hash\n                \"lv\" =\u003e 28260644, //Last Valid\n                \"note\" =\u003e \"Testes 2\", //You note\n                \"snd\" =\u003e \"3DKZLYQJXSUAE7ZCFZN7ODZSOA6733PI5BFM4L7WI4S3K6KEVOOA6KDN2I\", //Sender\n                \"rcv\" =\u003e \"DI65FPLNUXOJJR47FDTIB5TNNIA5G4EZFA44RZMRBE7AA4D453OYD2JCW4\", //Receiver\n                \"amt\" =\u003e 203, //Amount\n            ),\n);\n```\n\nGroup Transactions\n```php\n$groupid=$algorand_transactions-\u003egroupid($transactions);\n\n#Assigns Group ID\n$transactions[0]['txn']['grp']=$groupid;\n$transactions[1]['txn']['grp']=$groupid;\n```\n\nSign Transactions with Algokey\n```php\n#Sign Transaction 1\n\n$txn=\"\";\n$transaction_raw=$algorand_transactions-\u003eencode($transactions[0]);\n$signature=$algokey-\u003esign($transaction_raw,$privateKey);\n$txn.=$algorand_transactions-\u003eencode($transactions[0],true,$signature);\n\n#Sign Transaction 2\n$transaction_raw=$algorand_transactions-\u003eencode($transactions[1]);\n$signature=$algokey-\u003esign($transaction_raw,$privateKey);\n$txn.=$algorand_transactions-\u003eencode($transactions[1],true,$signature);\n\n```\n\nOR\n\nSign Transactions with KMD\n```php\n#Sign Transaction 1\n$txn=\"\";\n$params['params']=array(\n   \"transaction\" =\u003e $algorand_transactions-\u003eencode($transactions[0]),\n   \"wallet_handle_token\" =\u003e $wallet_handle_token,\n   \"wallet_password\" =\u003e \"tests\",\n);\n\n$return=$algorand_kmd-\u003epost(\"v1\",\"transaction\",\"sign\",$params);\n$r=json_decode($return['response']);\n$txn.=base64_decode($r-\u003esigned_transaction);\n\n\n#Sign Transaction 2\n$params['params']=array(\n   \"transaction\" =\u003e $algorand_transactions-\u003eencode($transactions[1]),\n   \"wallet_handle_token\" =\u003e $wallet_handle_token,\n   \"wallet_password\" =\u003e \"tests\",\n);\n$return=$algorand_kmd-\u003epost(\"v1\",\"transaction\",\"sign\",$params);\n$r=json_decode($return['response']);\n$txn.=base64_decode($r-\u003esigned_transaction);;\n```\n\nSend Transaction Group\n```php\n#Broadcasts a raw atomic transaction to the network.\n$algorand = new Algorand(\"algod\",\"4820e6e45f339e0026eaa2b74c2aa7d8735cbcb2db0cf0444fb492892e1c09b7\",\"localhost\",53898);\n$params['transaction']=$txn;\n$return=$algorand-\u003epost(\"v2\",\"transactions\",$params);\n$txId=$return['response']-\u003etxId;\necho \"txId: $txId\";\n```\n\nFor more details: https://developer.algorand.org/docs/features/atomic_transfers/\n\n## For use the **Indexer**:\nStart the SDK\n```php\n$algorand_indexer = new Algorand(\"indexer\",\"{algorand-indexer-token}\",\"localhost\",8089);\n```\n\n\n#### Get health, Returns 200 if healthy.\n```php\n$return=$algorand_indexer-\u003eget(\"health\");\n```\n\n\n#### Search for accounts.\n```php\n$query=http_build_query(array(\n    //\"application-id\" =\u003e 0, //integer\n    //\"asset-id\" =\u003e 0, //integer\n    //\"auth-addr\" =\u003e \"\", //string\n    //\"currency-greater-than\" =\u003e 0, //integer\n    //\"currency-less-than\" =\u003e 0, //integer\n    \"limit\" =\u003e 100, //integer\n    //\"next\" =\u003e \"\", //string - previous return {next-token}\n    //\"round\" =\u003e 0, //integer\n));\n$return=$algorand_indexer-\u003eget(\"v2\",\"accounts?\".$query);\n```\n\n\n#### Lookup account information.\n```php\n$return=$algorand_indexer-\u003eget(\"v2\",\"accounts\",\"{account-id}\");\n```\n\n\n#### Lookup account transactions.\n```php\n$query=http_build_query(array(\n    //\"application-id\" =\u003e 0, //integer\n    \"asset-id\" =\u003e 0, //integer\n    \"after-time\" =\u003e \"\", //string (date-time)\n    \"before-time\" =\u003e \"\", //string (date-time)\n    \"currency-greater-than\" =\u003e 0, //integer\n    \"currency-less-than\" =\u003e 0, //integer\n    \"limit\" =\u003e 100, //integer\n    //\"max-round\" =\u003e 0, //integer\n    //\"min-round\" =\u003e 0, //integer\n    //\"next\" =\u003e \"\", //string - previous return {next-token}\n    \"note-prefix\" =\u003e \"\", //string\n    \"rekey-to\" =\u003e false, //boolean\n    //\"round\" =\u003e \"\", //integer\n    \"sig-type\" =\u003e \"sig\", //enum (sig, msig, lsig)\n    \"tx-type\" =\u003e \"pay\", //enum (pay, keyreg, acfg, axfer, afrz, appl)\n    \"txid\" =\u003e \"\", //string\n));\n\n$return=$algorand_indexer-\u003eget(\"v2\",\"accounts\",\"{account-id}\",\"transactions?\".$query);\n```\n\n\n#### Search for applications\n```php\n$query=http_build_query(array(\n    \"application-id\" =\u003e 0, //integer\n    \"limit\" =\u003e 100, //integer\n    //\"next\" =\u003e \"\", //string - previous return {next-token}\n));\n$return=$algorand_indexer-\u003eget(\"v2\",\"applications?\".$query);\n```\n\n\n#### Lookup application.\n```php\n$return=$algorand_indexer-\u003eget(\"v2\",\"applications\",\"{application-id}\");\n```\n\n\n#### Search for assets.\n```php\n$query=http_build_query(array(\n    //\"asset-id\" =\u003e 0, //integer\n    //\"creator\" =\u003e 0, //integer\n    \"limit\" =\u003e 100, //integer\n    //\"name\" =\u003e \"\", //string\n    //\"next\" =\u003e \"\", //string - previous return {next-token}\n    //\"unit\" =\u003e \"\", //string\n));\n$return=$algorand_indexer-\u003eget(\"v2\",\"assets?\".$query);\n```\n\n\n#### Lookup asset information.\n```php\n$return=$algorand_indexer-\u003eget(\"v2\",\"assets\",\"{asset-id}\");\n```\n\n\n#### Lookup the list of accounts who hold this asset\n```php\n$query=http_build_query(array(\n    //\"currency-greater-than\" =\u003e 0, //integer\n    //\"currency-less-than\" =\u003e 0, //integer\n    \"limit\" =\u003e 100, //integer\n    //\"next\" =\u003e \"\", //string - previous return {next-token}\n    //\"round\" =\u003e \"\", //integer\n));\n$return=$algorand_indexer-\u003eget(\"v2\",\"assets\",\"{asset-id}\",\"balances?\".$query);\n```\n\n\n#### Lookup the list of accounts who hold this asset\n```php\n$query=http_build_query(array(\n    \"address\" =\u003e \"\", //string\n    \"address-role\" =\u003e \"\", //enum (sender, receiver, freeze-target)\n    \"after-time\" =\u003e \"\", //string (date-time)\n    \"before-time\" =\u003e \"\", //string (date-time)\n    \"currency-greater-than\" =\u003e 0, //integer\n    //\"currency-less-than\" =\u003e 0 //integer\n    \"exclude-close-to\" =\u003e false, //boolean\n    \"limit\" =\u003e 100, //integer\n    \"max-round\" =\u003e 0, //integer\n    \"min-round\" =\u003e 0, //integer\n    //\"next\" =\u003e \"\", //string - previous return {next-token}\n    \"note-prefix\" =\u003e \"\", //string\n    \"rekey-to\" =\u003e false, //boolean\n    //\"round\" =\u003e \"\", //integer\n    \"sig-type\" =\u003e \"sig\", //enum (sig, msig, lsig)\n    \"tx-type\" =\u003e \"pay\", //enum (pay, keyreg, acfg, axfer, afrz, appl)\n    \"txid\" =\u003e \"\", //string\n));\n$return=$algorand_indexer-\u003eget(\"v2\",\"assets\",\"{asset-id}\",\"transactions\".$query);\n```\n\n\n#### Lookup block.\n```php\n$return=$algorand_indexer-\u003eget(\"v2\",\"blocks\",\"{round-number}\");\n```\n\n\n#### Search for transactions.\n```php\n$query=http_build_query(array(\n    \"address\" =\u003e \"\", //string\n    \"address-role\" =\u003e \"sender\", //enum (sender, receiver, freeze-target)\n    \"after-time\" =\u003e \"\", //string (date-time)\n    \"application-id\" =\u003e 0, //integer\n    \"asset-id\" =\u003e 0, //integer\n    \"before-time\" =\u003e \"\", //string (date-time)\n    \"currency-greater-than\" =\u003e 0, //integer\n    \"currency-less-than\" =\u003e 0, //integer\n    \"exclude-close-to\" =\u003e \"false\", //boolean\n    \"limit\" =\u003e \"100\", //integer\n    \"min-round\" =\u003e 2466647, //integer\n    \"max-round\" =\u003e 2566647, //integer\n    \"next\" =\u003e \"\", //string - previous return {next-token}\n    \"note-prefix\" =\u003e \"\", //string\n    \"rekey-to\" =\u003e false, //boolean\n    //\"round\" =\u003e 2566247, //integer\n    \"sig-type\" =\u003e \"sig\", //enum (sig, msig, lsig)\n    \"tx-type\" =\u003e \"pay\", //enum (pay, keyreg, acfg, axfer, afrz, appl)\n    \"txid\" =\u003e \"\", //string\n));\n```\n\n\n#### Lookup a single transaction.\n```php\n$return=$algorand_indexer-\u003eget(\"v2\",\"transactions\",\"{txid}\");\n```\n\n\nFor more details: https://developer.algorand.org/docs/reference/rest-apis/indexer/\n\n\n\n## Print the results\nFull response with debug (json response)\n```php\nprint_r($return);\n```\n\nOnly response array\n```php\nprint_r(json_decode($return['response']));\n```\n\nOnly erros messages  array\n```php\nprint_r(json_decode($return['message']));\n```\n\n\n## Configurations\nTo enable Debug\n```php\n$algorand-\u003edebug(1);\n```\n\nTo enable SSL\n```php\n$algorand-\u003esetSSL('/home/felipe/certificate.cert');\n```\n\n## License\nphp-algorand-sdk is licensed under a MIT license. See the [LICENSE](https://github.com/ffsolutions/php-algorand-sdk/blob/master/LICENSE) file for details.\n\n\n## Donate\nIf you would like to donate to help maintain our online nodes, this and future projects, this is our ALGO (Algorand) Wallet: IYVZLDFIF6KUMSDFVIKHPBT3FI5QVZJKJ6BPFSGIJDUJGUUASKNRA4HUHU\n\nThank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffsolutions%2Fphp-algorand-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fffsolutions%2Fphp-algorand-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffsolutions%2Fphp-algorand-sdk/lists"}