Giter VIP home page Giter VIP logo

raw-tx-listener's Introduction

RAW-TX-Listener

This server is intended to send raw transaction into Blockchain by turns.

Case

▶️You want to send two or more transactions to different addresses

▶️Every transaction should consists of two outputs (receiver address and change to you)

Problem

❓ How you can sign new transaction without confirming the last?

🤔 So, new output of your address haven't confirmed yet. What you can do?

Solution

✅ Generate first signed transaction

✅ Artificially generate outputs of second transaction

  1. Get used output amount from first transaction
  2. This amount minus send sum minus miner fee will be you new output amount
  3. Generate tx id of first signed transaction
    3.1.Let's say that signed data of this tx is S
    3.2.Future tx id of this transaction will sha256(sha256(S)).reverse()
  4. Get another meta information and push it into second tx output
  5. Sign second transaction

✅ Wait while first transaction will be confirmed

✅ Send second signed transaction into Blockchain

Start it!


npm i

node server.js

or


sudo docker build -t listener .

sudo docker run -p 3003:3003 listener

How works this server?

  • URL /utxo_tx
  • Method POST
  • Body Params
type: Object

{
    currency: {String} "BTC" or "BCH" or "LTC"
    network: {String} - "testnet" or "livenet"
    senderAddress: {String} - Sender address
    signedTransactions: {Array} - Array of signed transactions
}
  • Response
{error: null|Error, result: 'success'|null}

What library can help you to sign transactions like this?

Using lighty-sig library you can easy sign several transactions and push it into blockchain using this server.

Look at signTransaction method into lighty-sig library. (the last argument should be "1")

raw-tx-listener's People

Contributors

krboktv avatar

Watchers

 avatar  avatar

Forkers

button-tech

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.