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
    satoshis.
  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.

BENEFITS:

  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?

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

thanks

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: https://developer.apple.com/documentation/multipeerconnectivity).

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.

Thanks,
Prad

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

This is what my conf file looks like:

prune=600
maxconnections=12
maxuploadtarget=20
rpcuser=user
rpcpassword=password
keypool=10000
server=1

[main]
rpcport=5040

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 127.0.0.1 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:

2NA3vs7QUdoXhUELUAGkGUv1Cuy1DpM4uPs

The funding transaction can be seen here:
https://api.blockcypher.com/v1/btc/test3/txs/56fd7329a72cb48a517b6a396a8fa537190ad1f72333781b21dbfd8ae1616dd6?limit=50&includeHex=true

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?

testnet.blockchain.info api not showing latest results?

I sent a transaction to the testnet address mzWCWQU6phb9rKSAiQ4FBU92sGYtY7tjPH a few days ago and I have been using the testnet.blockchain.info 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:

https://testnet.blockchain.info/multiaddr?active=mzWCWQU6phb9rKSAiQ4FBU92sGYtY7tjPH

and this is the same address on Blockcypher:

https://live.blockcypher.com/btc-testnet/address/mzWCWQU6phb9rKSAiQ4FBU92sGYtY7tjPH/

Does anyone know what the issue is?

Unable to find peers when connecting through tor proxy

I have tor running as a service on my computer and start bitcoind with -proxy=127.0.0.1:9050 but it fails to find any seeds through DNS or anything during startup, and even after leaving it on for more than a day it still not finding peers. I’m not getting any errors with connection or anything, and if I change port to for example 9051, it complains indicating that tor is running ok.
Also, if I run it without the proxy option I get peers immediately and syncing starts right away. Can someone please help me? I’m running 0.17.1.

Here is also a little bit of the console print during startup. I was running it without proxy right before this so it got a few blocks:

2019-03-12T00:45:31Z Loaded 8954 addresses from peers.dat  23ms
2019-03-12T00:45:31Z init message: Loading banlist...
2019-03-12T00:45:31Z init message: Starting network threads...
2019-03-12T00:45:31Z addcon thread start
2019-03-12T00:45:31Z init message: Done loading
2019-03-12T00:45:31Z net thread start
2019-03-12T00:45:31Z opencon thread start
2019-03-12T00:45:31Z dnsseed thread start
2019-03-12T00:45:31Z msghand thread start
2019-03-12T00:45:42Z Loading addresses from DNS seeds (could take a while)
2019-03-12T00:45:42Z 0 addresses found from DNS seeds
2019-03-12T00:45:42Z dnsseed thread exit
2019-03-12T00:46:02Z Syncing txindex with block chain from height 13187

When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?

In a recent talk Pieter Wuille talked about speed up verification when using Schnorr signatures and various algorithms for verifying multiple signatures.

Would it really be possible to verify one single block by aggregating the keys and signatures of all transactions? (In theory even more transactions over several blocks)

I assume this does imply that the old ECDSA scheme would not be used anymore. If we were backwards compatible we could probably only do this for transactions that used Schorr signatures where as the other ones would have to be verified one by one.

(Leaving aside politics of drastic protocol changes) Couldn’t we even save more space if we adopt the block header to include one aggregate Schnorre signature for the block and leave out all the schnorr signatures of the single transactions within that block?

Did I miss anything? The talk did not give many details but just mentioned the idea.