Skip to content
Cosmopediaby Unity Nodes
DiscussionsCosmos-SDKWhat mean 'inputs' for sign?Forum ↗

What mean 'inputs' for sign?

Cosmos-SDK4 posts1,328 views1 likesLast activity Mar 2019
HE
heesuOP
Mar 2019

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: ``
  }
KA
katernoir
Mar 2019

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

HE
heesu
Mar 2019

@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…)

KA
katernoir
Mar 2019 1

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”.

← Back to Discussions