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

Tx (change) output splitter #1369

Merged
merged 7 commits into from Aug 18, 2018
Merged

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Aug 17, 2018

This PR lets us specify an (optional) number of change outputs to generate when building a transaction via grin wallet send via --change_outputs=2.

If this is not specified then we default to 1 single change output as per current behavior.

The primary motivation for this was to have an easy way of generating a bunch of test data (unspent outputs) that can then be used to test large txs and large blocks etc.

../target/release/grin wallet send --help   
grin-wallet-send 
Builds a transaction to send coins and sends it to the specified listener directly.

USAGE:
    grin wallet send [FLAGS] [OPTIONS] [amount]

FLAGS:
    -f, --fluff      Fluff the transaction (ignore Dandelion relay protocol)
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -o, --change_outputs <change_outputs>     Number of change outputs to generate (mainly for testing). [default: 1]
    -d, --dest <dest>                         Send the transaction to the provided server
    -c, --min_conf <minimum_confirmations>    Minimum number of confirmations required for an output to be spendable.
                                              [default: 1]
    -s, --selection <selection_strategy>      Coin/Output selection strategy. [default: all]  [possible values: all,
                                              smallest]

ARGS:
    <amount>    Number of coins to send with optional fraction, e.g. 12.423

Generating a tx with a single change output looks something like this -

../target/release/grin wallet send 1.0 --fluff -d "http://127.0.0.1:13415" --change_outputs 1
...
Aug 17 15:45:52.955 DEBG Refreshing wallet outputs
Aug 17 15:45:53.673 DEBG Building input (spending coinbase): 60000000000, 8190a17d03ad020ffa6a
Aug 17 15:45:53.673 DEBG Building input (spending coinbase): 60408000000, 73a344933aba24fccfc8
Aug 17 15:45:53.673 DEBG Building change outputs: total change: 119401000000 (1 outputs)
Aug 17 15:45:53.766 DEBG Building an output: 119401000000, Commitment(081fbc77ad3e806618c36d6148b73aae396878bac5499258375b909ba60f97c3b4)
Aug 17 15:45:53.824 DEBG Posting transaction slate to http://127.0.0.1:13415/v1/wallet/foreign/receive_tx
Aug 17 15:45:54.043 DEBG Validating final transaction
Aug 17 15:45:54.056 INFO Tx created: 1.000000000 grin to http://127.0.0.1:13415 (strategy 'all')
Aug 17 15:45:54.139 INFO Tx sent
Aug 17 15:45:54.115 INFO Pushing transaction with 2 inputs and 2 outputs to pool.
Aug 17 15:45:54.115 DEBG pool: add_to_pool: a1c6afaa, kernels - 1, stem? false
Aug 17 15:45:54.127 DEBG pool [txpool]: add_to_pool: a1c6afaa, TxSource { debug_name: "push-api", identifier: "?.?.?.?" }

Generating a tx with a large number of change outputs looks like this -

