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

rawissueasset RPC call #474

Merged

Conversation

instagibbs
Copy link
Contributor

@instagibbs instagibbs commented Nov 29, 2018

Resolves the initial issuance portion of: #471

The user follows this flow:
createrawtransaction->fundrawtransaction->rawissueasset->blindrawtransaction->signrawtransaction

rawissueasset is a new RPC call that allows the user to append N-many issuances, up to the amount of inputs the transaction has, at once. It allows the issuances to be "marked" for blinding later(only effects reissance token asset id), and for the destination outputs to be arbitrary addresses, blinded or otherwise.

Previously fundrawtransaction would not blind issuances(pretty much on accident), so I have added an argument, default true, on whether to blind issuances, since there is no field in the transaction itself to mark as whether we want to blind it or not.

Note: This will cause your transactions' fee-rate to go down, so the caller may want to over-shoot fees during the fundrawtransaction call as cushion.

I also fixed a couple bugs on the way as I uncovered them.

@instagibbs
Copy link
Contributor Author

I should add light tests for contract argument, and sequential addition of issuances on the same tx.

@instagibbs
Copy link
Contributor Author

Added contract/sequential tests, fixed unexpected behavior of the contract argument expecting hex string.

@instagibbs
Copy link
Contributor Author

Changed return value for RPC call to be a list of objects with issuance details, added basic tests.

@instagibbs
Copy link
Contributor Author

Realized the wallet is possible appending tokens to vector beyond the fee output, which is always the last output by wallet default. Will fix.

@instagibbs
Copy link
Contributor Author

fixed the output pushing fee output issue

{
if (request.fHelp || request.params.size() != 2)
throw runtime_error(
"rawissueasset transaction [{\"asset_amount\":x.xxx, \"asset_address\":\"address\", \"token_amount\":x.xxx, \"token_address\":\"address\", \"blind\":bool}, ...]\n"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add contract

}

CAmount token_amount = 0;
const UniValue& token_amount_uni = find_value(issuance_o, "token_amount");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch from find_value to direct access for style

@instagibbs
Copy link
Contributor Author

instagibbs commented Dec 2, 2018

I'm going to switch the contract argument to a contract hash, passed in as hex string. This will streamline the reissuance call.

@instagibbs instagibbs mentioned this pull request Dec 3, 2018
@instagibbs
Copy link
Contributor Author

Pushed update addressing some of @stevenroose comments as well as converting the contract argument to a hash.

@stevenroose
Copy link
Member

tACK ca383ac

@instagibbs instagibbs merged commit ca383ac into ElementsProject:elements-0.14.1 Dec 12, 2018
instagibbs added a commit that referenced this pull request Dec 12, 2018
ca383ac add functional testing for raw issuance call (Gregory Sanders)
a5e1af5 rawissueasset RPC call (Gregory Sanders)
f9f91ba Fixup issueasset help results information (Gregory Sanders)
69d8d15 Break out issuance-specific testing to its own functional test (Gregory Sanders)
2b22b6d Fixup (raw)blindrawtransaction (Gregory Sanders)
a5e9e0e Fix blinding logic for issuances on input 1 or higher (Gregory Sanders)
83df289 fixup BlindTransaction issuance counting assertion (Gregory Sanders)

Pull request description:

  Resolves the initial issuance portion of: #471

  The user follows this flow:
  `createrawtransaction->fundrawtransaction->rawissueasset->blindrawtransaction->signrawtransaction`

  `rawissueasset` is a new RPC call that allows the user to append N-many issuances, up to the amount of inputs the transaction has, at once. It allows the issuances to be "marked" for blinding later(only effects reissance token asset id), and for the destination outputs to be arbitrary addresses, blinded or otherwise.

  Previously `fundrawtransaction` would not blind issuances(pretty much on accident), so I have added an argument, default `true`, on whether to blind issuances, since there is no field in the transaction itself to mark as whether we want to blind it or not.

  Note: This will cause your transactions' fee-rate to go down, so the caller may want to over-shoot fees during the `fundrawtransaction` call as cushion.

  I also fixed a couple bugs on the way as I uncovered them.

Tree-SHA512: fa77158c390743f579797d426b9d9cb000a5d686a8b10aa818b1e9ad65fdc42ac139a36ad226e31676b3bd9c6643bc69074869d6a927309a7ec328c91e853bec
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

Successfully merging this pull request may close these issues.

2 participants