{"id":30639,"date":"2019-10-31T21:36:39","date_gmt":"2019-10-31T18:36:39","guid":{"rendered":"https:\/\/prohoster.info\/blog\/waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves\/"},"modified":"2019-10-31T21:36:39","modified_gmt":"2019-10-31T18:36:39","slug":"waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves","title":{"rendered":"WavesKit \u2014 A PHP Framework for Working with the Waves Blockchain","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>I like <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/PHP\">PHP<\/a><\/noindex> the speed of development and excellent portability. It\u2019s great to always have a ready-to-solve-tool at hand.<\/p>\n<p><\/p>\n<p>It was quite disappointing when I first encountered the domestic blockchain <noindex><a rel=\"nofollow\" href=\"https:\/\/wavesplatform.com\">Waves Platform<\/a><\/noindex> and found that there was no ready SDK in PHP available. Well, I had to write it myself.<\/p>\n<p><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p>At first, I had to use <noindex><a rel=\"nofollow\" href=\"https:\/\/docs.wavesplatform.com\/en\/waves-full-node\/what-is-a-full-node.html\">in manifests<\/a><\/noindex> for signing transactions. So, to manage three addresses, I had to run three nodes\u2026 It was a pathetic sight, although it solved some problems. Until I realized that relying on nodes was a dead-end. Firstly, due to limited functionality <noindex><a rel=\"nofollow\" href=\"https:\/\/docs.wavesplatform.com\/en\/waves-api-and-sdk\/waves-node-rest-api.html\">API<\/a><\/noindex>, and secondly, due to speed (in those days, nodes were very slow).<\/p>\n<p><\/p>\n<p>I started two parallel projects. One was to create a blockchain explorer that would be fast and completely independent of node APIs. The second was to gather all functions for working with the Waves Platform in one place. This is how the projects <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/w8io\">w8io<\/a><\/noindex> and <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\">WavesKit<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>The first step behind the scenes of the Waves blockchain was <noindex><a rel=\"nofollow\" href=\"https:\/\/w8io.ru\">the w8io explorer<\/a><\/noindex>. It wasn\u2019t easy, but I managed to write an independent calculation of all balances and even found a bug in the calculations on the original nodes (<noindex><a rel=\"nofollow\" href=\"https:\/\/forum.wavesplatform.com\/t\/bug-bounty-program\/1127\">the bug-bounty program<\/a><\/noindex> by the way, they have, and they pay for found errors). You can learn more about the functionality of the w8io explorer in this topic: <noindex><a rel=\"nofollow\" href=\"https:\/\/forum.wavesplatform.com\/t\/w8io-waves-explorer-based-on-php-sqlite\">https:\/\/forum.wavesplatform.com\/t\/w8io-waves-explorer-based-on-php-sqlite<\/a><\/noindex><\/p>\n<p><\/p>\n<p>During the process of working on w8io, I already had doubts, but when the work came to a logical end and I started creating the SDK, the doubts were confirmed. I couldn\u2019t find certain functions anywhere, including the most important cryptographic ones. That's when I started building my own bricks for the foundation. Thus were born: <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/ABCode\">ABCode<\/a><\/noindex> for encoding in base58 (actually for encoding any alphabet in any), <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/Curve25519\">Curve25519<\/a><\/noindex> for creating and verifying compatible signatures (with options <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/Curve25519\/blob\/0ba56fa566f4a29b06126465b9ebbe59c915ffbd\/src\/Curve25519.php#L104\">on steroids<\/a><\/noindex>), <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/Blake2b\">Blake2b<\/a><\/noindex> for calculating one of the hashes (which was available only starting from PHP 7.2) etc.<\/p>\n<p><\/p>\n<p>Here I must thank <noindex><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/ikardanoff\">Inal Kardanov<\/a><\/noindex> for several valuable pieces of advice that guided me towards <noindex><a rel=\"nofollow\" href=\"https:\/\/en.wikipedia.org\/wiki\/Composer_(software)\">composer<\/a><\/noindex> instead of the familiar but outdated include files.<\/p>\n<p><\/p>\n<p>A couple of months later <noindex>WavesKit saw the light<\/noindex>, came out of <noindex><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/ikardanoff\/status\/1091241637706190848\">beta version<\/a><\/noindex> and is now ready to work with all standard functionalities of the Waves platform. All available in <noindex><a rel=\"nofollow\" href=\"https:\/\/docs.wavesplatform.com\/en\/waves-environment\/waves-mainnet.html\">the main network<\/a><\/noindex> Transactions can be easily created, signed, and sent by a single package that works on all 64-bit versions of PHP starting from 5.6.<\/p>\n<p><\/p>\n<p>Integrating WavesKit into your project:<\/p>\n<p><\/p>\n<pre><code class=\"php\">composer require deemru\/waveskit<\/code><\/pre>\n<p><\/p>\n<p>Usage:<\/p>\n<p><\/p>\n<pre><code class=\"php\">use deemruWavesKit;\n$wk = new WavesKit( 'T' );\n$wk-&gt;setSeed( 'manage manual recall harvest series desert melt police rose hollow moral pledge kitten position add' );\n$tx = $wk-&gt;txBroadcast( $wk-&gt;txSign( $wk-&gt;txTransfer( 'test', 1 ) ) );\n$tx = $wk-&gt;ensure( $tx );<\/code><\/pre>\n<p><\/p>\n<p>In the example above, we create a WavesKit object that operates on the test network 'T'. We set the seed phrase, from which the keys and account address are automatically derived based on the public key. Next, we create a transfer transaction of 0.00000001 Waves from the address automatically computed from the seed phrase to the alias address 'test', sign it with the private key, and send it to the network. After that, we verify that the transaction has been successfully confirmed by the network.<\/p>\n<p><\/p>\n<p>Working with transactions is focused in <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\/blob\/master\/docs\/WavesKit.md#waveskittxaddressscript\">functions starting with tx<\/a><\/noindex>. To better understand how to work with transactions, you can study <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\/blob\/master\/docs\/WavesKit.md\">WavesKit documentation<\/a><\/noindex> or directly refer to visual examples in <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\/blob\/2c4937199c88bc4ae105f60657b1389482471c1f\/test\/selftest.php#L237\">continuous integration tests.<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>Since WavesKit has developed under real use conditions, it already has advanced features. The first killer feature is the <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\/blob\/master\/docs\/WavesKit.md#waveskitensure\">ensure function<\/a><\/noindex>, which monitors reaching the required level of confidence that the transaction has not been lost, but rather has been confirmed and has reached the necessary number of confirmations in the network.<\/p>\n<p><\/p>\n<p>Another bulletproof mechanism is how WavesKit communicates with nodes. Under optimal conditions, the framework only works with the main node, maintaining a constant connection with it, but in case of errors, it can automatically switch to backups. If you set an array of backup nodes, you can call the <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\/blob\/master\/docs\/WavesKit.md#waveskitsetbestnode\">setBestNode<\/a><\/noindex> function to determine the best node as the main one based on the maximum value of the current height and response speed. Now add to this an internal request cache and feel the care for both users and node owners.<\/p>\n<p><\/p>\n<p>One of the latest advanced mechanisms is the function <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\/blob\/master\/docs\/WavesKit.md#waveskittxmonitor\">txMonitor<\/a><\/noindex>It emerged from the need to respond to incoming transactions in real time. This function completely addresses all nuances related to transaction processing in the blockchain. No more pain, just set your callback function with the desired options and wait for new transactions that will trigger your processes. For example, another one of my projects <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/VECRO\">VECRO<\/a><\/noindex> is entirely built around this function, and you can easily explore how it works right <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/VECRO\/blob\/85d8373de56baff7c05697475211633b521bca7d\/src\/VECRO.php#L80\">in the project code<\/a><\/noindex>.<\/p>\n<p><\/p>\n<p>I love open source; it is one of humanity's greatest achievements. Since I am the sole developer and have reached a state where all my needs are met, I invite you to use and contribute to <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/deemru\/WavesKit\">WavesKit<\/a><\/noindex>.<\/p>\n<p>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/446110\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f PHP \u0437\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043a\u0430\u0440\u043c\u0430\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0437\u0430\u0434\u0430\u0447 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0411\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u0438\u0434\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438 \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0435 \u0441 \u043e\u0442\u0435\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c Waves Platform \u0432 \u0435\u0433\u043e \u0430\u0440\u0441\u0435\u043d\u0430\u043b\u0435 \u043d\u0435 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e SDK \u043d\u0430 PHP. \u0427\u0442\u043e \u0436, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0435\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c. \u041f\u043e\u043d\u0430\u0447\u0430\u043b\u0443 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0434\u044b \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439. \u0422\u0430\u043a, [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-30639","post","type-post","status-publish","format-standard","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f PHP \u0437\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47WavesKit \u2014 PHP \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c Waves | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f PHP \u0437\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:36:39+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:36:39+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47WavesKit \u2014 PHP framework for working with the Waves blockchain | ProHoster","description":"I like PHP for its development speed and excellent portability.","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47WavesKit \u2014 PHP \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c Waves | ProHoster","og:description":"\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f PHP \u0437\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c.","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/waveskit-php-frejmvork-dlya-raboty-s-blokchejnom-waves","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:36:39+00:00","article:modified_time":"2019-10-31T18:36:39+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30639","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 02:15:25","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:31:24","updated":"2026-01-21 02:15:25","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/30639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=30639"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/30639\/revisions"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=30639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=30639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=30639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}