how to generate bitcoin adddres using seed?

Hi i am new to bitcoin all i want to know is how to generate address using mnemonic seed?

let testnet =Bitcoin.networks.testnet;
let keypair =Bitcoin.ECPair.makeRandom({network:testnet});
let address=keypair.getAddress();
let privateKey=keypair.toWIF();
res.json("Public Address  "+ address+ "  "+privateKey)

Proof of work – lottery approach

I’m sure I am missing something here. But not sure what …

Proof of work – after all is said and done, when a hash is found (about 10 min), it is said to be like someone hitting the lottery. Anyone that wins the lottery should be able to prove that a cost was incurred. So there are two things:

  1. Include a cost to finding the hash.
  2. The winner is considered “random” because finding the hash is an iterative guessing process.

The result is a huge energy burn and the result “mimics” a random winner.

QUESTION: Can the bitcoin network randomly select a subset of the existing nodes, for each block, who then compete to solve the hash? For example, if there are 100,000 nodes, the network randomly selects 10% or 10,000 nodes who are allowed to compete to find the hash. Or take it to a smaller number like 1% or 1,000 nodes, etc.

The burning question is: Why can we not mimic the proof of work process and save a ton of energy along the way?

Why not have all the nodes that wish to enter each block lottery pay a small fee. They all currently incur electricity cost so from a financial standpoint, does it matter whether they pay a small lottery fee or pay a small fee to the electric company?

EXAMPLE: for the next block, here is the process:

  1. All 100,000 nodes pay (arbitrary number for now to make point) 1000
  2. The bitcoin network randomly (maybe this is tricky part)
    selects a subset percentage. Say 10% or 10,000 nodes. These are the nodes that compete for the next block entry.


  1. There is still a cost incurred by each participant without the energy usage.
  2. The energy usage is now a fraction of the total network participation for the iterative hash search.
  3. It can allow more node participation by less powerful computers. A laptop will still be at a disadvantage, but is now competing against 9,999 other computers instead of the hashing power of the entire network.

To make sense of this is the fact that the end result of the current process is a “random” winner that can prove a cost has been incurred.

Can the lottery fee approach achieve the same goal without sacrificing security?

Why future Bitcoin Core release shouldn’t be in python?

Python offers various advantages including simplified rules of coding and ease of readability. It offers OOP, cross platform compatibility and has numerous libraries that have been added over time. It can be understood why the original Bitcoin Core client was in C++ as python was not that popular as it is now.

Apart, from having to tear down the entire code, and re-write it in python and check for vulnerabilities, why aren’t the core bitcoin developers thinking of migrating the entire reference client implementation language to python?

How to backup seed in lightning and give your channel to watchtower

this is followup on question #85475:

I have learned in previous question that there is an automatic refund mechanism in case of force closure of a channel, except for some very rare circumstances. I would like to ask about two of those circumstances:

1-how to “back up your channel state” or how to back up your seed in lightning?
(is “channel state” here a synonym for “seed”?)

And why do people say the “seed” works differently in lightning compared to btc – differently how?

2-how can you “give your channel to a watchtower” ? IN practical terms, if you use a current lightning wallet


Are Bitcoin wallet apps on iOS truly decentralised

