Send $SGB (Songbird) to another wallet using a script

You need nodejs and web3 to run it: 
const Web3 = require('web3');

// Variables definition
const privKey =
 '8xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx2'; // Genesis private key
const addressFrom = '0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA';
const addressTo = '0xBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB';
const web3 = new Web3('https://songbird.towolabs.com/rpc');

// Create transaction
const deploy = async () => {
   console.log(
      `Attempting to make transaction from ${addressFrom} to ${addressTo}`
   );

   const createTransaction = await web3.eth.accounts.signTransaction(
      {
         from: addressFrom,
         to: addressTo,
         value: web3.utils.toWei('1', 'ether'),  // Send 1 SGB. 'ether' is not a typo here.
         gasPrice: web3.utils.toWei('225', 'Gwei'),
         gas: '21000',
      },
      privKey
   );

   // Deploy transaction
   const createReceipt = await web3.eth.sendSignedTransaction(
      createTransaction.rawTransaction
   );
   console.log(
      `Transaction successful with hash: ${createReceipt.transactionHash}`
   );
};

deploy();

Comments

Popular posts from this blog

portage-2.2 preserve-libs FEATURES explained

The diff between the original SEC complaint against Ripple and the amended one