Closed marekyggdrasil closed 3 years ago
The wallets are created on the same device, in separate directories.
(So they use the same grin-wallet and node versions.)
* grin-wallet --version: grin-wallet 5.0.0-beta.4
* grin --version: grin node 5.0.0-rc.1
* Linux debian 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux
* wallet 1 address: grin1cwutd4sr0t0ac62764r9vz6wkgpmnmpheynh5tw56zvczvh8apdszxp25w
* wallet 2 address: grin1zygggqt5exf3zux7zaycgj8jv7gj005rhalewa3ap9kf3h74220q50mp8y
* Python version 3.7.3
* Python script needed: https://github.com/grinfans/grin.py/blob/main/wallet_v3.py
Run wallet (2) in Owner API listener mode in a separate window. This starts an HTTP Owner API server.
~/grin-wallet-2$ grin-wallet owner_api
Password:
20201227 15:31:32.198 WARN grin_wallet_controller::controller - Starting HTTP Owner API server at 127.0.0.1:3420.
20201227 15:31:32.251 WARN grin_wallet_controller::controller - HTTP Owner listener started.
The HTTP Owner API server started succesfully.
Some configuration in the Python script must be done, before we can use it.
Main method of wallet_v3.py should be changed to look like the following listing. In particular, the variable args should be added like this:
if __name__ == '__main__':
import pprint
pp = pprint.PrettyPrinter(indent=4)
api_url = 'http://localhost:3420/v3/owner'
#change to your grin owner_api sercret file
api_sercet_file = '/home/nick-test/.grin/main/.owner_api_secret' # You have the change this
api_user = 'grin'
api_password = open(api_sercet_file).read().strip()
wallet = WalletV3(api_url, api_user, api_password)
wallet.init_secure_api()
#change to you wallet password
wallet_password = 'CHANGE-THIS'
wallet.open_wallet(None, wallet_password)
#pp.pprint(wallet.node_height())
#pp.pprint(wallet.retrieve_txs(tx_id="x"))
#pp.pprint(wallet.retrieve_txs())
pp.pprint(wallet.get_slatepack_address())
args = {
'dest_acct_name': 'grin1cwutd4sr0t0ac62764r9vz6wkgpmnmpheynh5tw56zvczvh8apdszxp25w',
'amount': 100000000,
'target_slate_version': None
}
result = wallet.issue_invoice_tx(args)
pp.pprint(result)
resp = wallet.create_slatepack_message(result, [])
pp.pprint(resp)
Grin wallet (1) balance state before doing anything:
~$ grin-wallet info
____ Wallet Summary Info - Account 'default' as of height 1020728 ____
Confirmed Total | 4.338000000
Awaiting Confirmation (< 10) | 0.000000000
Awaiting Finalization | 0.000000000
Locked by previous transaction | 0.000000000
-------------------------------- | -------------
Currently Spendable | 4.338000000
Grin wallet (2) balance state before doing anything:
~/grin-wallet-2$ grin-wallet info
____ Wallet Summary Info - Account 'default' as of height 1020729 ____
Confirmed Total | 0.576500000
Awaiting Confirmation (< 10) | 0.000000000
Awaiting Finalization | 0.000000000
Locked by previous transaction | 0.000000000
-------------------------------- | -------------
Currently Spendable | 0.576500000
Now, run this script from (the directory of) Wallet (2) (i.e. the party sending the invoice):
~/grin-wallet-2$ python3 wallet_v3.py
'grin1zygggqt5exf3zux7zaycgj8jv7gj005rhalewa3ap9kf3h74220q50mp8y'
{ 'amt': '100000000',
'id': '7a15069f-dc07-4767-a915-22f83cc0bca2',
'sigs': [ { 'nonce': '02d324baa40a35dfb2e40f1c3586c1965c6394628133b02412f8b01f9692a5f950',
'xs': '036cd84269324d10842c76d25cab3932ac2b001eab7cbc62ea45c6ae100361e143'}],
'sta': 'I1',
'ver': '4:3'}
('BEGINSLATEPACK. 8zuQfPs7qbuyLTM iqHmSFcPcPPE6RB JxA7bk7DG2ogUxh '
'2TdeDzN3eQ4ULJT 6tHDe9xzfZdR8Zk sQ4yLRph8rbZjcA nJmJFkBBTk7ko2L '
'BdmjaN26A2r4mq7 yBG9MX8oQjDiCaX BDQaBZjoyMoFu8G GQWAdjLW9r7E34S '
'KifZZxfuceCtRAD CeaT56TPtLHuoGh wJeemCaytmMiP. ENDSLATEPACK.')
The slatepack we need during the receive command is:
BEGINSLATEPACK. 8zuQfPs7qbuyLTM iqHmSFcPcPPE6RB JxA7bk7DG2ogUxh 2TdeDzN3eQ4ULJT 6tHDe9xzfZdR8Zk sQ4yLRph8rbZjcA nJmJFkBBTk7ko2L BdmjaN26A2r4mq7 yBG9MX8oQjDiCaX BDQaBZjoyMoFu8G GQWAdjLW9r7E34S KifZZxfuceCtRAD CeaT56TPtLHuoGh wJeemCaytmMiP. ENDSLATEPACK.
Wallet (2) state now:
~/grin-wallet-2$ grin-wallet info
Password:
20201227 18:28:51.225 WARN grin_wallet_libwallet::api_impl::owner - Attempted to update via kernel excess for transaction Some(7a15069f-dc07-4767-a915-22f83cc0bca2), but kernel excess was not stored
20201227 18:28:51.228 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning - 0% complete
20201227 18:28:51.257 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning - 99% complete
20201227 18:28:51.267 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning - 99% complete
20201227 18:28:51.268 WARN grin_wallet_libwallet::api_impl::owner_updater - Scanning Complete
____ Wallet Summary Info - Account 'default' as of height 1020734 ____
Confirmed Total | 0.576500000
Awaiting Confirmation (< 10) | 0.000000000
Awaiting Finalization | 0.100000000
Locked by previous transaction | 0.000000000
-------------------------------- | -------------
Currently Spendable | 0.576500000
Command 'info' completed successfully
Grin wallet (1) has to pay
~$ grin-wallet pay
Password:
Please paste your encoded slatepack message:
BEGINSLATEPACK. 8zuQfPs7qbuyLTM iqHmSFcPcPPE6RB JxA7bk7DG2ogUxh 2TdeDzN3eQ4ULJT 6tHDe9xzfZdR8Zk sQ4yLRph8rbZjcA nJmJFkBBTk7ko2L BdmjaN26A2r4mq7 yBG9MX8oQjDiCaX BDQaBZjoyMoFu8G GQWAdjLW9r7E34S KifZZxfuceCtRAD CeaT56TPtLHuoGh wJeemCaytmMiP. ENDSLATEPACK.
This command will pay the amount specified in the invoice using your wallet's funds.
After you confirm, the following will occur:
* 0.100000000 of your wallet funds will be added to the transaction to pay this invoice.
* The resulting transaction will output as a slatepack which you can manually send back to the invoice creator.
Please review the above information carefully before proceeding
To proceed, type the exact amount of the invoice as displayed above (or Q/q to quit) > 0.100000000
20201227 18:33:15.791 WARN grin_wallet_api::owner - Destination is not a valid Slatepack address. Will output Slatepack.
/home/nick-test/.grin/main/slatepack/7a15069f-dc07-4767-a915-22f83cc0bca2.I2.slatepack
Slatepack data follows. Please provide this output to the other party
--- CUT BELOW THIS LINE ---
BEGINSLATEPACK. Uv2Xcd5VrQgHojT Xn9NZDbsC3uuzuk B613aszo3aN6T5z cY1mNg1SWvLjQJ2 4YscawEb9GAAqHF RAyQj8eTXDrutGY eKAHtn2wE9abMMp mdxLdvYrNSfT7gR dUkcVBjmJoJfUES 5RcX4XNgLA1YBc3 2yaa5bDvKbq3zNy FZt2hFzkNXnXSL6 pvtHTB4GxueA7oh jPNaWqqWNX7aZbp 12iciKgr4SYUMEp 7eLQwxvX1ihj84S ypYsQJBar8q6bmz nD61vyxEkVJkbA8 cE8yecqrbhkNvCE 9kj1E3mQf5sqHe5 8gUgv3EadHBQyCY zimtboZWkGFdJCF RQ9bTALGWXt8yix ozfP52oePDaKM7Y WBFgj3ab2rWgEGa ZmHkwg52CrLq8c2 xB3yi9rxDC2i9No sur3QcxFSst9joK bWHub4XvD9NZT7g Wgq75VsjPmua42z 8MktBFC2T7btPs8 HWnBpqEqctKBK5Y kJqD8ED3tf9YkLU v4vibWH2d5TjrXh 4eg4djGsDUV2zJg bgccwANFQKs7rTS 21p65n3MER4NeHR Q5zvZuk38mmGeP6 MqHa4yAf14v78Z3 2RrPtUHhSHWuBGt 4qwpNB9R9pP4c7N sZeCDTJkzpL4tMA qygziKtuxnMjf8o Hdeh1TXGSEaa2tL jGPGChPFDkbTv2y b1QEuq2sv9DU6HT 8SyuzRhDk94m5W9 Su85nE43UiPWqN3 HrpcQ71reZhNNJA A5tzatcGVxs9A7C H2yM4Jsn1f1npW6 bUvn7m7BZsUJrvY teHo2y12q9LBAEv zoLqhDcpoLqU5wE fWYdt5TeTfqy6Lc YdmGFRTG2jU287h Zp7nfgSXcE5xLL6 5FQhakBo2YRhdCY oZw1y4e1D3JNoPT NLfd7yakk23edbF bGDLaZsQjgUcD8d Wf28iyn1rFqf34f aR5HDRwiFE7Q3fJ ujMrqaM1Cu1Ly4U f94SSewa9YejLmR 1VGb1sofYFc6jd1 rekdxe6qMQVUn7W 89MAKh6L6oeJqhT 69MAbMSNq9Fijmu 9dpYZ9s38cTjRCz 85seV4uDD58dz7a 7NoHicMdnHUxLaQ DzJ6vcN5aUHDKnE anWPXKZjSdMCyPP YGUsTuABnabyJHJ 4u8C3VmW5Ln2YF7 y97JjJWYmiYVn4P xYSWALVFSvYhP4p yVeVbjptrCJppuA a1gpq1NCmDzPqHe yrEygxGVuA3gj5b 5Svmb1y1KvGAD6y wSXws4DgxSA3Ubc DAtTRanzkp74oTR HnptdoWAhvZzx7a KnmKmQc4VtqapEo BF6FEb96AN33xCn m9GRSzJVcdQn1K8 UvsWDXYqj8vURKv iN2yUVJyhm56BJR rKi7MSNzgnY6orc FutyK7kbGb9Gs3r P8v8Hoi5ZWPTVCY 9kM2VyivwQ9Bhov nLj. ENDSLATEPACK.
--- CUT ABOVE THIS LINE ---
Slatepack data was also output to
/home/nick-test/.grin/main/slatepack/7a15069f-dc07-4767-a915-22f83cc0bca2.I2.slatepack
The slatepack data is NOT encrypted
Command 'pay' completed successfully
Wallet (1) state:
~$ grin-wallet info
____ Wallet Summary Info - Account 'default' as of height 1020747 ____
Confirmed Total | 0.000000000
Awaiting Confirmation (< 10) | 0.000000000
Awaiting Finalization | 4.215000000
Locked by previous transaction | 4.338000000
-------------------------------- | -------------
Currently Spendable | 0.000000000
Wallet (2) state:
~/grin-wallet-2$ grin-wallet info
____ Wallet Summary Info - Account 'default' as of height 1020746 ____
Confirmed Total | 0.576500000
Awaiting Confirmation (< 10) | 0.000000000
Awaiting Finalization | 0.100000000
Locked by previous transaction | 0.000000000
-------------------------------- | -------------
Currently Spendable | 0.576500000
Now, run the finalize command, as done in #17. Again, we need the slatepack we got during the receive command, from the recipient.
~/grin-wallet-2$ grin-wallet finalize
Password:
Please paste your encoded slatepack message:
BEGINSLATEPACK. Uv2Xcd5VrQgHojT Xn9NZDbsC3uuzuk B613aszo3aN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aUHDKnE anWPXKZjSdMCyPP YGUsTuABnabyJHJ 4u8C3VmW5Ln2YF7 y97JjJWYmiYVn4P xYSWALVFSvYhP4p yVeVbjptrCJppuA a1gpq1NCmDzPqHe yrEygxGVuA3gj5b 5Svmb1y1KvGAD6y wSXws4DgxSA3Ubc DAtTRanzkp74oTR HnptdoWAhvZzx7a KnmKmQc4VtqapEo BF6FEb96AN33xCn m9GRSzJVcdQn1K8 UvsWDXYqj8vURKv iN2yUVJyhm56BJR rKi7MSNzgnY6orc FutyK7kbGb9Gs3r P8v8Hoi5ZWPTVCY 9kM2VyivwQ9Bhov nLj. ENDSLATEPACK.
Transaction posted
Transaction finalized successfully
/home/nick-test/grin-wallet-2/slatepack/7a15069f-dc07-4767-a915-22f83cc0bca2.I3.slatepack
Slatepack data follows.
--- CUT BELOW THIS LINE ---
BEGINSLATEPACK. bXgRZGs3oiqK5Z8 i48LruwYgcshd9A 31k97ivfTZxZ85y CAAf7DpzUG1PGV6 MDFhmYCPVrENG9Y TJVdV8F7KZ4vcJP UN76AvSJFyLj3Ey e8vBtYivNdpsWPL Cp4cdrnddDyef3C bUWrVFFEESnjLeB WsQVvsjqC9WdiD6 Agtf9TQSnUwoQaV Zk1t5fMjkp5BV1p 3YcEiNTBw8MqaZa LxpbA5tEuprmnNr NeKD649yzcreUcU 9vv6qcMWdvcKZQB mC9cshNSYLtievy 8sXBvr3B2MAVsCe Apgv2N7f8uEh6Fn ajb5M94xXvGHX1m hTPMFWc9UwuyPH2 H44f6Y1QhndqRZS jYjX7SuLoAYmqBd MwWXZ6VEWC2x8eB 8zHmdwd57edjFuy cyoRBoDkUrpLEBD sgvHteRWdYh7VnL Li4kVx7LDE2pHcV arckSAN8T7hJryr vq8courxHNWMHeZ QvBGpZXgL6Vj5K5 eUzBhQJGQnBsJSN 5oeHKZf7Swduwqg Sv1T6k3Md8dM9sZ LucoBmEofHru1te ZuZnd9VCJEp38aL xg44oKxo9SxgQB8 u4wZGftwVQFcqGP puxdp78RafoUZ6F CtQnvc7skau8QwD YdQHwqmXAfmvpzM U8FjVUBERTYdWGZ 1VYGoi6BqUUeNew pNG5trhHeFUau51 2fGm4cjvL4UjyXK kzjvoUdY2VXhAyk hDDcM1v2Ncpe5Vv beJRstTys4m8fHj iGpjMnesmRoV1ob ZFyfCysNYWB3rBn iEsDYWmU63Hea7S 6t7qCxJkbvd2zEt CiGg8saarXpqM3x 4t1zjPxAwYQN9wD ZfWFUtzVqaqYNeL xHdSTNiHwVpfvgr hU42kWzQ3udfFNx RZfcXkYPV4vQ3iG pdbzjhVWsbS4d6x EpEbTZmdG4dpYAA gnJphFYG178KYrY VcQcuHbBD4uwVKT YFDKyj8BRwBhbHB 16Kgf2eEofVq3fa aQLrFyXcLFNw9E8 1u6XLUbqpj9scAp 7nP3GEQStKBbtxU eVgheAPU3C8w4nG 4AqeUXqaTD567SZ u71nwivU2Pxue74 jMNYmwuY466t5k9 6DBBMMroWqkASiw 1121mCrCYb9598F 7mAxUXoRLkueCiS X41fkBFHz5Bvc4p iA2NQxKbWvdVyAi TK4vFwfWm7sfZH6 RkifqkDbb3fM73g LHUwnRJY96iez9J B2aXyx9GmKhrWwZ AXLtqi9GjbJx6s1 NCcGT6b3hCYq1gR 3YwkQqUrdpZsoXQ msrqwPsBQCYXWqj EBTEFPak8BtjgDo e8i8vhacvthghsf E4S48N2fuXsgms2 uCGXxN8dHEABUBF cBL6DmigU52mhog AvaNVLwGcXoxmrY fvKhnHg4vyaNzdm oLgnK5SJXSRMBNd gbi6GUAL4c6dpKv FeYnBQJpbtTMwFU FA5frXcGRFuoGXB roBMRLHF6q6pHdY kweBCzWWdcznMUz xkDF3EdMcb3NuSH KhW9AQCqVMmDJhZ pd8tppiqQXxKnft 4VdDLFCFrU6ECpY KQxpNQnysVxzhQY RD47dSi9Z3GaA3o A7ubU7dXfCuXMkd yKqTWHLFEpcKmXC uYfzBHSv4Kx3EtD Az2fNwnqk1EUaTc aQBLH42xciVZo5r HsezEC43emNchym osmAJCmj8v1za35 6iKbNwo2VZGXxxf YLh9YM1YpE34xvH y6CHbfU3Jhij7UP 1tC2qHALEn9rSzS YtZe3ne2aSxq2eT W4aRq3tJqH5FPPg DYrkfgUipAbmye3 yM5X3RzykfAJPei YBba9srf5SwW46i 25cuwNqTfVSv6kk xPWnwBEcUnAyVKK ZtXBez3wZcTFzXB jkHojTRgKhTARGc JuAQWh9PrhwX8ng 8XUYaWBtBCungik 8yu7NjcKoXUBus1 R6v2faN9w71zpag 2bcpK5GM67RMrqr UJRC26N6AvBTyjx dkTiw2tRZi1BRDq k4EjWS1AvGi9LaU 8VLRH9jx1piMywU 1Dud2CN9CqaZEDg m7TFure3ZeJpudY H96TqBVRfQaLzr6 9GkHKdcY8sBNicZ B7gLJMSJmfo4EFL RCQEG3yAVfWsHuo AM9svB3D95v6jqf RXJ77QeCctwRa8w icCPo9TAKb4Z6GE ErnorkKBuMcUcQX csPzAF7UqZJ7F59 nrtd8zfzertPcJS 1kSBCKBJ8KXoVrP pCGaBGq6ZFbGQrM Af5rgngHQExNycx dxfiKExEoVxPNjJ zhh5VQJ3gsTFh33 x4ok3tBeHSCBaXf maca8wHimGnFbRk 4SR7iQrcLfuJ63d eKt1idsJyTrEgx4 knuGSV3t5frWGKe yYkGkzTFoqj68CU LgFqmokwu8nMdRF Hy3Qae6tq7d6R96 nssgmGWsTvAQsk5 5mKZtgtH7xD5fyk 6YojA3kM6UQDjoh 2JNS1LwirJ5Dt3k RJAL8sFZBq62mny PiqwMLkY4Hnp7M7 iuFgUjtSJnJP44U XU1fD7QNhQHHkU1 J94ECdakq15n94Z wDZawLRdPAdcpCa hUANUAFFdN4UmUL UuX3e7HxenjqsZW UnKhSDkrsLGM39w o3kNW4VT. ENDSLATEPACK.
--- CUT ABOVE THIS LINE ---
Slatepack data was also output to
/home/nick-test/grin-wallet-2/slatepack/7a15069f-dc07-4767-a915-22f83cc0bca2.I3.slatepack
The slatepack data is NOT encrypted
Command 'finalize' completed successfully
Wallet (1) state, after the finalize command:
~$ grin-wallet info
____ Wallet Summary Info - Account 'default' as of height 1020750 ____
Confirmed Total | 4.215000000
Awaiting Confirmation (< 10) | 4.215000000
Awaiting Finalization | 0.000000000
Locked by previous transaction | 0.000000000
-------------------------------- | -------------
Currently Spendable | 0.000000000
Wallet (2) state, after the finalize command.
~/grin-wallet-2$ grin-wallet info
____ Wallet Summary Info - Account 'default' as of height 1020749 ____
Confirmed Total | 0.676500000
Awaiting Confirmation (< 10) | 0.100000000
Awaiting Finalization | 0.000000000
Locked by previous transaction | 0.000000000
-------------------------------- | -------------
Currently Spendable | 0.576500000
The test case did run as expected.
Well done @ndcroos !
Description Testing the init send tx method from the Owner API
Prerequisites
Test procedure
invoice -> pay -> finalize
flow as done in https://github.com/Grinnode-live/2020-grin-bug-bash-challenge/issues/17Expected result: Expect the
invoice -> pay -> finalize
flow initiated by Owner API to work correctly as in https://github.com/Grinnode-live/2020-grin-bug-bash-challenge/issues/17Include the output of the following command for both wallets
and your environment