Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/baseserver: add a direct /send command #202

Closed
odeke-em opened this issue Aug 2, 2017 · 4 comments
Closed

cmd/baseserver: add a direct /send command #202

odeke-em opened this issue Aug 2, 2017 · 4 comments

Comments

@odeke-em
Copy link
Collaborator

odeke-em commented Aug 2, 2017

Currently in order to send money from one account, it requires the following steps(in order):

However, while testing out things I noticed this dance can be simplified, just like for basecli to send it is one step

$ basecli tx send --name=cool --amount=900mycoin --to=7C6AAAECE9BC4D04971B196B1CBA7D7CD78F72B8 --sequence=1
Please enter passphrase for cool: XXXXXXXXXXXXXXXX

Which gives

{
  "check_tx": {
    "code": 0,
    "data": "",
    "log": ""
  },
  "deliver_tx": {
    "code": 0,
    "data": "8BA39A5D4985125816F2204D955E2796D3C1511B",
    "log": ""
  },
  "hash": "969246C07A1C953F1DADD428FCE8DD971786CD95",
  "height": 1971
}

I propose we make a route for /send whose request looks like this

{
  "from": "cool",
  "to": "7C6AAAECE9BC4D04971B196B1CBA7D7CD78F72B8",
  "amount": {"denom": "mycoin", "amount": 9888},
  "sequence": 1,
}

which will then perform all the steps necessary to send a transaction and post it to the blockchain.

@odeke-em
Copy link
Collaborator Author

odeke-em commented Aug 2, 2017

/cc @ethanfrey @mappum

@ethanfrey
Copy link
Contributor

There is a reason to separate them to allow for multisig and checking the TX before sending.

The /send helper is nice, but you need the name envelope for it to work.

I will open two new issues. Please put this as lower priority

@ethanfrey
Copy link
Contributor

Thinking more about this, I see the utility for the main case. I want to allow the mutisig case with minimal code duplication. I would also prefer /tx/send to have parity (like /query/account), and also to keep the top level name-space clean.

Here is a proposal (depends on #205 being finished)

  • /build/send, /sign work as they do now (except for changes to /sign as part of Add /login /logout and cookies for ID in rest server #205)
  • /tx will by default sign and post, unless you pass /tx?sign=false, where it retains current behavior
  • Add new /tx sub-routes, to mirror /query, these should be build, sign and post all in one

So:

  • /tx/send for all in one (same args as /build/send now)

  • /build/send, /tx as two steps if you want to see the tx or modify it before signing and posting, or just prepare a tx to present someone else via eg. QR code to sign

  • /build/send, /sign... pass to someone else... /sign... pass to final user /tx to sign last time and post. This is how multi-sig can have a clean workflow.

Or course, in this case, the last tx to post may not want to sign (we got enough sigs, just put it on the chain already)

@ethanfrey ethanfrey added the API label Aug 20, 2017
@ebuchman
Copy link
Member

relevant to #324. closing but should be considered there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants