JavaScript Mining System Design

0

How do I verify a unconfirmed transaction using JavaScript ?

Hide7

Posted 2019-08-27T20:30:11.913

Reputation: 1

1

To verify any transaction, you must be running a full node. Since you mention JavaScript, you might be interested in bcoin: https://github.com/bcoin-org/bcoin

pinhead 2019-08-27T20:37:40.500

@pinhead Please share some demo codes.Hide7 2019-08-27T20:39:41.613

1

There’s more docs and guides at https://bcoin.io if you can’t find what you need there, join our slack or chat with us on IRC #bcoin

pinhead 2019-08-27T21:08:03.937

Answers

1

It is not possible to verify just a single transaction, without knowing the state of the network. To know the state of the network, you must verify all of it's historical transactions (aka, run a full node).

So this means it is not possible to just take a single transaction alone, and verify it using some bit of code. Rather, you will need the entire history of transactions, so that you can determine whether the transaction is valid in relation to the current state of the network (ie, does the person who is attempting to spend some coins rightfully own them?).

There are various implementations of a bitcoin node available, written in various languages. You'll want to find one that you can interact with programmatically using javascript.

EDIT: I now see you seem to be asking about building some mining software. My answer above still holds true (you'll need a full node to determine the network state and create block templates), but otherwise I think your question (build mining software) is overly broad.

chytrik

Posted 2019-08-27T20:30:11.913

Reputation: 10 276