The only offering for p2p support on iOS that I’m aware of is the MultipeerConnectivity framework. Based on its documentation, it only seems to support nearby devices (ref:

Now, by “truly decentralised”, I mean no use of a backend whatsoever.

Perhaps there’s something I might be missing. If wallet apps are indeed, truly decentralised, how do they achieve this?

Need to use two bitcoin core but issue with syncing

Need to know how we can use two bitcoin node for example. I do have two bitcoin full nodes A and B. Created wallet address at A and has all transaction details at wallet.db in node A. But I need to keep PK in DB and take those and send request to B node, but it fails as it dont have all transaction details, I dont want to re scan B node every time, is there any way we can achieve this. So that i dont need to worry on which node my request is going.


How do I configure a port in my .conf file?

This is what my conf file looks like:



Whenever I run this from the command line I get the following error:

Binding RPC on address ::1 port 5040 failed.

Binding RPC on address port 5040 failed.

I checked for port 5040 using the netstat -a and it was listening, what’s the problem?

How to spend a multisignature, CLTV time-locked UTXO?

I am using this locking script with libbitcoin explorer to create a bitcoin testnet transaction:

bx script-to-address -v 196 "[efa716] checklocktimeverify drop 2 [02bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b] [02c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d] 2 checkmultisig"

This gives me the receiving address:


The funding transaction can be seen here:

I create a raw transaction using bitcoin-cli, because bx unexpectedly changes the send-to-address. I have tried setting locktime to 00000000, 4294967295, and not specifying nlocktime at all.

bitcoin-cli -named createrawtransaction inputs='''[ { "txid": "'56fd7329a72cb48a517b6a396a8fa537190ad1f72333781b21dbfd8ae1616dd6'", "vout": '1' } ]''' outputs='''{ "'2N2zbPDQWhcs5niMKqQ4dz8m8jxU5izkabh'": 0.00800000}''' locktime=00000000

Next, both signatures are applied to the transaction, using the appropriate private keys and bx input-sign.

bx input-sign 46d170451e8565c9b5233ca160ba1aee9680f24059fa565af17ef11f80cc7d43 "[efa716] checklocktimeverify drop 2 [02bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b] [02c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d] 2 checkmultisig" 0200000001d66d61e18afddb211b783323f7d10a1937a58f6a396a7b518ab42ca72973fd560100000000ffffffff0100350c000000000017a9146aece0dbf34db9b86c8aab5e9ecb2b37c669b44f8700000000

bx input-sign 53064d99236c9e5fe30d2fe2dc3a5f6cd2374cac3f5c997a327218381d41c7d7 "[efa716] checklocktimeverify drop 2 [02bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b] [02c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d] 2 checkmultisig" 0200000001d66d61e18afddb211b783323f7d10a1937a58f6a396a7b518ab42ca72973fd560100000000ffffffff0100350c000000000017a9146aece0dbf34db9b86c8aab5e9ecb2b37c669b44f8700000000

This gives the endorsements:

endorsement1 = 30450221008694e53196e222ed86935d9c2d16c14baec194d70e3eed474bc2423ec8adcf4f02204d6a72b87f190684a5f52228620d77357be5dd3265bfcdfd16d9a260a09fa33401
endorsement2 = 304402207006d5e588298cd8ae2cd2430c1cba38b3a0a31bbee8ea0ab0349e509e50e9b802200207fc65e28acb070f9fa9cfc11ae06b4b10c112daa23fb05f9e297c430580e301

The script is encoded:

bx script-encode "[efa716] checklocktimeverify drop 2 [02bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b] [02c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d] 2 checkmultisig"

And finally:

bx input-set "zero [30450221008694e53196e222ed86935d9c2d16c14baec194d70e3eed474bc2423ec8adcf4f02204d6a72b87f190684a5f52228620d77357be5dd3265bfcdfd16d9a260a09fa33401] [304402207006d5e588298cd8ae2cd2430c1cba38b3a0a31bbee8ea0ab0349e509e50e9b802200207fc65e28acb070f9fa9cfc11ae06b4b10c112daa23fb05f9e297c430580e301] [03efa716b175522102bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b2102c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d52ae]" 0200000001d66d61e18afddb211b783323f7d10a1937a58f6a396a7b518ab42ca72973fd560100000000ffffffff0100350c000000000017a9146aece0dbf34db9b86c8aab5e9ecb2b37c669b44f8700000000

I can validate using bx:

bx input-validate 02bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b "[efa716] checklocktimeverify drop 2 [02bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b] [02c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d] 2 checkmultisig" 30450221008694e53196e222ed86935d9c2d16c14baec194d70e3eed474bc2423ec8adcf4f02204d6a72b87f190684a5f52228620d77357be5dd3265bfcdfd16d9a260a09fa33401 0200000001d66d61e18afddb211b783323f7d10a1937a58f6a396a7b518ab42ca72973fd5601000000e1004830450221008694e53196e222ed86935d9c2d16c14baec194d70e3eed474bc2423ec8adcf4f02204d6a72b87f190684a5f52228620d77357be5dd3265bfcdfd16d9a260a09fa3340147304402207006d5e588298cd8ae2cd2430c1cba38b3a0a31bbee8ea0ab0349e509e50e9b802200207fc65e28acb070f9fa9cfc11ae06b4b10c112daa23fb05f9e297c430580e3014c4d03efa716b175522102bceab65ad6b5e3c1d6683b1d0ffd7bce572ce3ece0f1976fb04ba34bb0359c1b2102c4916c1c044bda56670f28efdb6637fa24448f5184839f917a473abfd81e6d3d52aeffffffff0100350c000000000017a9146aece0dbf34db9b86c8aab5e9ecb2b37c669b44f8700000000

Endorsement is valid

However, when using bitcoin-cli sendrawtransaction, I always see one of these error messages:

# No nlocktime set, or set at 0
error code -26
error message:
non-mandatory-script-verify-flag (Locktime requirement not satisfied) (code 64)

# nLocktime set for max or 4294967295
error code -26
error message:
non-final (code 64)

I have seen this thread:
Transaction still unspendable with CLTV

But even though I have broadcasted the transaction via a block explorer, the transaction seems to be ignored. What could the cause of this? api not showing latest results?

I sent a transaction to the testnet address mzWCWQU6phb9rKSAiQ4FBU92sGYtY7tjPH a few days ago and I have been using the api for a while now in my project.
It was working fine last month but now it doesn’t seem to be getting the latest transactions.

This is the api call:

and this is the same address on Blockcypher:

Does anyone know what the issue is?