3s3s / opentrade

OpenTrade - Open Source Cryptocurrency Exchange
MIT License
397 stars 401 forks source link

how to run bitcoin wallet for it? #278

Closed m4hdi1995 closed 5 years ago

m4hdi1995 commented 5 years ago

hello, i have tested this , everything works ok thanks to the dev, i had a question about bitcoind and bitcoin-cli , with what command should i run them? i'm running bitcoind and it's fully synced, my bitcoin.conf look likes this : ''' rpcuser=myuser rpcpassword=mypass rpcport=1001 rpcclienttimeout=10 rpcallowip=127.0.0.1 server=1 daemon=1 upnp=0 rpcworkqueue=1000 enableaccounts=1 litemode=1 staking=0 ''' how should i run bitcoin-cli to make it work? exchange does not show pairs/coins on Market section, on wallet section it's always loading, i also tried to run ./bitcoin-cli -rpcport=1001 -datadir=btc-blockchain encryptwallet my-string-which-i-included-on-private-constants it returned : error: Could not connect to the server 127.0.0.1:1001 (error code 0 - "timeout reached") thanks.

Brewin95 commented 5 years ago

Make sure you open ports on servers for wallets and also to that config add

To Open Ports Do This ufw allow PORTHERE

Add These To Conf rpcallowip= exchangeip rpcallowip= walletsip

see if that will work

m4hdi1995 commented 5 years ago

@Brewin95 thanks for your answer , I didn't enabled firewall yet so all ports are open , I will test that and I will share the results , but how does the open trade gets each coin port?! I didn't saw any where of the code that refers to any port, how does it know what port is belong to what coin daemon ? Does it pull them from the each coin config file?!

Brewin95 commented 5 years ago

when you go in to the admin account on add coin it will say coin host something along them lines so put this there

https://IP:PORT IP Being that of the wallet server Port being that of the wallet (port thats in the .conf)

may i ask what OS you are using its always good to do the ufw allow command just incase

ufw allow 22 ufw allow 80 ufw allow 444 etc

m4hdi1995 commented 5 years ago

@Brewin95 what about the MC and BTC? Aren't they hard coded? (I replaced MC with BTC and BTC as a coin to LTC so I will get the BTC pair instead of MC) Or I need to add them on admin panel? And the ports are alright trust me all ports are open.

Brewin95 commented 5 years ago

yer change all those values and yes you would have to add it to the admin panel also, youll have to build the bitcoin wallet etc then link them with RPC

m4hdi1995 commented 5 years ago

@Brewin95 hey man , i have tested it now it shows the btc on market but when i try to do rpc test it says "coin RPC is not returned data" but bitcoind is already running , do i need to run bitcoin-cli or anything else too? i'm not familiar with the bitcoin command line i'm familiar with the cryptonote , when i first run bitcoind it has created a wallet.dat

Brewin95 commented 5 years ago

How did you get it work? Still struggling with mine

Try bitcoin-cli getbalance think its something like that :)

m4hdi1995 commented 5 years ago

@Brewin95 oh , where did you stucked? ok i will try the wallet

m4hdi1995 commented 5 years ago

does bitcoind handle wallets or bitcoin-cli or bitcoin-wallet?!

Brewin95 commented 5 years ago

Im getting this crazy error when i try to test connection

'"<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot POST /</pre>\n</body>\n</html>\n"'

Usually bitcoin-cli

m4hdi1995 commented 5 years ago

@Brewin95 i had a problem on accountsserver i'm getting this error :

Error: unexpected init db error 1
at g_utils.ForEachSync (/root/opentrade/accountsserver/database.js:390:28)
    at onEndOne (/root/opentrade/accountsserver/utils.js:75:13)
    at Timeout.CreateTable.err [as _onTimeout] (/root/opentrade/accountsserver/database.js:232:13)
    at ontimeout (timers.js:495:15)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:283:5) 

it runs for a few seconds then i get the above error and i had to run it again with node main.js , on that a few secs which i had chance to test it sends on admin panel : "<!DOCTYPE html>\n<html lang=\"en\">\n\n<meta charset=\"utf-8\">\nError\n\n\n Cannot POST / \n\n\n" and on terminal :

RPC call from UpdateCoinBalance
Coin 1 started RPC command=getbalance user=0
rpcPostJSON {"jsonrpc": "1.0", "id":"curltest", "method": "getbalance", "params": ["*",1] }
Status: 404
Headers: {"x-powered-by":"Express","content-security-policy":"default-src 'self'","x-content-type-options":"nosniff","content-type":"text/html; charset=utf-8","content-length":"140","date":"Sun, 26 May 2019 19:03:45 GMT","connection":"close"}
rpcPostJSON: Unexpected token < in JSON at position 0
rpcPostJSON: result:success (message: RPC catch unecpected error )
m4hdi1995 commented 5 years ago

same error as yours

Brewin95 commented 5 years ago

