Closed rkhamis closed 6 years ago
commented by @despiegk we will migrate lots of code from the jimber team
*commented by @ahussein These tickets part of https://docs.greenitglobe.com/gig/org_development/issues/91 were created after dicussions with the jimber people. This means that they do not have a corresponding implementation to to what this ticket is supposed to do.
Right now, jimber does not support atomicswap via light wallets and this ticket is a step toward that. *
why this is closed ?
Currently there is a Go implementation at https://github.com/rivine/atomicswap We need to see how bewst to provide this functionality in jumpscale
If I follow the docs here I get the following error while trying to execute the initiate process:
root@ubuntu-xenial:/opt/bin# ./btcatomicswap -testnet --rpcuser=user --rpcpass=pass -s "localhost:7777" initiate mmX9MoVj57bUisaTw9ta3mvjn3mwUkdjKy 0.1234
payTo: EOF
I have been able to move forward from the above issue, I have implemented a new Module ElectrumAtomicswap that should support the atomicswap operations on btc electrum network (now it supports initiate step).
The issue I am facing now is that the btcatomicswap command is interactive and we need to run it in non-interactive mood to be able to automate the process.
code can be found under branch electrum_atomicswap
I'll port the code the Jimber guys did on the original btcatomicswap code. Or better, apply some modifications to it as well
Changes are both on development and development_simple branches. I cannot get a working installation of js on development_simple to check the if porting the changes works fine.
I will put this ticket on verification, noting that i only tested it on development branch.
Verifying on development_simple using this doc https://github.com/threefoldtech/jumpscale_lib/blob/development_simple/docs/clients/blockchain/atomicswapwalkthrough.md
j.tools.prefab.local.blockchain.electrum.install(reset=True)
got this error:/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/tools/executor/ExecutorLocal.py in execute(self, cmds, die, checkok, showout, timeout, env, sudo)
114
115 rc, out, err = j.sal.process.execute(
--> 116 cmds2, die=die, showout=showout, timeout=timeout)
117
118 if checkok:
/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/sal/process/SystemProcess.py in execute(self, command, showout, useShell, log, cwd, timeout, errors, ok, captureout, die, async_, env)
208 msg+="stderr:\n"
209 msg+= j.core.text.indent(err).rstrip()+"\n\n"
--> 210 raise RuntimeError(msg)
211
212 # close the files (otherwise resources get lost),
RuntimeError:
Could not execute: set -e
[ ! -e '/root/.bash_profile' ] && touch '/root/.bash_profile'
source /root/.bash_profile
cp -v /tmp/k4qt4l7s8h/electrum/electrum /root/opt/bin/
stdout:
'/tmp/k4qt4l7s8h/electrum/electrum' -> '/root/opt/bin/'
stderr:
cp: cannot create regular file '/root/opt/bin/': No such file or directory
Manually created the required dir, but this needs to be in the installer script.
After this:
Configure and start Electrum as a daemon :
[6]: j.tools.prefab.local.blockchain.electrum.start(rpcuser='user', rpcpass='pass', rpcport=7777, rpchost='localhost', testnet=True)
RuntimeError:
Could not execute: set -e
[ ! -e '/root/.bash_profile' ] && touch '/root/.bash_profile'
source /root/.bash_profile
electrum --testnet -D /root/opt/var/data/electrum setconfig rpcuser user
stderr:
[ecc] warning: libsecp256k1 library not available, falling back to python-ecdsa
Traceback (most recent call last):
File "/root/opt/bin/electrum", line 397, in <module>
config = SimpleConfig(config_options)
File "/usr/local/lib/python3.6/dist-packages/electrum/simple_config.py", line 85, in __init__
self.path = self.electrum_path()
File "/usr/local/lib/python3.6/dist-packages/electrum/simple_config.py", line 109, in electrum_path
make_dir(path, allow_symlink=False)
File "/usr/local/lib/python3.6/dist-packages/electrum/util.py", line 897, in make_dir
os.mkdir(path)
FileNotFoundError: [Errno 2] No such file or directory: '/root/opt/var/data/electrum'
Again manually created the required dir.
-Generate seed and give the required parameters:
In [7]: seed = j.clients.btc_electrum.generate_seed(256)
In [8]: data_dir = '/root/opt/var/data/electrum'
...: rpcuser = 'user'
...: rpcpass = 'pass'
...: rpcport = 7777
...: rpchost= 'localhost'
...: wallet_name = 'mybtcwallet'
In [9]: client_data = {
...: 'server': "{}:{}:s".format(rpchost, rpcport),
...: 'rpc_user': rpcuser,
...: 'rpc_pass_': rpcpass,
...: 'seed_': seed,
...: 'password_': "",
...: "passphrase_": "",
...: "electrum_path": data_dir,
...: "testnet": 1
...: }
Now when executing electrum_cl = j.clients.btc_electrum.get(instance=wallet_name,data=client_data)
got this error:
In [10]: electrum_cl = j.clients.btc_electrum.get(instance=wallet_name,data=client_data)
...:
[Tue02 14:53] - ConfigManager.py :404 :gmanager.configmanager - INFO - found 0 keys from ssh-agent
[Tue02 14:53] - SSHKeys.py :153 :j.clients.sshkey - INFO - Will start agent
[Tue02 14:53] - SSHKeys.py :274 :j.clients.sshkey - INFO - load ssh agent
[Tue02 14:53] - SSHKeys.py :79 :j.clients.sshkey - INFO - load ssh key: /root/.ssh/id_rsa
[Tue02 14:53] - ConfigManager.py :384 :gmanager.configmanager - INFO - Jumpscale init: ssh key found in agent is:'/root/.ssh/id_rsa'
[Tue02 14:53] - ConfigManager.py :384 :gmanager.configmanager - INFO - Jumpscale init: Is it ok to use this one:'/root/.ssh/id_rsa'?
[y/n]: y
/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/sal/fs/SystemFS.py in listDirsInDir(self, path, recursive, dirNameOnly, findDirectorySymlinks, followSymlinks)
850 path, str(recursive)))
851
--> 852 items = self._listInDir(path)
853 filesreturn = []
854 for item in items:
/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/sal/fs/SystemFS.py in _listInDir(self, path, followSymlinks)
671 @param path: string (Directory path to list contents under)
672 """
--> 673 names = os.listdir(path)
674 return names
675
FileNotFoundError: [Errno 2] No such file or directory: '/root/code'
After making this dir, another error:
In [11]: electrum_cl = j.clients.btc_electrum.get(instance=wallet_name,data=client_data)
/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/tools/configmanager/ConfigManager.py in init(self, data, silent, configpath, keypath)
487 if configpath == "":
488 # means config directory not configured
--> 489 configpath, giturl = self._findConfigRepo(die=False)
490
491 if silent:
/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/tools/configmanager/ConfigManager.py in _findConfigRepo(self, die)
188 return path, None
189 paths = []
--> 190 for key, path in j.clients.git.getGitReposListLocal().items():
191 if j.sal.fs.exists(j.sal.fs.joinPaths(path, ".jsconfig")):
192 paths.append(path)
/opt/code/github/threefoldtech/jumpscale_core/Jumpscale/clients/git/GitFactory.py in getGitReposListLocal(self, provider, account, name, errorIfNone)
831 raise RuntimeError(
832 "Cannot find git repo for search criteria provider:'%s' account:'%s' name:'%s'" %
--> 833 (provider, account, name))
834 return repos
835
RuntimeError: Cannot find git repo for search criteria provider:'' account:'' name:''
Reference ticket needs to be checked first in order to resolve issues in development_simple
JS version
########## jumpscale_core #####
commit 9b158bdec2951cf4635418ea3603192cdf664ce2 (HEAD -> development_simple, origin/development_simple)
Merge: 4850d28 1bb73d0
Author: kristof de spiegeleer <>
Date: Tue Sep 25 17:00:57 2018 +0200
Merge branch 'development_simple' of github.com:threefoldtech/jumpscale_core into development_simple
########## jumpscale_lib #####
commit 0790d57905dbc053e4cecca67c72bae5569030ba (HEAD -> development_simple, origin/development_simple)
Author: Rob Van Mieghem <robvanmieghem@gmail.com>
Date: Mon Oct 8 10:24:02 2018 +0200
Small modifications to the tfchain readme
Signed-off-by: Rob Van Mieghem <robvanmieghem@gmail.com>
########## jumpscale_prefab #####
commit 54cb8d13643ba92066ddd20a547b8ac02c7b9713 (HEAD -> development_simple, origin/development_simple)
Merge: 7f2af91 64891d1
Author: Abdelrahman Hussein <ahussein.abdelrahman@gmail.com>
Date: Thu Sep 20 09:06:27 2018 +0200
Merge branch 'development_simple' of github.com:threefoldtech/jumpscale_prefab into development_simple
#################### on alice node @ Alice ####################### In [26]: j.tools.prefab.local.blockchain.electrum.start(rpcuser='user', rpcpass='pass', rpcport=7777, rpchost='localhost', testnet=True)
In [27]: aliceseed = j.clients.btc_electrum.generate_seed(256)
In [28]: aliceseed
Out[28]: 'claw smooth movie thank cousin supply husband bring immune stereo donate leg suggest caught exhibit neck moon axis guard tribe credit parrot swing spread'
In [29]: data_dir = '/root/opt/var/data/electrum' ...: rpcuser = 'user' ...: rpcpass = 'pass' ...: rpcport = 7777 ...: rpchost= 'localhost' ...: wallet_name = 'alicebtcwallet'
In [31]: client_data = { ...: 'server': "{}:{}:s".format(rpchost, rpcport), ...: 'rpc_user': rpcuser, ...: 'rpcpass': rpcpass, ...: 'seed': aliceseed, ...: 'password': "", ...: "passphrase_": "", ...: "electrum_path": data_dir, ...: "testnet": 1 ...: }
In [32]: aliceelectrum_cl = j.clients.btc_electrum.get(instance=wallet_name,data=client_data)
In [85]: aliceelectrum_cl.wallet.getbalance()
Out[85]: {'confirmed': '0.14419863'}
In [90]: alicebtcwallet.getunusedaddress()
Out[90]: 'miQNqN7KvWUuFSYDbW5ZTWnMCws1gnNJR2'
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ initiate step @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ########### on node 2 (differnet node) @ BOB #############
In [5]: bobseed = j.clients.btc_electrum.generate_seed(256)
In [6]: bobseed Out[6]: 'invite plate guess connect august crucial town can credit absurd fame verb identify oven narrow smart ginger tray invest west transfer hunt peanut cricket'
In [7]: data_dir = '/root/opt/var/data/electrum' ...: rpcuser = 'user' ...: rpcpass = 'pass' ...: rpcport = 7777 ...: rpchost= 'localhost' ...: wallet_name = 'bobbtcwallet'
In [10]: client_data = { ...: 'server': "{}:{}:s".format(rpchost, rpcport), ...: 'rpc_user': rpcuser, ...: 'rpcpass': rpcpass, ...: 'seed': bobseed, ...: 'password': "", ...: "passphrase_": "", ...: "electrum_path": data_dir, ...: "testnet": 1 ...: }
In [16]: j.tools.prefab.local.blockchain.electrum.start(rpcuser='user', rpcpass='pass', rpcport=7777, rpchost='localhost', testnet=True)
In [17]: bobelectrum_cl = electrum_cl = j.clients.btc_electrum.get(instance=wallet_name,data=client_data)
In [18]: bobelectrum_cl.config.save()
In [54]: bobelectrum_cl.wallet.getbalance() Out[54]: {'confirmed': '0.14288843'}
In [55]: bobelectrum_cl.atomicswap.initiate('miQNqN7KvWUuFSYDbW5ZTWnMCws1gnNJR2', 0.1234)
Out[55]: {'secret': '07f7e12b2e975eb7a6bc21013b10bf0ad313098c98da0c07a94ff72777e553cb', 'hash': 'beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc2', 'contractfee': '0.00336 BTC', 'refundfee': '0.004455 BTC', 'contractp2sh': '2N9um1tZkM4BN9eakhFGgy21ci16WjC1yrf', 'contract': '6382012088a820beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc28876a9141fa9f3506dbb1f7dfa7293d27ef20ac53b086b346704663bb65bb17576a91484ead42c6f07207020993c5f92258eab5c7136556888ac', 'contractTransactionHash': '3ecdd29caca5b868bfa9df44ee1cd250d694a20e09c9781ac49441c87d4c350b', 'contractTransaction': '010000000138272149fc5460b23ef3618e65bfa849520cb26867aca9bdae32b968d34302d5000000006a473044022028e26053324cdf12faaebfff60b2cd89cd85c9b207284654d60325c8ef8e0fab02202795b57a585be88d97a0740c350d6edd88167b6dc0b41dca8598ea4b700a36e0012103b4ce15ea9ffd15304eb9d0e8949c10681b8a043e84fec84ba1e318a86f40da04fdffffff022c9c1800000000001976a91477ed55af680ef75df717e6086b5a0fa813b0eb2f88ac1f4bbc000000000017a914b6cbb83e229c93dab918a26bce63a2cf59f3b49987c8961500', 'refundTransactionHash': 'b8abb52ab1e452dc45eb1fefac0270973ef2ba75d08800753c58fa213df36c77', 'refundTransaction': '02000000010b354c7dc84194c41a78c9090ea294d650d21cee44dfa9bf68b8a5ac9cd2cd3e01000000ce473044022017b0e7644296004dfcbd6b04a76c2a0627860a39a24881a43201140c6fbac50302203890528392a761468ecfaf60527dcd103335724afc6629dd0a299a6d3f0e0c930121035f6d1b349e6cfca5fc510f6d21df360626fd4efcf0de8ea9945c9d0978a6f069004c616382012088a820beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc28876a9141fa9f3506dbb1f7dfa7293d27ef20ac53b086b346704663bb65bb17576a91484ead42c6f07207020993c5f92258eab5c7136556888ac0000000001e37eb500000000001976a91484ead42c6f07207020993c5f92258eab5c71365588ac663bb65b'}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ audit contract @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
##################### on alice node #################################
In [93]: aliceelectrum_cl.atomicswap.auditcontract('6382012088a820beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc28876a9141fa9f3506dbb1f7dfa7293d27ef20ac53b086b346704663bb65bb17576a91484ea ...: d42c6f07207020993c5f92258eab5c7136556888ac','010000000138272149fc5460b23ef3618e65bfa849520cb26867aca9bdae32b968d34302d5000000006a473044022028e26053324cdf12faaebfff60b2cd89cd85c9b207284654d60325c8 ...: ef8e0fab02202795b57a585be88d97a0740c350d6edd88167b6dc0b41dca8598ea4b700a36e0012103b4ce15ea9ffd15304eb9d0e8949c10681b8a043e84fec84ba1e318a86f40da04fdffffff022c9c1800000000001976a91477ed55af680ef75 ...: df717e6086b5a0fa813b0eb2f88ac1f4bbc000000000017a914b6cbb83e229c93dab918a26bce63a2cf59f3b49987c8961500')
Out[93]: {'contractAddress': '2N9um1tZkM4BN9eakhFGgy21ci16WjC1yrf', 'contractValue': '0.12339999 BTC', 'recipientAddress': 'miQNqN7KvWUuFSYDbW5ZTWnMCws1gnNJR2', 'refundAddress': 'msdkoZqLqq1rGduqohkKoGgLh8aYHYnRq8', 'secretHash': 'beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc2', 'Locktime': '2018-10-04 16:10:14 +0000 UTC'}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Participate @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
######################## on bob node ####################################################
In [57]: bobrivineseed = j.clients.rivine.generate_seed()
In [58]: bobrivineseed Out[58]: 'trigger symptom top family right emerge fragile sister earn explain purse east excite flight author believe meat engage maximum lizard mechanic plug tip goddess'
In [63]: client_data = {'bcaddresses': ['https://explorer.testnet.threefoldtoken.com/'], ...: 'password': 'test123', ...: 'minerfee': 1000000000, ...: 'nr_keys_perseed': 5, ...: 'seed': bobrivineseed} ...:
In [64]: bob_rivine_client = j.clients.rivine.get('bobtftwallet', data=client_data)
In [66]: bob_rivine_client.config.save()
In [68]: bobwallet.current_balance
Out[68]: 0.0
In [69]: bobtftwallet = bobwallet = bob_rivine_client.wallet
In [70]: bobtftwallet.generate_address() Out[70]: '011a3fd84eab917adead8a181641fc8837b7a7c31ec225a2f61a7bd179f6003bb3e8d09c7b9fbd'
########## on alice node ###########
In [95]: alicerivineseed = j.clients.rivine.generate_seed()
In [96]: alicerivineseed
Out[96]: 'cherry ranch abuse note bench crunch ask day police pumpkin unfair brief sing dash ankle ramp illness outside item lava term trash apple gym'
In [97]: client_data = {'bcaddresses': ['https://explorer.testnet.threefoldtoken.com/'], ...: 'password': 'test123', ...: 'minerfee': 1000000000, ...: 'nr_keys_perseed': 5, 'seed': alicerivineseed}
In [99]: alice_rivine_client = j.clients.rivine.get('alicetftwallet' , data=client_data)
In [100]: alice_rivine_client.config.save()
In [101]: alicetftwallet = j.clients.rivine.get('alicetftwallet').wallet
In [66]: alicetftwallet.current_balance
Out[66]: Unlocked:
20.0
In [12]: alicebtcwallet.getbalance()
Out[12]: {'confirmed': '0.14419863'}
In [19]: bobelectrum_cl.wallet.getbalance()
Out[19]: {'confirmed': '0.01612844'}
In [111]: alicetftwallet.atomicswap.participate('011a3fd84eab917adead8a181641fc8837b7a7c31ec225a2f61a7bd179f6003bb3e8d09c7b9fbd',9,'beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc2')
[Mon08 12:25] - RivineWallet.py :182 :in.rivine.rivinewallet - INFO - Current chain height is: 131006 [Mon08 12:26] - RivineWallet.py :555 :in.rivine.rivinewallet - INFO - Signing Transaction [Mon08 12:26] - utils.py :244 :lockchain.rivine.utils - INFO - Transaction committed successfully Out[14]: {'amount': 9, 'hashed_secret': 'beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc2', 'transaction_id': 'bf16cd590950b32129427f027f0ec58020d90fe7c2a7a0913bf40abfeb5a1ab1', 'output_id': 'ad48b0cbb04bcdd25ee30e72e13b0f8ea1fe442df9285508c374b6e9b0b3395d'}
################# after participate action below is balance on both nodes ####################
In [15]: alicebtcwallet.getbalance()
Out[15]: {'confirmed': '0.14419863'}
In [17]: alicetftwallet.current_balance
[Mon08 12:34] - RivineWallet.py :182 :in.rivine.rivinewallet - INFO - Current chain height is: 131008
Out[17]:
Unlocked:
10.0
In [24]: bobbtcwallet.getbalance() Out[24]: {'confirmed': '0.01612844'}
In [26]: bobtftwallet.current_balance [Mon08 12:34] - RivineWallet.py :182 :in.rivine.rivinewallet - INFO - Current chain height is: 131008 Out[26]: Unlocked:
0.0
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ audit Threefold contract @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
################### on bob node ##########
In [27]: bobtftwallet.atomicswap.validate('bf16cd590950b32129427f027f0ec58020d90fe7c2a7a0913bf40abfeb5a1ab1',amount=9, hashed_secret='beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc2') Out[27]: True
In [29]: bobtftwallet.atomicswap.redeem('bf16cd590950b32129427f027f0ec58020d90fe7c2a7a0913bf40abfeb5a1ab1','07f7e12b2e975eb7a6bc21013b10bf0ad313098c98da0c07a94ff72777e553cb') [Mon08 12:51] - utils.py :244 :lockchain.rivine.utils - INFO - Transaction committed successfully [Mon08 12:51] - atomicswap.py :242 :.atomicswap.atomicswap - INFO - Redeem executed successfully. Transaction ID: 14b4a86b008f6c203ddd3cd6d9adc83f1c1708808892f3ebe0a44447d2af610a Out[29]: '14b4a86b008f6c203ddd3cd6d9adc83f1c1708808892f3ebe0a44447d2af610a'
############# after audit Threefold contract balances on both nodes ################3
In [30]: bobtftwallet.current_balance [Mon08 12:52] - RivineWallet.py :182 :in.rivine.rivinewallet - INFO - Current chain height is: 131015 Out[30]: Unlocked:
8.9
In [31]: bobbtcwallet.getbalance() Out[31]: {'confirmed': '0.01612844'}
In [18]: alicetftwallet.current_balance
[Mon08 12:53] - RivineWallet.py :182 :in.rivine.rivinewallet - INFO - Current chain height is: 131015
Out[18]:
Unlocked:
10.0
In [19]: alicebtcwallet.getbalance()
Out[19]: {'confirmed': '0.14419863'}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ redeem bitcoins @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
############## on alice node #################
In [20]: aliceelectrum_cl = j.clients.btc_electrum.get(instance='alicebtcwallet')
In [23]: aliceelectrum_cl.atomicswap.redeem('6382012088a820beaaad9515a22886c318609eaddf1688a4d9b99af71c0c22003e200b394aefc28876a9141fa9f3506dbb1f7dfa7293d27ef20ac53b086b346704663bb65bb17576a91484ead42c6f0 ...: 7207020993c5f92258eab5c7136556888ac','010000000138272149fc5460b23ef3618e65bfa849520cb26867aca9bdae32b968d34302d5000000006a473044022028e26053324cdf12faaebfff60b2cd89cd85c9b207284654d60325c8ef8e0fa ...: b02202795b57a585be88d97a0740c350d6edd88167b6dc0b41dca8598ea4b700a36e0012103b4ce15ea9ffd15304eb9d0e8949c10681b8a043e84fec84ba1e318a86f40da04fdffffff022c9c1800000000001976a91477ed55af680ef75df717e6 ...: 086b5a0fa813b0eb2f88ac1f4bbc000000000017a914b6cbb83e229c93dab918a26bce63a2cf59f3b49987c8961500','07f7e12b2e975eb7a6bc21013b10bf0ad313098c98da0c07a94ff72777e553cb')
Out[23]: {'redeemFee': '0.00028591 BTC', 'redeemTransaction': '141db88f7af71be46b53fb78503ad97d21afc1f0e2c2e2e05abb124225fbb39d'}
In [57]: alicebtcwallet.getbalance()
Out[57]: {'confirmed': '0.14419863'}
In [58]: alicebtcwallet.listaddresses()
Out[58]:
['mzhypVKNAhmAPtvoZuJYHArHvdYhQfEgYv',
'miQNqN7KvWUuFSYDbW5ZTWnMCws1gnNJR2',
'mz57w6km8BZ2b8r3GXCmsg3pLZ3GR6dctq',
'mfn79Qwb4M6KvfnDPpEVEpPxyVPgmuE5U9',
'movjEyUwq7neqvpT4dX1U8LB3RBUZLAxr8',
'n1zQBovVC3pbm29hQYq6mXWrnt4HVaW4c7',
'min738SaSH5GkMjsm9kTeTirwKbB3vNEkK',
'mvjJhMLfSLEA5xyzqzfsvhDetP5ykauv8Q',
'mtDb8xQ232fEQDH9yRMNe9DVZ1eEJZdjfQ',
'mtARdKpqsZysmJZJ8krJNmjD8XSnS5TYhp',
'mn3y3t1E4PbL14Tr3HjDfpTCKE4iyYPqGn',
'mvsK2A48ArP2cRdeDyqVLukB3dGZ34c1KQ',
'mnU7FarDE3v8zjSh7gMbQ6XSCPsJjFEWB1',
'mpYhb2tDtD6d6H5YN5VqADkRfxxJw6ZGzb',
'mrbdywypQThWcLUHYLi1YcBj8ZeUwNaVR6',
'mnabL7PT45ba2VRbs7mLNp829qvybVmyW9',
'mzpa9VFwcUp66Pn6UsY3qbx49iHRVdzT8o',
'mhx5WiUkuiax4YrTfBU3driy1v1Eh377cn',
'muZajsurmAnkYDC7uXyLParYiS4qKDBEHc',
'mupyrt2tBcoLErUkCyxivSg37gaqdyYugH',
'mxwPuP4C97zCCaAMXDyPCXWXV3kBgCqVvD',
'mhKdTnVE9SajasHQNUViJmgV5tmoypzMmH',
'n3VttGZTdCmbL1vNJD7Y8RQg9UBcSykB9j',
'mxj7eBq1yBo99KWJALyr8FJK38cXrpxZKH',
'n4MuWsF8TBw8nrNrZK9sYQNxcVF6w1gTdS',
'mrX9LwvfV1PUey9izf6G9VPs9NVu2uwBy2',
'mn5VPprUJVv5uC9gMiH8t7WYjoNYWpPMv2']
In [3]: aliceelectrum_cl = j.clients.btc_electrum.get(instance='alicebtcwallet')
In [4]: alicebtcwallet = aliceelectrum_cl.wallet
In [6]: alicebtcwallet.getbalance()
Out[6]: {'confirmed': '0.26731271'}
the verification done successfully but it seems to be two bugs :
1- need to close js-shell and re-call the btc electrum client again to see the final balance of alice when the 0.123 btc added to alice after transaction confirmed (checked on explorer) the balance still be as old unless i close js-shell and re-call the btc client the 0.123 btc are appear as added balance
In [59]: alicebtcwallet.getbalance()
Out[59]: {'confirmed': '0.14419863'}
In [61]:
Do you really want to exit ([y]/n)?
root@080d96fd6705:# js_shell
In [3]: aliceelectrum_cl = j.clients.btc_electrum.get(instance='alicebtcwallet')
In [4]: alicebtcwallet = aliceelectrum_cl.wallet
In [6]: alicebtcwallet.getbalance()
Out[6]: {'confirmed': '0.26731271'}
2- when i am trying to show the balance of specific address i got this error
In [9]: alicebtcwallet.getaddressbalance("mhx5WiUkuiax4YrTfBU3driy1v1Eh377cn")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/opt/code/github/threefoldtech/jumpscale_core/cmds/js_shell in <module>
----> 1 alicebtcwallwt.getaddressbalance("mhx5WiUkuiax4YrTfBU3driy1v1Eh377cn")
/usr/local/lib/python3.6/dist-packages/electrum/commands.py in func_wrapper(*args, **kwargs)
85 if c.requires_password and password is None and wallet.has_password():
86 return {'error': 'Password required' }
---> 87 return func(*args, **kwargs)
88 return func_wrapper
89 return decorator
/usr/local/lib/python3.6/dist-packages/electrum/commands.py in getaddressbalance(self, address)
323 """
324 sh = bitcoin.address_to_scripthash(address)
--> 325 out = self.network.get_balance_for_scripthash(sh)
326 out["confirmed"] = str(Decimal(out["confirmed"])/COIN)
327 out["unconfirmed"] = str(Decimal(out["unconfirmed"])/COIN)
AttributeError: 'NoneType' object has no attribute 'get_balance_for_scripthash'
Issue migrated from [https://api.github.com/repos/Jumpscale/lib9/issues/340](), opened by @ahussein
One we have a the electrum wallet ready [#339] we will need to investigate how to support atomicswap operations similar to the Rivine client.
Rivine team already have atomicswap support for electrum wallet that can be used as a reference