0

I am messing with the Bitcoin sourcecode.

Normally when you want to send some BTC you type :

./bitcoind sendtoaddress 1ADRESSS 0.001 

How would you do this in the sourcecode on a recurring basis?

So what code is needed to send a transaction to a specified address each time a block is created? Almost like a tax. and where would this code be placed?

I am learning the Inside of the Bitcoin protocol and C++ so any help would be great.

  • So you want a script that will spend your money without asking your permission? It's doable, but very dangerous. YOu would be better off looking at multi-signature or escrow transactions. – T9b Jun 8 '14 at 10:28
1

You can make use of the -blocknotify=<cmd> facility as described under: https://en.bitcoin.it/wiki/Running_Bitcoin.

This is a nice example of how to use -walletnotify: https://bitcoin.stackexchange.com/a/24483/11221, -blocknotify can be configured in exactly the same way.

0

The table of RPC commands can be found in rpcserver.cpp in the static array vRPCCommands. From that you can see that the RPC command sendtoaddress is implemented by a C++ function named, appropriately enough, sendtoaddress. A quick grep shows this function is defined in rpcwallet.cpp, and its work is done by calling pwalletMain->SendMoney(). So pwallet->SendMoney() seems like the right function to call.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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