{"id":345645,"date":"2023-02-18T21:04:25","date_gmt":"2023-02-18T21:04:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=345645"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2023-02-18T21:04:25","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=345645","title":{"rendered":"<span>Solana \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b \u043d\u0430 Rust \u0434\u043b\u044f \u0441\u0430\u043c\u044b\u0445 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>Program<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 &#171;Solana program&#187; &#8212; \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b. \u042d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043b\u044e\u0431\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u0441\u0435\u0442\u0438 Solana.<\/p>\n<h2>Instruction<\/h2>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435:<\/p>\n<ol>\n<li>\n<p><strong>Program id<\/strong> &#8212; \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>Accounts<\/strong> &#8212; \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><strong>Data<\/strong> &#8212; \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ol>\n<h2>System program<\/h2>\n<p>\u042d\u0442\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 <u>sol<\/u>, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0438 \u0442.\u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 <a href=\"https:\/\/docs.solana.com\/ru\/developing\/runtime-facilities\/programs\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0435<\/a><\/p>\n<h2>\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c sol<\/h2>\n<h4>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442<\/h4>\n<pre><code class=\"bash\">cargo init sol-transfer --lib<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0440\u0435\u0439\u0442<\/h4>\n<pre><code class=\"bash\">cargo add solana-program<\/code><\/pre>\n<h4>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0438 \u0432 lib.rs<\/h4>\n<ul>\n<li>\n<p><strong>account_info::AccountInfo<\/strong> &#8212; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442<\/p>\n<\/li>\n<li>\n<p><strong>account_info::next_account_info<\/strong> &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u0441 <u>AccountInfo<\/u><\/p>\n<\/li>\n<li>\n<p><strong>entrypoint<\/strong> &#8212; \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>entrypoint::ProgramResult<\/strong> &#8212; \u0442\u0438\u043f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>program::invoke<\/strong> &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0436\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439<\/p>\n<\/li>\n<li>\n<p><strong>program_error::ProgramError<\/strong> &#8212; <u>enum<\/u> \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<\/li>\n<li>\n<p><strong>pubkey::Pubkey<\/strong> &#8212; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><strong>system_instruction<\/strong> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 <u>System program.<\/u> \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 <u>lamports<\/u> (\u0414\u0440\u043e\u0431\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0421\u043e\u043b\u0430\u043d\u044b)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">use solana_program::{     account_info::{next_account_info, AccountInfo},     entrypoint,     entrypoint::ProgramResult,     program::invoke,     program_error::ProgramError,     pubkey::Pubkey,     system_instruction, };<\/code><\/pre>\n<h4>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c entrypoint<\/h4>\n<pre><code class=\"rust\">entrypoint!(process_instruction);<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439<\/h3>\n<h4>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/h4>\n<ul>\n<li>\n<p><strong>program_id<\/strong> &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<\/li>\n<li>\n<p><strong>accounts<\/strong> &#8212; \u043c\u0430\u0441\u0441\u0438\u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>instruction_data<\/strong> &#8212; \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">pub fn process_instruction(     _program_id: &amp;Pubkey,     accounts: &amp;[AccountInfo],     instruction_data: &amp;[u8], ) -> ProgramResult {<\/code><\/pre>\n<h4>\u0410\u043a\u043a\u0430\u0443\u043d\u0442\u044b<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c\u0438 <u>\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/u> \u0438 <u>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/u><\/p>\n<pre><code class=\"rust\">let accounts_iter = &amp;mut accounts.iter();  let sender = next_account_info(accounts_iter)?; let destination = next_account_info(accounts_iter)?;<\/code><\/pre>\n<h4>Instruction data<\/h4>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/docs.rs\/borsh\/latest\/borsh\/\" rel=\"noopener noreferrer nofollow\">borsh<\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u043e <a href=\"https:\/\/docs.solana.com\/ru\/developing\/clients\/javascript-reference#struct\" rel=\"noopener noreferrer nofollow\">\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u0432 \u0434\u0430\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 <u>lamports<\/u>, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e<\/p>\n<p>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u043c\u043e\u043d\u0435\u0442<\/p>\n<pre><code class=\"rust\">let amount = instruction_data     .get(..8)     .and_then(|slice| slice.try_into().ok())     .map(u64::from_le_bytes)     .ok_or(ProgramError::InvalidInstructionData)?;<\/code><\/pre>\n<h3>System program \u0438 Transfer<\/h3>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 lamports<\/h4>\n<ul>\n<li>\n<p><strong>sender.key<\/strong> &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 <u>\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/u><\/p>\n<\/li>\n<li>\n<p><strong>destination.key<\/strong> &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 <u>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/u><\/p>\n<\/li>\n<li>\n<p><strong>amount<\/strong> &#8212;  \u043a\u043e\u043b-\u0432\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 <u>lamports<\/u><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">let transfer_instruction = system_instruction::transfer(     sender.key,      destination.key,      amount );<\/code><\/pre>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0436\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 <u>sol<\/u> \u0447\u0435\u0440\u0435\u0437 <u>System program<\/u>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0442\u0440\u0430\u043d\u0441\u0444\u0435\u0440\u0435<\/p>\n<pre><code class=\"rust\">invoke(     &amp;transfer_instruction,     &amp;[sender.clone(), destination.clone()], )?;<\/code><\/pre>\n<h3>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/h3>\n<p>\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0435\u0434\u0438\u043d\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c <strong>Ok(())<\/strong><\/p>\n<pre><code class=\"rust\">pub fn process_instruction(     _program_id: &amp;Pubkey,     accounts: &amp;[AccountInfo],     instruction_data: &amp;[u8], ) -> ProgramResult {      let accounts_iter = &amp;mut accounts.iter();      let sender = next_account_info(accounts_iter)?;     let destination = next_account_info(accounts_iter)?;      let amount = instruction_data         .get(..8)         .and_then(|slice| slice.try_into().ok())         .map(u64::from_le_bytes)         .ok_or(ProgramError::InvalidInstructionData)?;      let transfer_instruction = system_instruction::transfer(         sender.key,          destination.key,          amount     );      invoke(         &amp;transfer_instruction,         &amp;[sender.clone(), destination.clone()],     )?;      Ok(()) }<\/code><\/pre>\n<h3>\u0414\u0435\u043f\u043b\u043e\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 localnet<\/h3>\n<h4>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0432 .so<\/h4>\n<pre><code class=\"bash\">cargo-build-bpf<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c<\/h4>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0438 <u>JSON RPC(HTTP API)<\/u><\/p>\n<pre><code>solana-test-validator<\/code><\/pre>\n<h4>\u0414\u0435\u043f\u043b\u043e\u0438\u043c .so \u0444\u0430\u0439\u043b<\/h4>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432 \u0441\u0435\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0435\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430<u>(Program Id)<\/u><\/p>\n<pre><code class=\"bash\">solana program deploy target\/deploy\/transfer_program.so<\/code><\/pre>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<\/h2>\n<h4>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c Solana web3.js<\/h4>\n<p>\u042d\u0442\u043e \u0432\u0435\u0431 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c <u>Solana<\/u> \u0447\u0435\u0440\u0435\u0437 <u>RPC API<\/u> \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 <a href=\"https:\/\/solana-labs.github.io\/solana-web3.js\/\" rel=\"noopener noreferrer nofollow\">\u0432 \u0434\u043e\u043a\u0435<\/a><\/p>\n<pre><code class=\"javascript\">script = document.createElement('script'); script.src = 'https:\/\/unpkg.com\/@solana\/web3.js@latest\/lib\/index.iife.js'; document.body.append(script);<\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p><strong>rpcUrl<\/strong> &#8212; \u043d\u0430\u0448 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 <u>JSON RPC<\/u> \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442<\/p>\n<pre><code class=\"javascript\">let rpcUrl = 'http:\/\/127.0.0.1:8899'; let connection = new solanaWeb3.Connection(rpcUrl);<\/code><\/pre>\n<h4>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/h4>\n<pre><code class=\"javascript\">let sender = solanaWeb3.Keypair(); let destination = solanaWeb3.Keypair();<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c airdrop 1 SOL \u043d\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/h4>\n<p><strong>solanaWeb3.LAMPORTS_PER_SO<\/strong>L &#8212; \u043a\u043e\u043b-\u0432\u043e <u>lamports<\/u> \u0432 \u043e\u0434\u043d\u043e\u043c <u>sol <\/u><\/p>\n<pre><code class=\"javascript\">await connection.requestAirdrop(sender.publicKey, solanaWeb3.LAMPORTS_PER_SOL);<\/code><\/pre>\n<h4>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h4>\n<p>\u042d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438, \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432 \u0441\u0435\u0442\u044c<\/p>\n<pre><code class=\"javascript\">let programId = new solanaWeb3.PublicKey('YOUR_PROGRAM_ADDRESS')<\/code><\/pre>\n<h3>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f<\/h3>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/h4>\n<pre><code class=\"javascript\">let transaction = new solanaWeb3.Transaction();<\/code><\/pre>\n<h4>Transaction data<\/h4>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u043e \u043f\u0435\u0440\u0435\u0433\u043d\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438 \u0447\u0438\u0441\u0442\u044b\u043c <u>JavaScript<\/u>. \u0412\u043e\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b. \u0423\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0442\u043e \u043a\u0430\u043a \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443<\/p>\n<pre><code class=\"javascript\">function BytesFromInt(n) {let a=[];let fir=n%2**8;n-=fir;a.push(fir);let s=~~(n%2**16\/2**8);n-=s;a.push(s);let t=~~(n%2**24\/2**16);n-=t;a.push(t);let fo=~~(n%2**32\/2**24);n-=fo;a.push(fo);let fif=~~(n%2**40\/2**32);n-=fif;a.push(fif);return a.concat([0,0,0]);}<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e<\/h4>\n<ul>\n<li>\n<p><strong>isSigner: true<\/strong> &#8212; \u044d\u0442\u043e\u0442 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u043b\u0430\u0442\u0438\u0442 \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u044e<\/p>\n<\/li>\n<li>\n<p><strong>isWritable: true<\/strong> &#8212; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">transaction.add(new solanaWeb3.TransactionInstruction({     keys: [{         \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c         pubkey: sender.publicKey,         isWritable: true,         isSigner: true     }, {         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c         pubkey: destination.publicKey,         isWritable: true,         isSigner: false     }, {         \/\/ System program         pubkey: solanaWeb3.SystemProgram.programId,         isWritable: false,         isSigner: false     }],     \/\/ \u0410\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b      programId: programId,     \/\/ \u041a\u043e\u043b-\u0432\u043e sol, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c - 0.1 sol     data: BytesFromInt(0.1*solanaWeb3.LAMPORTS_PER_SOL) }));<\/code><\/pre>\n<h4>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c!<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0442\u0443\u0442 &#8212; \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0430\u0440 \u043a\u043b\u044e\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"javascript\">await solanaWeb3.sendAndConfirmTransaction(connection, transaction, [sender]);<\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0431\u0430\u043b\u0430\u043d\u0441<\/h4>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0431\u0430\u043b\u0430\u043d\u0441 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 <u>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/u>. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432\u044b\u0437\u043e\u0432 \u0432\u0435\u0440\u043d\u0435\u0442 <u>100000000(lamports)<\/u><\/p>\n<pre><code class=\"javascript\">await connection.getBalance(destination.publicKey);<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0442\u0435\u043e\u0440\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 Solana \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0441 \u043d\u0443\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 sol \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430\u043c\u0438. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 &#8212; \u044d\u0442\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0438 \u0431\u0435\u0437\u0443\u043c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u043b\u0430\u0441\u0442 \u0437\u043d\u0430\u043d\u0438\u0439, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0442\u0435\u043c\u044b \u044f \u043d\u0435 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b: PDA \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, SPL \u0442\u043e\u043a\u0435\u043d\u044b, \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c(\u0438 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e Solana). \u0415\u0441\u043b\u0438 \u044f \u0443\u0432\u0438\u0436\u0443 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c, \u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u043b\u0433\u043e \u0436\u0434\u0430\u0442\u044c<\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p><a href=\"https:\/\/t.me\/sssilencer\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0439 \u0442\u0433<\/a><\/p>\n<p><a href=\"https:\/\/docs.solana.com\/ru\/\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Solana<\/a><\/p>\n<p><a href=\"https:\/\/docs.rs\/solana-program\/latest\/solana_program\/\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f solana_program<\/a><\/p>\n<p><a href=\"https:\/\/solana-labs.github.io\/solana-web3.js\/\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Solana web3.js<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/716312\/\"> https:\/\/habr.com\/ru\/post\/716312\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>Program<\/h2>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 &#171;Solana program&#187; &#8212; \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u0432 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442\u0441\u044f \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u044b. \u042d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u043a\u043e\u0434 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u044c\u044e \u043b\u044e\u0431\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0432 \u0441\u0435\u0442\u0438 Solana.<\/p>\n<h2>Instruction<\/h2>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435:<\/p>\n<ol>\n<li>\n<p><strong>Program id<\/strong> &#8212; \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f<\/p>\n<\/li>\n<li>\n<p><strong>Accounts<\/strong> &#8212; \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><strong>Data<\/strong> &#8212; \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ol>\n<h2>System program<\/h2>\n<p>\u042d\u0442\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 <u>sol<\/u>, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0438 \u0442.\u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 <a href=\"https:\/\/docs.solana.com\/ru\/developing\/runtime-facilities\/programs\" rel=\"noopener noreferrer nofollow\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0435<\/a><\/p>\n<h2>\u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c sol<\/h2>\n<h4>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442<\/h4>\n<pre><code class=\"bash\">cargo init sol-transfer --lib<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u0440\u0435\u0439\u0442<\/h4>\n<pre><code class=\"bash\">cargo add solana-program<\/code><\/pre>\n<h4>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u0438 \u0432 lib.rs<\/h4>\n<ul>\n<li>\n<p><strong>account_info::AccountInfo<\/strong> &#8212; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442<\/p>\n<\/li>\n<li>\n<p><strong>account_info::next_account_info<\/strong> &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u0441 <u>AccountInfo<\/u><\/p>\n<\/li>\n<li>\n<p><strong>entrypoint<\/strong> &#8212; \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>entrypoint::ProgramResult<\/strong> &#8212; \u0442\u0438\u043f \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>program::invoke<\/strong> &#8212; \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0436\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439<\/p>\n<\/li>\n<li>\n<p><strong>program_error::ProgramError<\/strong> &#8212; <u>enum<\/u> \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<\/li>\n<li>\n<p><strong>pubkey::Pubkey<\/strong> &#8212; \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430<\/p>\n<\/li>\n<li>\n<p><strong>system_instruction<\/strong> &#8212; \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 <u>System program.<\/u> \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 <u>lamports<\/u> (\u0414\u0440\u043e\u0431\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0421\u043e\u043b\u0430\u043d\u044b)<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">use solana_program::{     account_info::{next_account_info, AccountInfo},     entrypoint,     entrypoint::ProgramResult,     program::invoke,     program_error::ProgramError,     pubkey::Pubkey,     system_instruction, };<\/code><\/pre>\n<h4>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c entrypoint<\/h4>\n<pre><code class=\"rust\">entrypoint!(process_instruction);<\/code><\/pre>\n<h3>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439<\/h3>\n<h4>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b<\/h4>\n<ul>\n<li>\n<p><strong>program_id<\/strong> &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/p>\n<\/li>\n<li>\n<p><strong>accounts<\/strong> &#8212; \u043c\u0430\u0441\u0441\u0438\u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0432 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p><strong>instruction_data<\/strong> &#8212; \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">pub fn process_instruction(     _program_id: &amp;Pubkey,     accounts: &amp;[AccountInfo],     instruction_data: &amp;[u8], ) -> ProgramResult {<\/code><\/pre>\n<h4>\u0410\u043a\u043a\u0430\u0443\u043d\u0442\u044b<\/h4>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440 \u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c\u0438 <u>\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/u> \u0438 <u>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/u><\/p>\n<pre><code class=\"rust\">let accounts_iter = &amp;mut accounts.iter();  let sender = next_account_info(accounts_iter)?; let destination = next_account_info(accounts_iter)?;<\/code><\/pre>\n<h4>Instruction data<\/h4>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0436\u0434\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/docs.rs\/borsh\/latest\/borsh\/\" rel=\"noopener noreferrer nofollow\">borsh<\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u044d\u0442\u043e <a href=\"https:\/\/docs.solana.com\/ru\/developing\/clients\/javascript-reference#struct\" rel=\"noopener noreferrer nofollow\">\u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430\u043c \u0432 \u0434\u0430\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 <u>lamports<\/u>, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u044d\u0442\u043e\u0433\u043e<\/p>\n<p>\u0414\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0439\u0442\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043e\u043b-\u0432\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 \u043c\u043e\u043d\u0435\u0442<\/p>\n<pre><code class=\"rust\">let amount = instruction_data     .get(..8)     .and_then(|slice| slice.try_into().ok())     .map(u64::from_le_bytes)     .ok_or(ProgramError::InvalidInstructionData)?;<\/code><\/pre>\n<h3>System program \u0438 Transfer<\/h3>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 lamports<\/h4>\n<ul>\n<li>\n<p><strong>sender.key<\/strong> &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 <u>\u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/u><\/p>\n<\/li>\n<li>\n<p><strong>destination.key<\/strong> &#8212; \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441 <u>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/u><\/p>\n<\/li>\n<li>\n<p><strong>amount<\/strong> &#8212;  \u043a\u043e\u043b-\u0432\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c\u044b\u0445 <u>lamports<\/u><\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"rust\">let transfer_instruction = system_instruction::transfer(     sender.key,      destination.key,      amount );<\/code><\/pre>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0436\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 <u>sol<\/u> \u0447\u0435\u0440\u0435\u0437 <u>System program<\/u>. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0442\u0440\u0430\u043d\u0441\u0444\u0435\u0440\u0435<\/p>\n<pre><code class=\"rust\">invoke(     &amp;transfer_instruction,     &amp;[sender.clone(), destination.clone()], )?;<\/code><\/pre>\n<h3>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442<\/h3>\n<p>\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0441\u0435 \u0432\u043e\u0435\u0434\u0438\u043d\u043e \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c <strong>Ok(())<\/strong><\/p>\n<pre><code class=\"rust\">pub fn process_instruction(     _program_id: &amp;Pubkey,     accounts: &amp;[AccountInfo],     instruction_data: &amp;[u8], ) -> ProgramResult {      let accounts_iter = &amp;mut accounts.iter();      let sender = next_account_info(accounts_iter)?;     let destination = next_account_info(accounts_iter)?;      let amount = instruction_data         .get(..8)         .and_then(|slice| slice.try_into().ok())         .map(u64::from_le_bytes)         .ok_or(ProgramError::InvalidInstructionData)?;      let transfer_instruction = system_instruction::transfer(         sender.key,          destination.key,          amount     );      invoke(         &amp;transfer_instruction,         &amp;[sender.clone(), destination.clone()],     )?;      Ok(()) }<\/code><\/pre>\n<h3>\u0414\u0435\u043f\u043b\u043e\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 localnet<\/h3>\n<h4>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u0432 .so<\/h4>\n<pre><code class=\"bash\">cargo-build-bpf<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c<\/h4>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0442\u043e\u0440 \u0438 <u>JSON RPC(HTTP API)<\/u><\/p>\n<pre><code>solana-test-validator<\/code><\/pre>\n<h4>\u0414\u0435\u043f\u043b\u043e\u0438\u043c .so \u0444\u0430\u0439\u043b<\/h4>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043c\u0430\u0440\u0442-\u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432 \u0441\u0435\u0442\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 \u0435\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430<u>(Program Id)<\/u><\/p>\n<pre><code class=\"bash\">solana program deploy target\/deploy\/transfer_program.so<\/code><\/pre>\n<h2>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c \u0441 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430<\/h2>\n<h4>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c Solana web3.js<\/h4>\n<p>\u042d\u0442\u043e \u0432\u0435\u0431 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u043e\u043c <u>Solana<\/u> \u0447\u0435\u0440\u0435\u0437 <u>RPC API<\/u> \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 <a href=\"https:\/\/solana-labs.github.io\/solana-web3.js\/\" rel=\"noopener noreferrer nofollow\">\u0432 \u0434\u043e\u043a\u0435<\/a><\/p>\n<pre><code class=\"javascript\">script = document.createElement('script'); script.src = 'https:\/\/unpkg.com\/@solana\/web3.js@latest\/lib\/index.iife.js'; document.body.append(script);<\/code><\/pre>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f<\/h4>\n<p><strong>rpcUrl<\/strong> &#8212; \u043d\u0430\u0448 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 <u>JSON RPC<\/u> \u044d\u043d\u0434\u043f\u043e\u0438\u043d\u0442<\/p>\n<pre><code class=\"javascript\">let rpcUrl = 'http:\/\/127.0.0.1:8899'; let connection = new solanaWeb3.Connection(rpcUrl);<\/code><\/pre>\n<h4>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/h4>\n<pre><code class=\"javascript\">let sender = solanaWeb3.Keypair(); let destination = solanaWeb3.Keypair();<\/code><\/pre>\n<h4>\u0417\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c airdrop 1 SOL \u043d\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044f<\/h4>\n<p><strong>solanaWeb3.LAMPORTS_PER_SO<\/strong>L &#8212; \u043a\u043e\u043b-\u0432\u043e <u>lamports<\/u> \u0432 \u043e\u0434\u043d\u043e\u043c <u>sol <\/u><\/p>\n<pre><code class=\"javascript\">await connection.requestAirdrop(sender.publicKey, solanaWeb3.LAMPORTS_PER_SOL);<\/code><\/pre>\n<h4>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0441 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h4>\n<p>\u042d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438, \u043a\u043e\u0433\u0434\u0430 \u0434\u0435\u043f\u043b\u043e\u0438\u043b\u0438 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442 \u0432 \u0441\u0435\u0442\u044c<\/p>\n<pre><code class=\"javascript\">let programId = new solanaWeb3.PublicKey('YOUR_PROGRAM_ADDRESS')<\/code><\/pre>\n<h3>\u0422\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f<\/h3>\n<h4>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438<\/h4>\n<pre><code class=\"javascript\">let transaction = new solanaWeb3.Transaction();<\/code><\/pre>\n<h4>Transaction data<\/h4>\n<p>\u041a\u0430\u043a \u044f \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u043b, \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u043e \u043f\u0435\u0440\u0435\u0433\u043d\u0430\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0431\u0430\u0439\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0438 \u0447\u0438\u0441\u0442\u044b\u043c <u>JavaScript<\/u>. \u0412\u043e\u0442 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b. \u0423\u0433\u043b\u0443\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u0442\u043e \u043a\u0430\u043a \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044f \u043d\u0435 \u0431\u0443\u0434\u0443<\/p>\n<pre><code class=\"javascript\">function BytesFromInt(n) {let a=[];let fir=n%2**8;n-=fir;a.push(fir);let s=~~(n%2**16\/2**8);n-=s;a.push(s);let t=~~(n%2**24\/2**16);n-=t;a.push(t);let fo=~~(n%2**32\/2**24);n-=fo;a.push(fo);let fif=~~(n%2**40\/2**32);n-=fif;a.push(fif);return a.concat([0,0,0]);}<\/code><\/pre>\n<h4>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e<\/h4>\n<ul>\n<li>\n<p><strong>isSigner: true<\/strong> &#8212; \u044d\u0442\u043e\u0442 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e \u0441\u0432\u043e\u0438\u043c \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u0430 \u0442\u0430\u043a \u0436\u0435 \u043f\u043b\u0430\u0442\u0438\u0442 \u043a\u043e\u043c\u0438\u0441\u0441\u0438\u044e<\/p>\n<\/li>\n<li>\n<p><strong>isWritable: true<\/strong> &#8212; \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"javascript\">transaction.add(new solanaWeb3.TransactionInstruction({     keys: [{         \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c         pubkey: sender.publicKey,         isWritable: true,         isSigner: true     }, {         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c         pubkey: destination.publicKey,         isWritable: true,         isSigner: false     }, {         \/\/ System program         pubkey: solanaWeb3.SystemProgram.programId,         isWritable: false,         isSigner: false     }],     \/\/ \u0410\u0434\u0440\u0435\u0441 \u043d\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b      programId: programId,     \/\/ \u041a\u043e\u043b-\u0432\u043e sol, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c - 0.1 sol     data: BytesFromInt(0.1*solanaWeb3.LAMPORTS_PER_SOL) }));<\/code><\/pre>\n<h4>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c!<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0442\u0443\u0442 &#8212; \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0430\u0440 \u043a\u043b\u044e\u0447\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"javascript\">await solanaWeb3.sendAndConfirmTransaction(connection, transaction, [sender]);<\/code><\/pre>\n<h4>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0431\u0430\u043b\u0430\u043d\u0441<\/h4>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0431\u0430\u043b\u0430\u043d\u0441 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 <u>\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f<\/u>. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0432\u044b\u0437\u043e\u0432 \u0432\u0435\u0440\u043d\u0435\u0442 <u>100000000(lamports)<\/u><\/p>\n<pre><code class=\"javascript\">await connection.getBalance(destination.publicKey);<\/code><\/pre>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u0434\u043e\u043d\u0435\u0441\u0442\u0438 \u0442\u0435\u043e\u0440\u0438\u044e \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d\u0430 Solana \u0438 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0441 \u043d\u0443\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 sol \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043a\u043e\u0448\u0435\u043b\u044c\u043a\u0430\u043c\u0438. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u043b\u043e\u043a\u0447\u0435\u0439\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 &#8212; \u044d\u0442\u043e \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u0438 \u0431\u0435\u0437\u0443\u043c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u043b\u0430\u0441\u0442 \u0437\u043d\u0430\u043d\u0438\u0439, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0442\u0435\u043c\u044b \u044f \u043d\u0435 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u043b: PDA \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, SPL \u0442\u043e\u043a\u0435\u043d\u044b, \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c(\u0438 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e Solana). \u0415\u0441\u043b\u0438 \u044f \u0443\u0432\u0438\u0436\u0443 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c, \u0442\u043e \u0432\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0435 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442 \u0441\u0435\u0431\u044f \u0434\u043e\u043b\u0433\u043e \u0436\u0434\u0430\u0442\u044c<\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p><a href=\"https:\/\/t.me\/sssilencer\" rel=\"noopener noreferrer nofollow\">\u041c\u043e\u0439 \u0442\u0433<\/a><\/p>\n<p><a href=\"https:\/\/docs.solana.com\/ru\/\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Solana<\/a><\/p>\n<p><a href=\"https:\/\/docs.rs\/solana-program\/latest\/solana_program\/\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f solana_program<\/a><\/p>\n<p><a href=\"https:\/\/solana-labs.github.io\/solana-web3.js\/\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Solana web3.js<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/716312\/\"> https:\/\/habr.com\/ru\/post\/716312\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-345645","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/345645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=345645"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/345645\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=345645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=345645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=345645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}