../target/release/grin wallet send 1.0 --fluff -d "http://127.0.0.1:13415" --change_outputs 51
...
Aug 17 15:50:41.101 DEBG Refreshing wallet outputs
Aug 17 15:50:41.914 DEBG Building input (spending coinbase): 60000000000, ad60d899d35cb61e174a
Aug 17 15:50:41.914 DEBG Building change outputs: total change: 58792000000 (51 outputs)
Aug 17 15:50:42.039 DEBG Building an output: 1152784313, Commitment(099ed55f0043f0745d158aeefbd869e833d00b182ccd90875f70280257c5fc663f)
Aug 17 15:50:42.189 DEBG Building an output: 1152784313, Commitment(0866d9afe100b16beb898a7eb465a8b320b7ae600484309d55e3218c091bbd45dd)
Aug 17 15:50:42.314 DEBG Building an output: 1152784313, Commitment(08e161226855ad0a4b7ea510c8d4e180e71e73f8cdb628be86bd21f73f64cbbeaa)
Aug 17 15:50:42.438 DEBG Building an output: 1152784313, Commitment(084c2cb6ad4547ae975eaeeecba22f079fa811aa0ef54bd037f099ff080d9167b6)
Aug 17 15:50:42.565 DEBG Building an output: 1152784313, Commitment(0834a9624b5b75a3ba667099a6b4249dd18add2b473f10053676cb7e31944129fd)
Aug 17 15:50:42.690 DEBG Building an output: 1152784313, Commitment(087144dce0aa9a7c97141eeaccab0fe3933b13d128d66b3175aadb88465582b641)
Aug 17 15:50:42.816 DEBG Building an output: 1152784313, Commitment(09cd98a2866ba1a778b60155a88e1ad72af566036dd61c550e20cdf0b44070b94c)
Aug 17 15:50:42.941 DEBG Building an output: 1152784313, Commitment(09ec65db8c3b0d4d0f70c5712e6eff43f18b857bada111d855613094cc4fd993fa)
Aug 17 15:50:43.072 DEBG Building an output: 1152784313, Commitment(09eb9e5b21e368234cea4ce21542c8f365ab0a3df4a2cc015b7f1f1911f6110b60)
Aug 17 15:50:43.201 DEBG Building an output: 1152784313, Commitment(09054979b6838ba9d4e913ad69e838213f73063dff1c0c231b2786b583241ca8f2)
Aug 17 15:50:43.328 DEBG Building an output: 1152784313, Commitment(09eae3308872dc9e7b943c008fa1ec19956620fcf3c2d8e5e432cc3b7d1d5963ba)
Aug 17 15:50:43.465 DEBG Building an output: 1152784313, Commitment(08bb6a47b4bb11b01424d181970e25c6320a7e3740269b0560349bc02000288c16)
Aug 17 15:50:43.604 DEBG Building an output: 1152784313, Commitment(085cd2efa8862cb23060a8a283546b669fe725d3ab06d05c39343c8be4f11f7bb8)
Aug 17 15:50:43.755 DEBG Building an output: 1152784313, Commitment(09170096d1d59b6a3cab12c99a022d89f5f1c0ddac883998b8e88e72ff841fd21a)
Aug 17 15:50:43.890 DEBG Building an output: 1152784313, Commitment(084c9d7abc4744c5a3057af12eff444d79f0000471e3969ee500f4aaac3009d905)
Aug 17 15:50:44.027 DEBG Building an output: 1152784313, Commitment(08f9d87a82cc50e44161cb0659f8b9b4ee85be53cb932716babda18e999fbd64e8)
Aug 17 15:50:44.158 DEBG Building an output: 1152784313, Commitment(09dd4d230feaaba4ac2715dc18e91f001fae9216c18ca1f10ab4fb2906acd5c20f)
Aug 17 15:50:44.297 DEBG Building an output: 1152784313, Commitment(08cc5707a7bc95e6e2a460c7a0e1bb598ab28e5f9d4f79469751760db14b255b5e)
Aug 17 15:50:44.434 DEBG Building an output: 1152784313, Commitment(08a6beda9eed2f14b28b582411402470085de38e70b87446afb75b6886aba47239)
Aug 17 15:50:44.572 DEBG Building an output: 1152784313, Commitment(092ab2a95396372509100622f6aded859ab93a5c942c74298529319bf75bd1f804)
Aug 17 15:50:44.709 DEBG Building an output: 1152784313, Commitment(09228d723054cc5d13cfe5ca59c4355981f7cb5e838126c3f7272679caea19cd70)
Aug 17 15:50:44.846 DEBG Building an output: 1152784313, Commitment(086c503fa482633910005deee9971fd0363448e207cc335834472740718b84a92e)
Aug 17 15:50:44.981 DEBG Building an output: 1152784313, Commitment(0954146708c2a6502113c91af5b183d50569125b32cbcde5d1ea79002511d79194)
Aug 17 15:50:45.121 DEBG Building an output: 1152784313, Commitment(084b39014a16cb09306375b833a368a4f9612099b886789a8ffcb93f6674335231)
Aug 17 15:50:45.257 DEBG Building an output: 1152784313, Commitment(0926644d3a799ac4c1341344307b219fe6d6c43b518485c3b7d795707b72b548b2)
Aug 17 15:50:45.399 DEBG Building an output: 1152784313, Commitment(090b75cfc0d557feff074e5d599364c099406e2353e79738344c48374c55d6ad2b)
Aug 17 15:50:45.535 DEBG Building an output: 1152784313, Commitment(09c3a89eca344fc5c68949740963d495b891730de471eb2748dd45b4edf8285d0a)
Aug 17 15:50:45.674 DEBG Building an output: 1152784313, Commitment(086a7aa630dba6055bd8e6d98612b55c5c516af1fd6557eb97c08eb054ea63f14b)
Aug 17 15:50:45.814 DEBG Building an output: 1152784313, Commitment(09fea854170325e40186ac133705a4731f365d3893d80445d11cc212e14b5160bd)
Aug 17 15:50:45.956 DEBG Building an output: 1152784313, Commitment(09fb608da71dcaa80a70728f189eaad87b665ad1f5c0057b710e05d02e7cc92a30)
Aug 17 15:50:46.096 DEBG Building an output: 1152784313, Commitment(08a6dd55373c28a36e2ecc4cb9b6a8a3a80e73ac165c417aa1d4b57c572ef362bc)
Aug 17 15:50:46.240 DEBG Building an output: 1152784313, Commitment(0922bac0c1b6720126b663d54c1af1d8a8d094b16c630ab1d8d079e05efced7d54)
Aug 17 15:50:46.381 DEBG Building an output: 1152784313, Commitment(09ef56c8ef9c448c2a18ed5575fcf26e85ba26aca105f6e86ecf97c493f0d950d5)
Aug 17 15:50:46.520 DEBG Building an output: 1152784313, Commitment(09fb9330fdbd3658b8acb46797ab899e160d56f8760f89cfe92b8772a799700f7e)
Aug 17 15:50:46.660 DEBG Building an output: 1152784313, Commitment(0815ca1d007928cb59cd7a4a95c2984fc3364f8b4e4dfeaf5b630d337433464ad9)
Aug 17 15:50:46.798 DEBG Building an output: 1152784313, Commitment(083138057e6f8a3ec326bc00e672968b427b22df58baabd984019b3d784a532934)
Aug 17 15:50:46.936 DEBG Building an output: 1152784313, Commitment(08c9734b2d142eff08087145e2c6ba16548a77bbf352abe440468c1b314204f77d)
Aug 17 15:50:47.077 DEBG Building an output: 1152784313, Commitment(085f92fbaf4f1d8f9cd82aa18c09dc991266a64ab9006809b7b02e0c2a34c92e17)
Aug 17 15:50:47.217 DEBG Building an output: 1152784313, Commitment(0951fd8168c8fd44e0e9813cb5cad34a37db22fcfa5e6e22ade0f55743089b5064)
Aug 17 15:50:47.356 DEBG Building an output: 1152784313, Commitment(08f3941b456f55f3a9491cfddc79e25d6a6dcf9e9553880ee311ec0f2c0f4517b7)
Aug 17 15:50:47.495 DEBG Building an output: 1152784313, Commitment(09ee3fb40360f173e0086c0d4d9d76d8cebf7f1ce413f706481f7cc0cda8267d83)
Aug 17 15:50:47.633 DEBG Building an output: 1152784313, Commitment(0841dedb34ac5239300c5654f8e7bc040948240d506bc68e41619a9ed73b5025f3)
Aug 17 15:50:47.770 DEBG Building an output: 1152784313, Commitment(09345c4a489d3d67da8edb850578f6910164cf4ed16a9343147c3218b71a4b1ca5)
Aug 17 15:50:47.911 DEBG Building an output: 1152784313, Commitment(089b551684b9c5ca073537dcdce0fb80b4b244c3122781beb1d305e4519fbcf91e)
Aug 17 15:50:48.049 DEBG Building an output: 1152784313, Commitment(0880dde864794266eb3a6ae32120ff65443eb1295ae054313062a5c513e9ea6f11)
Aug 17 15:50:48.193 DEBG Building an output: 1152784313, Commitment(092c6d24c57485afffb13b9cd53090219bf754489e811bfeba871dc57739fec14e)
Aug 17 15:50:48.332 DEBG Building an output: 1152784313, Commitment(09bf6be78e70bc2702eb08daa169e1bec71e4e750f859b063a010c56a2235de3f5)
Aug 17 15:50:48.468 DEBG Building an output: 1152784313, Commitment(08390bf81d76aba4dbdf7286d82fd57037529d0ede1785394002562155d1a75eaa)
Aug 17 15:50:48.611 DEBG Building an output: 1152784313, Commitment(08bacb1bd39aae5cfca95d10ea461742e7d8d004a4e207147018d111f4d208dac2)
Aug 17 15:50:48.750 DEBG Building an output: 1152784313, Commitment(091cb4970dcdc1cc0fdd1feaaad7395bd5c074f6e957fc49618644757be05f3051)
Aug 17 15:50:48.890 DEBG Building an output: 1152784350, Commitment(0950ccb1ac6a7015a52e70cbdcc911a2f2245f2b773032bce2a236b6092f665663)
Aug 17 15:50:48.934 DEBG Posting transaction slate to http://127.0.0.1:13415/v1/wallet/foreign/receive_tx
Aug 17 15:50:49.399 DEBG Validating final transaction
Aug 17 15:50:49.665 INFO Tx created: 1.000000000 grin to http://127.0.0.1:13415 (strategy 'all')
Aug 17 15:50:50.426 INFO Tx sent
Aug 17 15:50:49.921 INFO Pushing transaction with 1 inputs and 52 outputs to pool.
Aug 17 15:50:49.921 DEBG pool: add_to_pool: f3bc9c7f, kernels - 1, stem? false
Aug 17 15:50:50.170 DEBG pool [txpool]: add_to_pool: f3bc9c7f, TxSource { debug_name: "push-api", identifier: "?.?.?.?" }

