I use my own babbylon node and previously i have added some wallet from tezos faucet and send some coins to my generated wallet with tezos-client:
./tezos-client transfer 8500 from test_w1 to tz1b3RxJP2TDQZEvmdBtobCZ6QpcBHSYs6xA --burn-cap 258
Send via eztz.js
Now i'm trying to send tezos from one generated wallet to another with eztz.js lib. Use this code:
async function send(toAddress, keys, amount, fee) {
//function (contract, from, keys, amount, parameter, fee, gasLimit, storageLimit)
await eztz.contract.send(toAddress, keys.pkh, keys, amount, "", fee, 20000, 20000);
}
await send(
"tz1QHRFZJcPJoNiqWQnuUuHHAmKLN7AdUmSN",
{
pk: "edpkvVbT6jFiT2MHKEp9BeVubxmEnK7GUYo3iRwxWWY3Y4Rk8VrRcA",
pkh: "tz1b3RxJP2TDQZEvmdBtobCZ6QpcBHSYs6xA",
sk: "edskRny9Tbjrjfcks1TWEQfM789RHbhdscHRuSm4huvQoYqNQsPeupLqahC8q2Xmy7vmov5gfTTT1PxBVmu8EigRuocE3hB8tQ"
},
300000000,
10000000
);
When i execute it first time - node inject my operation and even return address of transaction, but this transfer wansn't added to blockchain, my balance wasn't changed. First time operation logs:
When tried to send second time - get counter error:
Error while applying operation onnqHbU5bigtJbCRZD8HYPtVZKsyioNSM2tbvGMS9unMVsfhnBG:\nbranch refused (Error:\n Counter 128324 already used for contract tz1b3RxJP2TDQZEvmdBtobCZ6QpcBHSYs6xA (expected 128326)\n)"}]
If manually set counter to 128326 - will receive error counter_in_the_future
.
Counter error gone after half an hour, but still if i try to send coins - operation will be not included to blockchain and i will receive counter error again.
Send via tezos-client
I imported my generated private key as test_w2 and try to send coins with tezos-client:
./tezos-client transfer 8500 from test_w2 to tz1UqBubMBKtEVpN6jkNQwc3TAoBNdtmtiyM --burn-cap 258
First time i've get same counter error:
But after half an hour it worked:
So it means, error not in wallets generating or tezos node, error can be only in eztz.js client or passed values. Maybe i've passed wrong fee / gas_limit / amount?
How can i fix this?
Note. Actually, i use forked Tz.Net library (c#), but it has same workflow as eztz.js and i receive same errors.