create multi wallet steem/sbd transfer script.

in Steem Dev2 years ago (edited)


IMG-20230117-WA0002.jpg

Hello, Everyone.
I hope everything is fine.This is my first post to the Steem Dev Community. It's also my first post as a moderator in this community. This community is only for Steem blockchain development-based idea sharing, tutorials, projects, or any type of development-related topic.

Today I am sharing a tutorial about how to create a simple multi-wallet STEEM/SBD transfer script using the steem-js library.Lets Start. It's very easy and simple. We don't use enough CSS code to make it mobile-responsive and gorgeous. We only focus on the script here. Lets Start..

First When we create an HTML page in Notepad or any other code editor, we write the basic HTML structure like below:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Multi Wallet Transfer tool.</title>
</head>
<body>

<script>


</script>
</body>
</html>

Then we use the steem-js cdn source link in the head tag:

<script src="https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js"></script>

Then we create a form like below in the body tag.:

<form>
<label><b>From Username:</b> </label><input type="text" autocomplete="username" style="width:200px;"  placeholder="Without @  ex: moh.arif"  id="from_username"><br><br>
<label><b>Private Active Key:</b> </label><input type="password" autocomplete="current-password" style="width:385px;" placeholder="active key"  id="wif"><br><br> 
<textarea placeholder="Example : rme 0.1 steem/sbd memo." rows="6" cols="70" id="box"></textarea><br><br>      
<input type="button" value="Transfer" onclick="transfer()"><br><br><br>
<textarea  readonly placeholder="Successful transaction lines will be shown here..." rows="6" cols="70"  id="rcv"></textarea><br><br>
</form>

Then we write script code that includes a function called "transfer," which is called when the Transfer button is pressed. If you analyze the full code, I think you understand all these things clearly.

The complete code is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Multi Wallet Transfer tool.</title>
    <script src="https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js"></script>
</head>

<body>
<center>
    <b>Total Transfer Given :</b> <input readonly style="height:12px;width:30px"  type="text" id="transfer-count"></b><br>
    <b>Total successful Transfer: </b> <input readonly style="height:12px;width:30px"  type="text" id="sucessful-transfer"></b><br>
    <b>Total Failed Transfer: </b> <input readonly style="height:12px;width:30px"  type="text" id="unsucessful-transfer"></b><br><br>

<form>
<label><b>From Username:</b> </label><input type="text" autocomplete="username" style="width:200px;"  placeholder="Without @  ex: moh.arif"  id="from_username"><br><br>
<label><b>Private Active Key:</b> </label><input type="password" autocomplete="current-password" style="width:385px;" placeholder="active key"  id="wif"><br><br> 
<textarea placeholder="Example : rme 0.1 steem/sbd memo." rows="6" cols="70" id="box"></textarea><br><br>      
<input type="button" value="Transfer" onclick="transfer()"><br><br><br>
<textarea  readonly placeholder="Successful transaction lines will be shown here..." rows="6" cols="70"  id="rcv"></textarea><br><br>
</form>
</center>

<script>
function transfer(){
var from= document.getElementById("from_username").value.toLowerCase();
var key= document.getElementById("wif").value;
var text= document.getElementById("box").value;
var memo="";
var s_lines= "successful Transfer Lines: \n";
var i;
var st=0;
var ust=0;

setTimeout(function() { 
    var array1= text.split("\n");
    for( i=0;i<array1.length;i++){
        var array2=array1[i].split(" ");
        var to= array2[0].toLowerCase();
        var asset_ammount = Number(array2[1]).toFixed(3);
        var asset= array2[2].toUpperCase();
        var amount =asset_ammount+" "+asset;
            for(var j=3;j<array2.length;j++){
                 memo+= array2[j]+" ";}
                 
                 
                 steem.broadcast.transfer(key, from, to, amount, memo, function(err, result) {
                    if (!err){
                        s_lines+= (result.operations[0][1].to+" "+result.operations[0][1].amount+" "+result.operations[0][1].memo+"\n");
                        console.log(result.operations[0][1].to+" "+result.operations[0][1].amount+" "+result.operations[0][1].memo);
                        st+=1;}   
                    if (err){
                        console.log(err);
                        ust+=1;}
                    document.getElementById("transfer-count").value = i;
                    document.getElementById("sucessful-transfer").value = st;
                    document.getElementById("unsucessful-transfer").value = ust;
                    document.getElementById("rcv").value = s_lines;
                     });
            memo="";
}}, 3000 * i); 
}
</script>
</body>
</html>



You can use multi wallet steem/sbd transfer from here: https://amarbanglablog.w3spaces.com/transfer.html Thanks everyone for reading this tutorial. Bye.

@steemcurator01 , @hungry-griffin, @blacks , @rme

Sort:  

This post has been upvoted by @italygame witness curation trail


If you like our work and want to support us, please consider to approve our witness




CLICK HERE 👇

Come and visit Italy Community



Hi @moh.arif,
my name is @ilnegro and I voted your post using steem-fanbase.com.

Come and visit Italy Community

This post has been featured in the latest edition of Steem News...

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.029
BTC 65472.04
ETH 3323.59
USDT 1.00
SBD 2.63