Bitcoin Forum
May 06, 2024, 07:03:39 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Please, help with bitcoin core  (Read 328 times)
MrNaif (OP)
Jr. Member
*
Offline Offline

Activity: 49
Merit: 23


View Profile
October 23, 2018, 04:09:06 AM
 #1

Hello bitcoin devs! I'm new to bitcoin core.
And I have installed full node bitcoin core on my server(prune=500 in bitcoin.conf if it changes something).
I'm working on a project where I need only a few things:
1. Create bitcoin address which forwards 30% send to it to hot wallet, other 70% to cold wallet.
2. Send bitcoins from wallet(hotwallet) to other users.
3. When user paid to address created, send notification to callback_handler.
Please, help me to figure out which commands to use.
getnewaddress creates address,but without separaton and callback handler.
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
October 23, 2018, 04:20:04 AM
Merited by bones261 (1)
 #2

1. Create bitcoin address which forwards 30% send to it to hot wallet, other 70% to cold wallet.
getnewaddress

2. Send bitcoins from wallet(hotwallet) to other users.
Use sendmany to send to multiple recipients

3. When user paid to address created, send notification to callback_handler.
You can start Bitcoin Core with the -walletnotify=<cmd> option where <cmd> is a command (i.e. a script) that Bitcoin Core will execute when a transaction is received. Read the help text (start with -help) for more information.

MrNaif (OP)
Jr. Member
*
Offline Offline

Activity: 49
Merit: 23


View Profile
October 23, 2018, 01:30:30 PM
 #3

But getnewaddress creates address based on one account. And I need separation between two wallets(accounts)-30% to hot wallet, 70% to cold.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
October 23, 2018, 03:04:08 PM
 #4

But getnewaddress creates address based on one account. And I need separation between two wallets(accounts)-30% to hot wallet, 70% to cold.
An address is not a program, it can't forward anything automagically. You will need to have something that waits for transactions to that address and creates the forwarding transaction for you. You can do this by using -walletnotify.

bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
October 24, 2018, 11:11:54 AM
Merited by bones261 (2), ABCbits (1)
 #5

You can't achieve all of this functionality in core.

Core is a wallet. Not a hot-/cold- wallet seperation and deposit software.

You'll need to build your software around utilizing core's RPC's.



1. Create bitcoin address which forwards 30% send to it to hot wallet, other 70% to cold wallet.

Simply check the received amount and either (1) instantly create a new transaction (not recommended) or (2) batch transactions until you have X, then split them as you wish using sendmany.


2. Send bitcoins from wallet(hotwallet) to other users.

A simple RPC call to generate a transaction is enough here.


3. When user paid to address created, send notification to callback_handler.

You need to use walletnotify (if you only care about the first confirmation) and/or blocknotify (if you want to track the amount of confirmations).



There isn't too much work needed to achieve that. Most commands are self-explanatory and/or are very well documented.

MrNaif (OP)
Jr. Member
*
Offline Offline

Activity: 49
Merit: 23


View Profile
October 24, 2018, 07:30:00 PM
Last edit: October 24, 2018, 07:42:26 PM by MrNaif
 #6

Thank you very much for your answers! Will try them soon. But as I saw walletnotify notifies up to 1 confirmation, and I need up to 3 because I count payment succeeded after 3 confirmations.(Oh sorry,noticed about blocknotify,thanks!)
MrNaif (OP)
Jr. Member
*
Offline Offline

Activity: 49
Merit: 23


View Profile
October 27, 2018, 05:16:15 PM
 #7

I'm now trying to test blocknotify and walletnotify, but it gives me errors. I retried different combinations,but still the same.
Error is:
https://i.imgur.com/KOD2own.png
My config file is(from docker of btcpayserver):
https://i.imgur.com/Sbon9uo.png
Running it on digitalocean.
And test.sh has run permissions, I tried different combinations like sudo chmod a+x test.sh or sudo chmod a+rwx /root
test.sh is:
https://i.imgur.com/YN7HbrA.png
echo to file is just to test if my python script will not work,and python script is:
https://i.imgur.com/FAcrhJ3.png
Thank you.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6581


Just writing some code


View Profile WWW
October 30, 2018, 12:39:04 AM
Merited by ABCbits (1)
 #8

Those errors look like permission errors. Make sure that the user that bitcoind is running as has permission to read and execute the file. Note that the user that you are currently using in the shell is not necessarily the same user. Further, if you have to use sudo to do anything to the file, then something is probably wrong, unless bitcoind is being run as root (which you shouldn't be doing).

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!