Use account numbers
We can give each account its own number, incrementing from a global nonce every time a new account is created (similar to how it is done in cosmos-sdk).
This lets us prune accounts (delete them from the state when there is 0 balance) then re-create them later without risking replay attacks.
An interesting remark, Do not tell me how we can create new accounts in the context of a mappum/coins? I do not have much experience in the detachment, so I can not understand it.
See: We have initalBalances, when I create new keys (bin.js) and let's say something from the balance to the address, the operation can not be performed (balance of undefined). So I do not quite understand, but it is not created, but I do not quite understand how to create it after launch. Only if you make a condition: if there is no account then just add it to the state.
Thanks
At the moment I did this via the Lotion.use(). Only here it turns out that the account can be created by anyone who can make a request to Lotion.http, I try to implement this through a signature confirmation and only for the account's accountant, so that it's impossible to spam the state.
@cryptoji You can do that a few ways. First, you could just own an account in the initial state which has a very large balance, then send some coins from it to the other accounts when you need to. Or you can do it by minting new coins as you described, but that method breaks the economics of cryptocurrency since people have to trust you not to mint too many coins (although that's ok if it's a testnet).
@mappum unfortunately in that case I get an error (( Perhaps then we should modify the onInput function in the accounts.js file Now there is a check and if there is no account, then we will get an exception right here:
let account = state [address]
if (account == null) {
throw ("Invalid account" $ {address} "`)
}
can it then be worth adding a non-existent address in the article forcibly?
by the way there is a more serious problem in the lotion or most likely in the Tendermint. When I put my genesis.json and keys, Tendermint simply does not rise or crashed (( Have you had experience synchronizing several nodes? If you could help me, I would be very grateful to you))
@cryptoji I think I misunderstood your issue.
I'm confused about what you are proposing, isn't this check already in the accounts.js onInput? https://github.com/mappum/coins/blob/master/src/accounts.js#L44-L49
As for your Tendermint/lotion problems I'm happy to assist, can you give me some info about what versions you are using and some more detailed steps about what you are doing?
@mappum I created a repository where I allowed myself to get bogged down on the code, please do not judge me strictly, I just have very little time and am trying to do something))) You can see the code here: https://github.com/cryptoji/example-blockchain If you are interested we could talk in Telegram (my account @arenotthey) or another messenger and discuss this. For your invaluable experience and time, I have a business proposal for you for a couple of days.
yes https://github.com/mappum/coins/blob/master/src/accounts.js#L44-L49 but I did a little differently, because I do not know how else I can safely add the address to the state so that no one knowing the port could spam the network. see: https://github.com/cryptoji/example-blockchain/blob/master/token/src/accounts/index.js#L49
Sorry that I'm doing everything in my branch, I would definitely like to join the contributors if my hands and brains are useful to you)) A little later, if possible, I would like to help you refine your repository. Many thanks to you for this work, you are very much helping the beginning enthusiasts