Send Testnet Tokens


#1

Is the spend-tx command obsolete? The swagger.json file has it tagged as obsolete. The following documentation references it but I’m encountering errors despite having a token balance and ports configured properly.

Is tx/spend the new spend command? Thanks!


#2

Hi,
This internal API is to be deleted before main net, thus is tagged as obsolete.

What it does: this is mostly a quick API for posting a transaction. It prepares, signs and posts a spend_tx
originating from the miner of the node (you see - no sender there, just a recipient_pubkey). In real life scenario - one shall never trust a node to sign a transaction for her. Having said this - the API is still functional. Provided with the errors you’re having - I could help you further.

In a real life scenario - you’ll have a wallet app outside of the node. That app persists your nonce and bumps it accordingly. It also prepares transactions for you (not trusting a node to do it for you) and takes care of signing and then posting to the node.

While developing this wallet it is handy to have an endpoint for providing a semantically correct unsigned transactions. Basically what a correct transaction with the same data would look like. This is where tx/spend come creates to play - provided the data, it builds a semantically valid spend transaction. You can put any input there and you’ll get a structurally valid transaction that - if you want to - you could sign and post on the node. Of course you can create a semantically valid transaction that still ends up being invalid because of its data (not enough tokens, erroneous nonce…).