Comments (4)
Hi, send the transaction of the same address simultaneously will indeed cause Invalid sequence
error.
To defend the replay attack, the sequence of an address should increase in order. But if send transaction too fast(use async/sync) or simultaneously, the previous transaction haven't included in block yet, go-sdk will fetch the current sequence and sign new transaction, cause sequence discontinuous.
Because there is no guarantee the previous transaction will be included in block, so we get account sequence each time before send the transaction instead of increase it automatically.
from go-sdk.
@guagualvcha Is it possible to allow users to assign sequence number for each transaction manually? For applications like market making bot it's fatal to send both bid & ask orders at the same time.
from go-sdk.
make sense. I will submit a PR soon.
from go-sdk.
@touhonoob hi, go-sdk have updated to support custom sequence.
example:
acc,err:=client.GetAccount(client.GetKeyManager().GetAddr().String())
_, err = client.CreateOrder(tradeSymbol, nativeSymbol, msg.OrderSide.BUY, 100000000, 100000000, true, transaction.WithAcNumAndSequence(acc.Number,acc.Sequence))
_, err = client.CreateOrder(tradeSymbol, nativeSymbol, msg.OrderSide.BUY, 100000000, 100000000, true, transaction.WithAcNumAndSequence(acc.Number,acc.Sequence+1))
_, err = client.CreateOrder(tradeSymbol, nativeSymbol, msg.OrderSide.BUY, 100000000, 100000000, true, transaction.WithAcNumAndSequence(acc.Number,acc.Sequence+2))
from go-sdk.
Related Issues (20)
- setup CI on travis.ci
- local dev environment doc
- Client.Block() returns nil block ID and invalid block hash HOT 3
- rpcClient.Block(&block) return context.DeadlineErr HOT 2
- Check amount for bep8 transfer
- go: finding module for package github.com/tendermint/tendermint/libs/common D:\mygo\pkg\mod\github.com\binance-chain\[email protected]\common\types\nodeinfo.go:6:2: module github.com/tendermint/tendermint@latest found (v0.33.6), but does not contain package github.com/tendermint/tendermint/libs/common HOT 1
- Go SDK's testnet chain ID still set to "Binance-Chain-Nile"
- 创建的地址与实际不符
- problem with open orders and order status
- 怀疑bnb 节点维护的nonce有问题
- No support for creating orders with IOC TimeInForce
- response: RPC error -32603 - Internal error: Timed out waiting for tx to be included in a block
- Not able to communicate with RPC public node
- why must use https when new dex client? please support http
- This project is useless
- Conflict with go-ethereum: duplicate symbol '_secp256k1GoPanicError' HOT 2
- tx decode problem HOT 1
- 我现在的Mac系统是13.2.1,报错了。能否修复一下这个bug。感谢了 HOT 1
- i get error undefined: sdk.LimitConsAddrUpdateInterval HOT 5
- Websocket subscription gets closed after a few minutes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-sdk.