Skip to content

Instantly share code, notes, and snippets.

@rootulp
Created August 11, 2023 21:15
Show Gist options
  • Save rootulp/0d16d76814a6169c38ac0e9cca86cc58 to your computer and use it in GitHub Desktop.
Save rootulp/0d16d76814a6169c38ac0e9cca86cc58 to your computer and use it in GitHub Desktop.
How to submit a blob via Ledger

How to submit a blob via Ledger

This gist contains steps to submit a blob via a Ledger hardware wallet.

Steps

  1. Git clone celestia-app

  2. Install celestia-appd

    make install
  3. In one terminal start a celestia-appd node

    ./scripts/build-run-single-node.sh

    Sample output:

    Home directory: /var/folders/y0/dd92_x8x4tlf397xstgwfz_c0000gn/T/celestia_app_XXXXXXXXXXXXX.KbLWfNrM

    Note the first log line contains a temporary directory.

  4. In a new terminal, export the temporary directory logged in the first terminal.

    export CELESTIA_APP_HOME=/var/folders/y0/dd92_x8x4tlf397xstgwfz_c0000gn/T/celestia_app_XXXXXXXXXXXXX.KbLWfNrM
  5. Export the address of the validator that has tokens.

    export CELESTIA_APP_ADDRESS=$(./build/celestia-appd keys show validator --keyring-backend test --address --home $CELESTIA_APP_HOME)
  6. Plug in your Ledger and unlock it.

  7. Add an alias to your Ledger's address

    celestia-appd keys add ledger-1 --ledger --home $CELESTIA_APP_HOME

    Note this alias exists in the keyring-backend test

  8. Ensure two addresses exist in your keyring-backend

    celestia-appd keys list --home $CELESTIA_APP_HOME

    Sample output:

    - address: celestia1xdc39xr027r78w4eeq6e7e35glgza9ka9rsds2
    name: ledger-1
    pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A+u46124WB1YIjLA+Ufriy5aQzcvdM4bily/Y32INEGV"}'
    type: ledger
    - address: celestia1anmkfa3p5dfe327c2g63jnupegncf5yfad50yn
    name: validator
    pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AuTao0TBcgFUl6mhtH6Bz3/jHUBFy+wsar6X0HamMlT4"}'
    type: local
  9. Export more aliases

    export CELESTIA_VALIDATOR=celestia1anmkfa3p5dfe327c2g63jnupegncf5yfad50yn
    export CELESTIA_LEDGER=celestia1xdc39xr027r78w4eeq6e7e35glgza9ka9rsds2
  10. Send tokens from validator address to Ledger address

    celestia-appd tx bank send --chain-id private --keyring-backend test --home $CELESTIA_APP_HOME --yes $CELESTIA_VALIDATOR $CELESTIA_LEDGER 100000utia --fees 21000utia
  11. Ensure tokens landed in Ledger address

    celestia-appd query bank balances $CELESTIA_LEDGER --home $CELESTIA_APP_HOME

    Sample output:

    balances:
    - amount: "100000"
    denom: utia
    pagination:
    next_key: null
    total: "0"
  12. Submit a PayForBlob from the Ledger address

    export NAMESPACE_ID=01010101010101010101
    export DATA=FF
    celestia-appd tx blob PayForBlobs $NAMESPACE_ID $DATA --from $CELESTIA_LEDGER --keyring-backend test --fees 21000utia --yes --chain-id private

    Sample output:

    Default sign-mode 'direct' not supported by Ledger, using sign-mode 'amino-json'.
    code: 0
    codespace: ""
    data: ""
    events: []
    gas_used: "0"
    gas_wanted: "0"
    height: "0"
    info: ""
    logs: []
    raw_log: '[]'
    timestamp: ""
    tx: null
    txhash: 5A1DB9C4F561B4BA327BD0151A16F16D02CB459F20DF91C5D4609396DAFCA536
  13. Verify the tx succeeded

    celestia-appd query tx 5A1DB9C4F561B4BA327BD0151A16F16D02CB459F20DF91C5D4609396DAFCA536 --home $CELESTIA_APP_HOME

    Sample output:

    code: 0
    codespace: ""
    data: 122A0A282F63656C65737469612E626C6F622E76312E4D7367506179466F72426C6F6273526573706F6E7365
    events:
    - attributes:
    - index: true
        key: c3BlbmRlcg==
        value: Y2VsZXN0aWExeGRjMzl4cjAyN3I3OHc0ZWVxNmU3ZTM1Z2xnemE5a2E5cnNkczI=
    - index: true
        key: YW1vdW50
        value: MjEwMDB1dGlh
    type: coin_spent
    - attributes:
    - index: true
        key: cmVjZWl2ZXI=
        value: Y2VsZXN0aWExN3hwZnZha20yYW1nOTYyeWxzNmY4NHoza2VsbDhjNWxwbmpzM3M=
    - index: true
        key: YW1vdW50
        value: MjEwMDB1dGlh
    type: coin_received
    - attributes:
    - index: true
        key: cmVjaXBpZW50
        value: Y2VsZXN0aWExN3hwZnZha20yYW1nOTYyeWxzNmY4NHoza2VsbDhjNWxwbmpzM3M=
    - index: true
        key: c2VuZGVy
        value: Y2VsZXN0aWExeGRjMzl4cjAyN3I3OHc0ZWVxNmU3ZTM1Z2xnemE5a2E5cnNkczI=
    - index: true
        key: YW1vdW50
        value: MjEwMDB1dGlh
    type: transfer
    - attributes:
    - index: true
        key: c2VuZGVy
        value: Y2VsZXN0aWExeGRjMzl4cjAyN3I3OHc0ZWVxNmU3ZTM1Z2xnemE5a2E5cnNkczI=
    type: message
    - attributes:
    - index: true
        key: ZmVl
        value: MjEwMDB1dGlh
    - index: true
        key: ZmVlX3BheWVy
        value: Y2VsZXN0aWExeGRjMzl4cjAyN3I3OHc0ZWVxNmU3ZTM1Z2xnemE5a2E5cnNkczI=
    type: tx
    - attributes:
    - index: true
        key: YWNjX3NlcQ==
        value: Y2VsZXN0aWExeGRjMzl4cjAyN3I3OHc0ZWVxNmU3ZTM1Z2xnemE5a2E5cnNkczIvMA==
    type: tx
    - attributes:
    - index: true
        key: c2lnbmF0dXJl
        value: ejhJL2VSZzNTaXd3VmZWQXNCbzhON3lYSi9wWjlFUnJZbXpOS3BUVGgzaEJuN2d1a3gzY20zM044V2lLL2x6TkhZU2FFSEk0Zk5kODRIdTNDZ0w2NkE9PQ==
    type: tx
    - attributes:
    - index: true
        key: YWN0aW9u
        value: L2NlbGVzdGlhLmJsb2IudjEuTXNnUGF5Rm9yQmxvYnM=
    type: message
    - attributes:
    - index: true
        key: YmxvYl9zaXplcw==
        value: WzFd
    - index: true
        key: bmFtZXNwYWNlcw==
        value: WyJBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUVCQVFFQkFRRUJBUUU9Il0=
    - index: true
        key: c2lnbmVy
        value: ImNlbGVzdGlhMXZkamtjZXRudzM1a3p2dGN2MzNueHd0Y3dnY3J5ZG1qeHV1OHdkcjl2NGNudmVmaHY1ZW4yZW12dmFheHp3dHR2eXVoeXVteXd2ZXFtYXgzdHQi
    type: celestia.blob.v1.EventPayForBlobs
    gas_used: "77301"
    gas_wanted: "210000"
    height: "98"
    info: ""
    logs:
    - events:
    - attributes:
        - key: blob_sizes
        value: '[1]'
        - key: namespaces
        value: '["AAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAQE="]'
        - key: signer
        value: '"celestia1vdjkcetnw35kzvtcv33nxwtcwgcrydmjxuu8wdr9v4cnvefhv5en2emvvaaxzwttvyuhyumywveqmax3tt"'
        type: celestia.blob.v1.EventPayForBlobs
    - attributes:
        - key: action
        value: /celestia.blob.v1.MsgPayForBlobs
        type: message
    log: ""
    msg_index: 0
    raw_log: '[{"msg_index":0,"events":[{"type":"celestia.blob.v1.EventPayForBlobs","attributes":[{"key":"blob_sizes","value":"[1]"},{"key":"namespaces","value":"[\"AAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAQE=\"]"},{"key":"signer","value":"\"celestia1vdjkcetnw35kzvtcv33nxwtcwgcrydmjxuu8wdr9v4cnvefhv5en2emvvaaxzwttvyuhyumywveqmax3tt\""}]},{"type":"message","attributes":[{"key":"action","value":"/celestia.blob.v1.MsgPayForBlobs"}]}]}]'
    timestamp: "2023-08-11T20:58:56Z"
    tx:
    '@type': /cosmos.tx.v1beta1.Tx
    auth_info:
        fee:
        amount:
        - amount: "21000"
            denom: utia
        gas_limit: "210000"
        granter: ""
        payer: ""
        signer_infos:
        - mode_info:
            single:
            mode: SIGN_MODE_LEGACY_AMINO_JSON
        public_key:
            '@type': /cosmos.crypto.secp256k1.PubKey
            key: A+u46124WB1YIjLA+Ufriy5aQzcvdM4bily/Y32INEGV
        sequence: "0"
        tip: null
    body:
        extension_options: []
        memo: ""
        messages:
        - '@type': /celestia.blob.v1.MsgPayForBlobs
        blob_sizes:
        - 1
        namespaces:
        - AAAAAAAAAAAAAAAAAAAAAAAAAAEBAQEBAQEBAQE=
        share_commitments:
        - YJe/u+9z8S9G43b0b5SXnhPc9JdEyJR7QwGoq0I507c=
        share_versions:
        - 0
        signer: celestia1xdc39xr027r78w4eeq6e7e35glgza9ka9rsds2
        non_critical_extension_options: []
        timeout_height: "0"
    signatures:
    - z8I/eRg3SiwwVfVAsBo8N7yXJ/pZ9ERrYmzNKpTTh3hBn7gukx3cm33N8WiK/lzNHYSaEHI4fNd84Hu3CgL66A==
    txhash: 5A1DB9C4F561B4BA327BD0151A16F16D02CB459F20DF91C5D4609396DAFCA536
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment