CosmWasm / docs-old

Documentation for cosmwasm
https://www.cosmwasm.com/
Creative Commons Attribution Share Alike 4.0 International
2 stars 6 forks source link

Update first-demo.md #9

Closed okwme closed 4 years ago

okwme commented 4 years ago

So cooool

okwme commented 4 years ago

I noticed something weird tho:

> wasmcli query account $(wasmcli keys show thief -a)

{
  "type": "cosmos-sdk/Account",
  "value": {
    "address": "cosmos1el2cc9zgw6jtsr0ny08m4f6seqze6y9gxljgkx",
    "coins": [
      {
        "denom": "stake",
        "amount": "30001"
      }
    ],
    "public_key": "cosmospub1addwnpepqvetsmp4py8d2fp3uczhj3gkmfryxjtg8nw2st3mtrgd6735268y6jzukq0",
    "account_number": 8,
    "sequence": 1
  }
}

Why does the thief have 30001 stake? Previously the contract only had 30000:

wasmcli query account $CONTRACT

{
  "type": "cosmos-sdk/Account",
  "value": {
    "address": "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
    "coins": [
      {
        "denom": "stake",
        "amount": "30000"
      }
    ],
    "public_key": "",
    "account_number": 9,
    "sequence": 0
  }
}

and bob had 20000

 wasmcli query account $(wasmcli keys show bob -a)

{
  "type": "cosmos-sdk/Account",
  "value": {
    "address": "cosmos1d3jhdvg9ccvu9aa2dylp74qr2tywga7a38rwa6",
    "coins": [
      {
        "denom": "stake",
        "amount": "20000"
      }
    ],
    "public_key": "",
    "account_number": 10,
    "sequence": 0
  }
}
ethanfrey commented 4 years ago

In the beginning you give the thief 1 stake, so he can execute the "steal tx". Cosmos SDK doesn't allow accounts to sign messages unless they exist (which means they have a balance, or at least HAD a balance). In production, he would need some minimal amount to pay gas.

I will add a note.

okwme commented 4 years ago

oh jaaaa, now i remember : ) :+1: