Error while executing transfer
kpv9 opened this issue · comments
I am trying to execute packages/example but it is failing while transferring the tokens from alice to bob.
The error is transaction reverted. What am i supposed to do?
Are you sure you have an updated ethereum node? I recommend you to install ganache
Are you sure you have an updated ethereum node? I recommend you to install ganache
yes the ethereum node is updated. I am unable to try it on ganache as i dont know how to enable websocket in ganache-cli.
Again, try using ganache. It is really easy to set up. After you start it, increase the gas limit for the block and then set the port in the anonymous-zether
You are doing it well. Your sender account doesn't have enough funds (probably it has 0 eth). The thing is that when the transfer is called it requires eth gas for the sender. Just give some eth from ganache to the sender address.
This is because gas is not free in your environment, and Anonymous Zether generates a random account to send from. please see the discussion here #24 (comment) and below! thank you.
The quickest way to fix it is to use instead of throwaway
, a fixed account, which you have pre-funded with ether.
Thank you so much @benediamond and @ibudisteanu . It worked perfectly.
@kpv9 good to hear!
actually, @kpv9 @ibudisteanu, can you do me a big favor, and tell me whether the issue is solved by adding 'gasPrice': 0,
to line 275?
https://github.com/jpmorganchase/anonymous-zether/blob/8cafe19e2fb6a56f8c45a4718c3fc2b24e59ccee/packages/anonymous.js/src/client.js#L275
if this works, it might be the easiest solution; in that case i'll push a fix for it. thanks.
no it didn't work if we use throwaway.
ok interesting, thanks for giving that a try.
@benediamond hey can you please give me a javascript in which Alice transfers b amount confidentially to Bob and then that b ZTH are burnt back in Bob's account.
Just follow the example. It is more than clear.
const alice = new Client(web3, deployed, accounts[0]);
await alice.register();
await alice.deposit(100);
const bob = new Client(web3, deployed, accounts[0]);
await bob.register();
alice.friends.add("Bob", bob.account.public());
await alice.transfer('Bob', 10);
await bob.withdraw(10);
hey, now i want to check the balance of bob's ethereum account before transfer and after burn has executed. which address to use in getBalance()?????
@kpv9 as far as I know, the tests code is a simplification of the entire process because it is used only for testing. I recommend you just use the console.log(bob.account._state.available)
for printing out the balance.
I know that the Burn is sending the burned coins to the msg.sender
namely to the address which is making the burn transaction namely accounts[0]
, where accounts = web3.eth.getAccounts()
;