darkfi
darkfi copied to clipboard
Cannot broadcast Atomic swaps transactions.
I followed the testnet instructions.
- A initiate the swap and get the
half_swap
file. - B use the
half_swap
file to create thefull_swap
. - A sign the
full_swap
and getsigned_swap
- All the above steps are successful, A run
.\drk broadcast < signed_swap
then get error
Error: Failed to broadcast transaction
Caused by:
JSON-RPC error: "Failed simulating transaction state change"
- I use
./drk otc inspect <full_swap
, got error at the bottom
Output[0] value: 4000000000 (40)
Output[0] token ID: DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq
Error: Output[0] coin does not match note metadata
Error: Failed to inspect swap
Caused by:
Inspection failed
Version : v4.0.0 rustc 1.67.0 (fc594f156 2023-01-24)
Are you using different nodes/wallets to execute the steps?
Yes. A and B are on different VPS and they are different wallet.
You need to spend whole coins in swaps, so you need to have an unspent coin with the balance you want to swap. Use ./drk wallet --coin to check which coins are unspent. When executing ./drk wallet --balance, unspent coins of the same token are getting summed, for example you hold 2 coins of token DARK..... one with value of 1 and another with value of 2, you balance will show DARK..... -> 3. If you don't want to swap the whole coin, you can transfer to your self/wallet so you split up the single coin into multiple ones.
yes, A and B used whole coins in swap. Actually if I don't use full coin. step 1, 2 below won't succeed.
- A initiate the swap and get the half_swap file.
- B use the half_swap file to create the full_swap
I use full coin to swap , but still failed to broadcask. I tried many times.
Could you try ./drk scan --reset, to reset the wallet state and then repeat the steps?
tried again. step A:
./drk wallet --coins
Fetching OwnCoins from the wallet
Coin | Spent | Token ID | Value
----------------------------------------------+-------+----------------------------------------------+-----------------
GFrcwJneShDvxb4RGu2pkdPTt3s4E2EdXNHFmeTAXjZo | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 6600000000 (66)
3d2hQa225Jdn44eRzPoxbwi462koKY5w5bZ7PdNCaC8R | false | BobvfQrDaf32VNhVtX6Adyi3WGfPpPYZPJBn6rnrxHKm | 4400000000 (44)
B.
./drk wallet --coins
Fetching OwnCoins from the wallet
Coin | Spent | Token ID | Value
----------------------------------------------+-------+----------------------------------------------+--------------------
3d1dRxD2w3hskaH6bk4vrACGdFReVzwE54vHwAu45Efo | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 4269000000 (42.69)
8ShyBXfuN1JNNywtyZK2acgUQGjoNP7RwStGDUa1YYWN | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 4000000000 (40)
Gxvz1CAU6hohtVBA9MEDNwzgDL2WH2inFvjsvo97GeKo | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 3900000000 (39)
AiaQtRXgRT8kkD3fREAZWPmL564VdDAP4MeTz2hajHad | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 100000000 (1)
GghzS4j9LwYdD7tDdWM6zS5Z3ZxoeLhMbnDht2eSP2F2 | false | A7f1RKsCUUHrSXA7a9ogmwg8p3bs6F47ggsW826HD4yd | 9000000000 (90)
A:
./drk otc init -v 44:90 -t BobvfQrDaf32VNhVtX6Adyi3WGfPpPYZPJBn6rnrxHKm:A7f1RKsCUUHrSXA7a9ogmwg8p3bs6F47ggsW826HD4yd > half_swap
Fetching OwnCoins from the wallet
Querying zkas bincode for 9EUgjxrMd7g3CTP47pj8gumaFCNsziXLFC4sKHH5WLen
Creating Mint circuit proving key
Creating Burn circuit proving key
Building first half of the swap transaction
thansfer half_swap file to B B:
./drk otc join < half_swap > full_swap
Fetching OwnCoins from the wallet
Querying zkas bincode for 9EUgjxrMd7g3CTP47pj8gumaFCNsziXLFC4sKHH5WLen
Creating Mint circuit proving key
Creating Burn circuit proving key
Building second half of the swap transaction
Signing swap transaction
transfer full_swap to A
A:
./drk otc sign < full_swap > signed_swap
Trying to decrypt note in outputs[0]
Successfully decrypted and found an ephemeral secret
Signing swap transaction
./drk broadcast < signed_swap
Reading transaction from stdin...
Broadcasting transaction...
Error: Failed to broadcast transaction
Caused by:
JSON-RPC error: "Failed simulating transaction state change"
The final result is same error.
Hey there is a fix pushed about syncing, so I would recommend to do a hard reset of the blockchain. So you have to stop your node, remove the blockchain folder(probably at ~/.config/darkfi/darkfid/blockchain), pull, recompile, let the node sync, and finally force wallet reset with ./drk scan --reset. This way all the states will be synced correctly and the performing the steps(hopefully last time) will result in success!
removed the blockchain folder, pulled the latest commit, rebuild. I wanna resync the blockchain but got this error now.
./darkfid
17:29:56 [INFO] wallet::walletdb: Creating path to wallet database: /home/darkfi/.config/darkfi
17:29:56 [INFO] wallet::walletdb: Opened wallet Sqlite connection at path sqlite:///home/darkfi/.config/darkfi/darkfid_wallet_testnet.db
17:29:59 [INFO] consensus::validator: Deploying native wasm contracts
17:29:59 [INFO] consensus::validator: Deploying Money Contract with ContractID 9EUgjxrMd7g3CTP47pj8gumaFCNsziXLFC4sKHH5WLen
17:29:59 [INFO] runtime::vm_runtime: Instantiating a new runtime
17:29:59 [INFO] runtime::vm_runtime: [wasm-runtime] Running deploy
17:29:59 [INFO] consensus::validator: Successfully deployed Money Contract
17:29:59 [INFO] consensus::validator: Creating ZK verifying keys for Money Contract zkas circuits
17:29:59 [INFO] consensus::validator: Looking up zkas db for Money Contract (ContractID: 9EUgjxrMd7g3CTP47pj8gumaFCNsziXLFC4sKHH5WLen)
17:29:59 [INFO] consensus::validator: Iterating over zkas db
17:29:59 [INFO] consensus::validator: Deserializing namespace
17:29:59 [INFO] consensus::validator: Creating VerifyingKey for zkas circuit with namespace Burn_V1
17:30:02 [INFO] consensus::validator: Iterating over zkas db
17:30:02 [INFO] consensus::validator: Deserializing namespace
17:30:02 [INFO] consensus::validator: Creating VerifyingKey for zkas circuit with namespace Mint_V1
17:30:05 [INFO] consensus::validator: Iterating over zkas db
17:30:05 [INFO] consensus::validator: Deserializing namespace
17:30:05 [INFO] consensus::validator: Creating VerifyingKey for zkas circuit with namespace Lead_Burn_V1
17:30:07 [INFO] consensus::validator: Iterating over zkas db
17:30:07 [INFO] consensus::validator: Deserializing namespace
17:30:07 [INFO] consensus::validator: Creating VerifyingKey for zkas circuit with namespace Lead_Mint_V1
17:30:10 [INFO] consensus::validator: Iterating over zkas db
17:30:10 [INFO] consensus::validator: Deserializing namespace
17:30:10 [INFO] consensus::validator: Creating VerifyingKey for zkas circuit with namespace TokenMint_V1
17:30:13 [INFO] consensus::validator: Finished creating VerifyingKey objects for Money Contract (ContractID: 9EUgjxrMd7g3CTP47pj8gumaFCNsziXLFC4sKHH5WLen)
17:30:13 [INFO] consensus::validator: Deploying DAO Contract with ContractID 9qiynXwcrF5LJz3veTPmvZHmDcQRhCchVnEZSR1TJ39f
17:30:13 [INFO] runtime::vm_runtime: Instantiating a new runtime
17:30:13 [INFO] runtime::vm_runtime: [wasm-runtime] Running deploy
Error: ContractError(IoError("Unknown"))
If you had removed the folder there should be an error that the contract is not there, maybe first deleted then stopped? Retry stopping then removing the folder again just for sanity sake.
I know the problem now. the folder should be darkfid_blockchain_testnet
. After remove that , my node start to sync from start. I will try atomic swap again
Thank you ! This time broadcast signed_swap successfully finally.
but ./drk otc inspect <full_swap
this command still get this error at buttom
Error: Output[0] coin does not match note metadata
Error: Failed to inspect swap
And another problem I found.
./drk wallet --coins
will show dao balances as coin.
./drk wallet --coins
Fetching OwnCoins from the wallet
Coin | Spent | Token ID | Value
----------------------------------------------+-------+----------------------------------------------+--------------------
3d1dRxD2w3hskaH6bk4vrACGdFReVzwE54vHwAu45Efo | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 4269000000 (42.69)
8ShyBXfuN1JNNywtyZK2acgUQGjoNP7RwStGDUa1YYWN | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 4000000000 (40)
Gxvz1CAU6hohtVBA9MEDNwzgDL2WH2inFvjsvo97GeKo | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 3900000000 (39)
AiaQtRXgRT8kkD3fREAZWPmL564VdDAP4MeTz2hajHad | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 100000000 (1)
The last one
AiaQtRXgRT8kkD3fREAZWPmL564VdDAP4MeTz2hajHad | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 100000000 (1)
is from dao balance
./drk dao balance 1
Fetching OwnCoins from the wallet
Token ID | Balance
----------------------------------------------+---------
DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 1
I cannot atomic swap this coin as well.
./drk otc init -v 1:2 -t DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq:BobvfQrDaf32VNhVtX6Adyi3WGfPpPYZPJBn6rnrxHKm
Fetching OwnCoins from the wallet
Error: Failed to create swap transaction half
Caused by:
Did not find any unspent coins of value 100000000 and token_id DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq
I think this may make people misunderstand. should not show dao balances as coin when run ./drk wallet --coins
Error: ContractError(IoError("Unknown")) is fixed now, rest stuff we'll look tomorrow and update you! Thanks again for the detailed errors.
Update: we are fixing a lot of testnet findings and will tag a new hotfix version and reset network in couple of days. We'll update this ticket to let you know when everything is ready. Cheers!
Network have been reset!
Please stop darkfid process, pull and recompile from master, then remove your local database folder(located at ~/.config/darkfi/blockchain) and start darkfid.
After syncing perform a ./drk scan --reset
so your wallet is synced to chain!
Let us know if any issue persists.
I often get this in new version. is it normal? in old version ,it was smooth
Error: Failed to fetch default address, perhaps the wallet was not initialized?
Caused by:
Network operation failed
Did you remove your wallet file? If yes you have to reinit your wallet.
No I didn't. and sometimes it can succeed.
also other operation I often get Network operation failed
too
Are you sure this is not OS related? What system are you on?
ubuntu 20.04 , I will try run node again or on different machine.
I know the problem now. I have old unclosed darkfid
process running. It cause Network operation failed
happen sometimes due to database occupied.(Maybe ?)
I suggest check if there is a process already running before start the node.
./drk otc inspect <full_swap
this command still have error at buttom
Trying to decrypt note in output 0
Successfully decrypted and found an ephemeral secret
Output[0] value: 1337000000 (13.37)
Output[0] token ID: BobvfQrDaf32VNhVtX6Adyi3WGfPpPYZPJBn6rnrxHKm
Error: Output[0] coin does not match note metadata
Error: Failed to inspect swap
Caused by:
Inspection failed
And another problem I found.
./drk wallet --coins
will show dao balances as coin../drk wallet --coins Fetching OwnCoins from the wallet Coin | Spent | Token ID | Value ----------------------------------------------+-------+----------------------------------------------+-------------------- 3d1dRxD2w3hskaH6bk4vrACGdFReVzwE54vHwAu45Efo | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 4269000000 (42.69) 8ShyBXfuN1JNNywtyZK2acgUQGjoNP7RwStGDUa1YYWN | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 4000000000 (40) Gxvz1CAU6hohtVBA9MEDNwzgDL2WH2inFvjsvo97GeKo | true | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 3900000000 (39) AiaQtRXgRT8kkD3fREAZWPmL564VdDAP4MeTz2hajHad | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 100000000 (1)
The last one
AiaQtRXgRT8kkD3fREAZWPmL564VdDAP4MeTz2hajHad | false | DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 100000000 (1)
is from dao balance
./drk dao balance 1 Fetching OwnCoins from the wallet Token ID | Balance ----------------------------------------------+--------- DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq | 1
I cannot atomic swap this coin as well.
./drk otc init -v 1:2 -t DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq:BobvfQrDaf32VNhVtX6Adyi3WGfPpPYZPJBn6rnrxHKm Fetching OwnCoins from the wallet Error: Failed to create swap transaction half Caused by: Did not find any unspent coins of value 100000000 and token_id DARKfZX1utGbz8ZpnvtCH6i46nSDZEEGa5fMnhoubWPq
I think this may make people misunderstand. should not show dao balances as coin when run
./drk wallet --coins
and I think this issue still exist.