GithubHelp home page GithubHelp logo

bsv-transaction's Introduction

Creating a BSV Transaction

Creating a public/private key pair. Then, sending BSV to the public address from Money Button. Then, sending the BSV from that public address to another public address, or back to Money Button.

Prerequisites

  • ensure node is installed
  • run npm install to install the dependencies in package.json
  • have a Money Button account or any other BSV wallet
  • that should do it

Step 1

run node address.js to generate a public and private key pair.

Be sure you keep both your Public and Private Keys because you'll need them to be able to access your BSV.

⚠️ If you lose your Private Key, you lose your BSV. ⚠️

The output from running the script above will look similar to:

privateKeyString cRcHetYy7gyxVvHn6tTV5b8yvycEBLPDTj8ZVgf6fJKDUowC9i3V
publicAddress mitR9nkAcaqEkbifFUZWMmiS8nJL9LPDuK

Your keys will be different than the above.

You can now send BSV to the public address using Money Button or any wallet that supports BSV.

Try sending a small amount of BSV, like 10 or 25 cents, from Money Button.

Step 2

After Step 1, you should now have a small amount of BSV in an address you have created!

Use a service like https://whatsonchain.com/, and enter your public key to see the bitcoin transaction (Tx) representing the BSV transfer you just made.


Then check the transaction on whatsonchain and copy the data

This object has important information including:

  • address
  • amount
  • confirmations

Most importantly, you're going to need some of this information in Step 3, so be sure to note it in full, and accurately.

[
  {
    "address": "1CGoU6rc6hVgj3uXEbbrmVUsmdRgzU72Fs",
    "txid": "b4acafc6ecc8fc2e8497bf9d8b2bd411ab4410fc6662a9f9a0ba011da49669ac",
    "vout": 1,
    "amount": 0.01150839,
    "satoshis": 1150839,
    "value": 1150839,
    "height": 0,
    "confirmations": 0,
    "scriptPubKey": "76a9147ba66976545535f7aa0a503d132a62d5323433b988ac",
    "script": "76a9147ba66976545535f7aa0a503d132a62d5323433b988ac",
    "outputIndex": 1
  }
]

Step 3

By now, you should have seen your transaction in Step 1, and now have a .json object that represents your UTXO (unspent transaction).


Now, update sendTransaction.js with 3 things:

  1. Your public key
  2. Your private key
  3. Another new public key

The public/private key pair is needed to access then unlock the Tx you originally posted.

The new public key is where you're going send these funds to.

I just used the public address to my Money Button account for the new public key.


run node sendTransaction.js which will create a Transaction from your last UTXO, and broadcast it to the bitcoin mining network.

You will receive a Transaction ID.

And you will be able to see a transaction for the funds, sent a new public address... or in my case, back to my public Money Button address.

bsv-transaction's People

Contributors

gowthamnaruto avatar

Stargazers

Karthigeyan Sivananthan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.