What mean 'inputs' for sign?

#1

Hi,

I refer https://github.com/okwme/js-cosmos-wallet/blob/master/test/js-cosmos-wallet.test.ts,
I want to create sign message but I don’t know meaning the inputs column.

const tx = {
    msg: [
      {
        type: `cosmos-sdk/Send`,
        value: {
          inputs: [
            {
              address: `cosmos1qperwt9wrnkg5k9e5gzfgjppzpqhyav5j24d66`,
              coins: [{ denom: `STAKE`, amount: `1` }]
            }
          ],
          outputs: [
            {
              address: `cosmos1yeckxz7tapz34kjwnjxvmxzurerquhtrmxmuxt`,
              coins: [{ denom: `STAKE`, amount: `1` }]
            }
          ]
        }
      }
    ],
    fee: { amount: [{ denom: ``, amount: `0` }], gas: `21906` },
    signatures: null,
    memo: ``
  }
#2

Hey @heesu,

As you can see, inputs and outputs are both arrays, meaning they can store multiple items. You can use this to to multisend, meaning sending from multiple addresses to multiple addresses in one transaction. The items in inputs basically mean from what address are you sending how much. The items in outputs basically mean which address will receive how much in this transaction.

Maybe a little example will help: Let’s say you have one input address that is sending 5stake. You could then have 5 addresses as output items, each receiving 1stake. Does this make sense to you?

Besides that, I believe that your example is outdated. The transaction types have changed in the meantime and denominations are now required to be lowercase.

Best,
Florian from Staking Facilities

#3

@katernoir Thank you very much!!

I understand:

  1. A balance is 300, A -> B 200 :
          inputs: [
            {
              address: `A`,
              coins: [{ denom: `stake`, amount: `200` }]
            }
          ],
          outputs: [
            {
              address: `B`,
              coins: [{ denom: `stake`, amount: `200` }]
            }
          ]
  1. A balance is 300, A -> B 200, A -> C 100 :
          inputs: [
            {
              address: `A`,
              coins: [{ denom: `stake`, amount: `300` }]
            }
          ],
          outputs: [
            {
              address: `B`,
              coins: [{ denom: `stake`, amount: `200` }]
            },
            {
              address: `C`,
              coins: [{ denom: `stake`, amount: `100` }]
            }
          ]

Right??

And, denominations(denom) means name of coin? (like atom…)

#4

That is correct. Denomination is the name of the token, right. Just remember that mainnet uses uatom and not atom, because it is “micro-atoms”.

1 Like