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.

1
  • Bitcoinjs-lib allows fairly granular control over fees and transaction parts in general. Jun 29, 2018 at 16:32

2 Answers 2

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
3
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.