Bitcoin Forum
April 26, 2024, 04:25:56 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Where are functions: Add transaction, Sign transaction, Check transaction ...  (Read 136 times)
skylord56 (OP)
Member
**
Offline Offline

Activity: 96
Merit: 10


View Profile WWW
May 22, 2018, 03:59:33 PM
 #1

Hi,

I need to know where are the functions responsible to:
- Add transaction
- Sign the transaction by private key
- Check the transaction by nodes
- Add to mempool

In the bitcoin code please ?

What is the function reponsible to check if transaction can be added to block by all nodes, and if it's correct ?

Thank's

1714105556
Hero Member
*
Offline Offline

Posts: 1714105556

View Profile Personal Message (Offline)

Ignore
1714105556
Reply with quote  #2

1714105556
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714105556
Hero Member
*
Offline Offline

Posts: 1714105556

View Profile Personal Message (Offline)

Ignore
1714105556
Reply with quote  #2

1714105556
Report to moderator
1714105556
Hero Member
*
Offline Offline

Posts: 1714105556

View Profile Personal Message (Offline)

Ignore
1714105556
Reply with quote  #2

1714105556
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
May 22, 2018, 07:22:17 PM
 #2

- Add transaction
Add transaction to what?

- Sign the transaction by private key
The code for the RPC command signrawtransactionwithwallet can be found here. Follow the code and it will take you to where transactions are actually signed. Starting with this command shows you the whole process.

- Check the transaction by nodes
- Add to mempool
Checking a transaction is done when it is being added to the mempool (the same functions are used for checking transactions in blocks). Just follow the code for AcceptToMemoryPool

skylord56 (OP)
Member
**
Offline Offline

Activity: 96
Merit: 10


View Profile WWW
May 22, 2018, 07:32:48 PM
 #3

- Add transaction
Add transaction to what?

- Sign the transaction by private key
The code for the RPC command signrawtransactionwithwallet can be found here. Follow the code and it will take you to where transactions are actually signed. Starting with this command shows you the whole process.

- Check the transaction by nodes
- Add to mempool
Checking a transaction is done when it is being added to the mempool (the same functions are used for checking transactions in blocks). Just follow the code for AcceptToMemoryPool

By Add Transaction i mean: Create a new transaction.

Transaction is checked first and added to Mempool waiting for miners no ?

Many thank's

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
May 22, 2018, 07:36:11 PM
 #4

By Add Transaction i mean: Create a new transaction.
Follow the code for createrawtransaction. If you are interested in how the wallet works, then follow the code for sendtoaddress

Transaction is checked first and added to Mempool waiting for miners no ?
Yes. However the checking and adding to mempool are done as part of the same function. The AddToMemoryPool function will call the various checking functions for checking a transaction and then add it to the mempool at the end. It also performs its own checks for the additional conditions of adding a transaction to the mempool (e.g. conflicts, replacement, transaction fee, etc.).

skylord56 (OP)
Member
**
Offline Offline

Activity: 96
Merit: 10


View Profile WWW
May 22, 2018, 07:39:11 PM
 #5

By Add Transaction i mean: Create a new transaction.
Follow the code for createrawtransaction. If you are interested in how the wallet works, then follow the code for sendtoaddress

Transaction is checked first and added to Mempool waiting for miners no ?
Yes. However the checking and adding to mempool are done as part of the same function. The AddToMemoryPool function will call the various checking functions for checking a transaction and then add it to the mempool at the end. It also performs its own checks for the additional conditions of adding a transaction to the mempool (e.g. conflicts, replacement, transaction fee, etc.).

First thank you for the explaignation, really appreciated Smiley

SignSignature is the one that sign a transaction with private key no ?

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
May 22, 2018, 07:50:40 PM
 #6

SignSignature is the one that sign a transaction with private key no ?
No, ProduceSignature is. SignSignature is not actually used outside of tests.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!