@antiochp
Copy link
Member Author

You can go pretty wild with this as well, it just takes a while to build the rangeproofs for all the outputs in the tx (~3 mins here for 1,000 outputs and corresponding rangeproofs)...

Aug 17 15:57:18.563 DEBG Refreshing wallet outputs
Aug 17 15:57:19.429 DEBG Building input (spending coinbase): 60000000000, 0aaa9566d7ee848bc4e9
Aug 17 15:57:19.429 DEBG Building change outputs: total change: 54996000000 (1000 outputs)
Aug 17 15:57:20.091 DEBG Building an output: 54996000, Commitment(0950d5ce4704166c8665947f6f37501b4316ebef54f35af841519975a61fe34994)
Aug 17 15:57:20.244 DEBG Building an output: 54996000, Commitment(08a1e05e7ff2b39e4f25e1b7241cc8152817e40e74c86b768c234d79c44bd439e1)
Aug 17 15:57:20.372 DEBG Building an output: 54996000, Commitment(08540a067121e90dcddc45b77d35c088507702ffd17bba34e03e8198bfda9e67f4)
...
Aug 17 16:00:09.783 DEBG Building an output: 54996000, Commitment(08a1a4f197b75deab9eb909a92de512a040ca827565b5e2d0169ffec245e67d67d)
Aug 17 16:00:10.006 DEBG Building an output: 54996000, Commitment(08de1ec4d5a2111a41c3d9f6e34b9390cf0f8b3272fca2ce7a6c887d3106a729cb)
Aug 17 16:00:10.222 DEBG Building an output: 54996000, Commitment(0946c07739a3b387685f709ebd2c71b32319f738467ef12d14b3c6a2451c21fc9f)
Aug 17 16:00:10.410 DEBG Posting transaction slate to http://127.0.0.1:13415/v1/wallet/foreign/receive_tx
Aug 17 16:00:15.365 DEBG Validating final transaction
Aug 17 16:00:20.334 INFO Tx created: 1.000000000 grin to http://127.0.0.1:13415 (strategy 'all')
Aug 17 16:00:34.236 INFO Tx sent
Aug 17 16:00:25.120 INFO Pushing transaction with 1 inputs and 1001 outputs to pool.
Aug 17 16:00:25.121 DEBG pool: add_to_pool: 8edfa463, kernels - 1, stem? false
Aug 17 16:00:29.672 DEBG pool [txpool]: add_to_pool: 8edfa463, TxSource { debug_name: "push-api", identifier: "?.?.?.?" }

@antiochp antiochp merged commit 25e03aa into mimblewimble:master Aug 18, 2018
@antiochp antiochp deleted the change_splitter branch August 18, 2018 21:38
jackrack pushed a commit to jackrack/grin that referenced this pull request Aug 22, 2018
* wip - split change into many outputs for testing

* rustfmt

* add change_outputs param to wallet send
default to 1

* commit

* rustfmt

* cleanup

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

Successfully merging this pull request may close these issues.

None yet

1 participant