Yer seems like something is stopping i posted a new issue with all my errors if you look at them and compare, waiting for some help from a guy so will let you no

m4hdi1995 commented 5 years ago

ok

m4hdi1995 commented 5 years ago

@jonn4y @ExchangeTime @3s3s any help guys? 🙂

m4hdi1995 commented 5 years ago

@Brewin95 it works just fine with this version of accountsserver : https://github.com/3s3s/accountsserver/commit/9274a05996258c2607105e2cf9d8c302798b0c9e @3s3s accountsServer on this line should be with lower case : https://github.com/3s3s/accountsserver/blob/132acc93d25b12ec9339158b571a22f7ad376499/constants.js#L11

Xerxes7777 commented 4 years ago

I have set up and connected two coin to the exchange server. One is Bitcoin another an alt coin Both PRC works in exchange admin site of the Website retreiving correct getbalance command I can deposit and withdrawal from the alt coin correctly. Both coins bitcoin and altcoin wallet appear in the wallet section. The problem: Bitcoin wallet when i click to deposit in the wallet section of the exchange website it gives error Method not found On the linux counsole the following appears when above problem occurs: Headers: {"content-type":"application/json","date":"Sat, 07 Mar 2020 18:14:17 GMT","content-length":"120","connection":"close"} rpcPostJSON: result:false (message: dummy first argument must be excluded or set to "*".
) INSERT INTO sessions VALUES ('utFaApbVk7vO9PfE8kd5TjXjrEF6+Kk7xSTWRHIFYaM%3D', '1583604859664', '1') INSERT error: SQLITE_CONSTRAINT: UNIQUE constraint failed: sessions.token UPDATE sessions RPC call from GetAccountAddress Coin 1 started RPC command=getaccountaddress user=1 rpcPostJSON {"jsonrpc": "1.0", "id":"curltest", "method": "getaccountaddress", "params": ["51d4d4ed717c64422b6c2c88c3a1f9ae"] } Status: 404

However the Altcoin work fine I can deposit and withdrawal fine

Can anyone help?? thank you very much

3s3s commented 4 years ago

It seems that you working with old version of accountServer. Please upgrade it to the newest one with command "git pull". Or you can use old version Bitcoin Core (0.16 for example). Because function "getaccountaddress" was removed from bitcoin RPC.

Xerxes7777 commented 4 years ago

Thank you thank you excuse my ignorance. What is the "accountServer" your are reffering to. You are right I am using latest version of bitcoin core and other wallet/node for the alt coin is the old clone of bitcoin like block chain I rather not go the old version of Bitcoin Core since it took almost 3 weeks to get the whole block chain The option of accountServer update is the best. It is is just not clear to me what it is. what I know is all self taught

3s3s commented 4 years ago

accountsserver should be running in folder "opentrade/accountserver"

I think that it will be best if you will clean up all your OpenTrade and reinstal again but exactly as it described in readme.md file.

Xerxes7777 commented 4 years ago

OK I have reinstalled the opentrade "exactly" to what was written in readme.md to version available on github 3/8/20 (Latest commitaae157eon Jan 12) Several hours later.

Sorry Should I record this issue separately to avoid confusion?? I really hope I can get this working. I am trying to support this alt coin which is not really supported by other exchange.

Unfortunately nothing runs now :

Below is the log from .forever folder

cd ~/opentrade/databaseServer [sudo] forever start main.js >>> gave the following error

/root/opentrade/node_modules/ws/lib/websocket.js:348 ...options ^^^

SyntaxError: Unexpected token ... at createScript (vm.js:74:10) at Object.runInThisContext (vm.js:116:10) at Module._compile (module.js:533:28) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object. (/root/opentrade/node_modules/ws/index.js:3:19) error: Forever detected script exited with code: 1

cd ~/opentrade/accountsserver git checkout master [sudo] forever start main.js >> gave the following error:

/root/opentrade/node_modules/ws/lib/websocket.js:348 ...options ^^^

SyntaxError: Unexpected token ... at createScript (vm.js:74:10) at Object.runInThisContext (vm.js:116:10) at Module._compile (module.js:533:28) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object. (/root/opentrade/node_modules/ws/index.js:3:19) Node NOT Exiting... error: Forever detected script exited with code: 0

cd ~/opentrade/server [sudo] forever start main.js

/root/opentrade/node_modules/ws/lib/websocket.js:348 ...options ^^^

SyntaxError: Unexpected token ... at createScript (vm.js:74:10) at Object.runInThisContext (vm.js:116:10) at Module._compile (module.js:533:28) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Module.require (module.js:513:17) at require (internal/module.js:11:18) at Object. (/root/opentrade/node_modules/ws/index.js:3:19) error: Forever detected script exited with code: 1

3s3s commented 4 years ago

It seems that you use old node.js version. Try this nvm install 12.6.0 nvm use 12.6.0

Xerxes7777 commented 4 years ago

Thank you for the quick reply while I am working on it.