2

which api i can use to tranfer BTC from one address to another. I have knowledge about bitcoin-transaction api but it does not allow to setup fees. We have try this api but it cost too much high for micro transactions.

If there is any option to setup fees i would prefer it because it not complex compared to others.

Rushabh Madhu
  • 163
  • 1
  • 9

2 Answers2

2

Learn bitcore-lib npm package:

Bitcore library provides a very simple API for creating transactions. Let's take a very simple transactions:

var transaction = new Transaction()
    .from(utxos)          // Feed information about what unspent outputs one can use
    .to(address, amount)  // Add an output with the given amount of satoshis
    .change(address)      // Sets up a change address where the rest of the funds will go
    .sign(privkeySet)     // Signs all the inputs it can
0

You can use the send-crypto to transfer bitcoin

npm install --save send-crypto

or

yarn add send-crypto

const CryptoAccount = require("send-crypto");

/* Load account from private key */ const privateKey = process.env.PRIVATE_KEY || CryptoAccount.newPrivateKey(); const account = new CryptoAccount(privateKey);

/* Print address */ console.log(await account.address("BTC")); // > "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"

/* Print balance */ console.log(await account.getBalance("BTC")); // > 0.01

/* Send 0.01 BTC */ const txHash = await account .send("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa", 0.01, "BTC") .on("transactionHash", console.log) // > "3387418aaddb4927209c5032f515aa442a6587d6e54677f08a03b8fa7789e688" .on("confirmation", console.log); // > 1 // > 2 ...

And also you can check the reference link https://www.npmjs.com/package/send-crypto