Skip to content

Latest commit

 

History

History
109 lines (92 loc) · 15 KB

getting_started.md

File metadata and controls

109 lines (92 loc) · 15 KB

Getting started with sending and receiving

This documentation showcases how to interact with the Nemean wallet in a development environment. Do not use these steps in production.

To get started with sending and receiving value on Aleo. You will need to run a local SnarkOS node daemon. This can be done by following the instructions found in the repo or by using the provided docker-compose.yml found in this project.

First, create a new Aleo account that will be the owner of coinbase records.

$ nemean create
{"PrivateKey":"APrivateKey1zkp2QrQaL1miLcM5oWShjKCUYoXHoiEZn6Y9XrUDEpQhGGs","ViewKey":"AViewKey1nNE7ZmaY3gsynD8WfDGcVHpxHYmwtfzPFWKymQjuwHTm","Address":"aleo1qnj20ajacfwf5wfs7h48zvr6gfudj92gs0ehr2z4ev24thcugyys0xegj4"}

You will see a new Aleo account address prefixed with aleo1. Start your SnarkOS node with the miner flag set to the address.

$ snarkos  --rpc 3035 --miner aleo1qnj20ajacfwf5wfs7h48zvr6gfudj92gs0ehr2z4ev24thcugyys0xegj4

After a few minutes, you will notice the blockheight increment.

$ nemean -rpc=127.0.0.1:3035 latestblockheight
155
$ nemean -rpc=127.0.0.1:3035 getblock --height=155 | jq 
{
  "block_hash": "ab1p40kjm5lva9h6arq695k5ng7c6dj7eu76qjch72ta4c23afkzq8qte2fj0",
  "previous_block_hash": "ab10yr8c9f6ujutvfm4ezk2ga5xz7f9w583t4wfyyhxvsahngpe65ysfe3uut",
  "transactions": {
    "transactions": [
      {
        "transaction_id": "at1knlnsyzxqrqwuxhe7ptp7sjumt3fvj3fkjgaelnslc8r9qj555zs8smdyn",
        "ledger_root": "al1enk2kwh9nuzcj2q9kdutekavlf8ayjqcuszgezsfax8qxn9k0yxqfr9fr2",
        "inner_circuit_id": "ic14z3rtzc25jgjxs6tzat3wtsrf5gees5zel8tggsslzrfyzhxw4xsgdfe4qk6997427zsfl9tqqesq5fzw5q",
        "transitions": [
          {
            "ciphertext_ids": [
              "ar1v8efwj54g8jp66dt98hhztsrg3vh0c8klx8rprvtlu022d5nkqgqquq0xy",
              "ar1udn776t7d0wsj5rce39dn9jdyyr63h2x6r0mch5w00kfdt3fxvgsylhm09"
            ],
            "ciphertexts": [
              "7e404cc875851b1c1b9de886767bc4f773fe8d6a13461d27f7da9b8b71907f04a38c16650c9d68a987a05727a3468f429fbff9032e20a467ec5e397d500e9806ccf66ac69f7ea6400fc3f932cc9abd86c75add6bdf5547f0a1e23b93b4ddf50bd285150f14abb2b3b3207c5d61975c1a66b4afa059a6d1ad49c476be39ef40129b13a0b2447bd835275b46e912c6428767fb10bb7d32155069e20e9162ff3c089d38bb0cafe2b727ec0dc92f1231392f412f8999fcbd927d5dd601703b49cf0ab7c483804a294be29a796b1a0cf6210a387cc5aabbe68884ccdcc3a5a6fa9b00b95ef09d1df62c89451792be91506041e64a22c0554c6d85fa4972be10c7870e24080e4489c67ee09e8789895ee39cfb80d95eecede36b394d9d225289d17a0bfdf9aeba41b4e15a38bc65330090ddd675b9ca14ae8b6a49c9d1a412e32e3409",
              "bc1c4ec09cfda8b3b47a7f498aa50fbfdd191e4d658f1578bb5280d80f7fb9065ae2eacba9dcfbbba33a959e9df59b894628b6be2eaf207dfdf5099520936807b66e374126a7403104723f00328e0da4369fdea5721433ad49360ba7812b8004bcc192b253fa62d07ea4069a4fa04488583cea6633d4bccdeafa1d5f9f49a9115830b5f5de80ffb77d347788839120fa76995ff007a7b283563d60ef62357300d1d1c4c50878db85e9a0bfd457046b8258a9a828687b3d5fbf7ebd9b6cbf8e00fecfcb22f94573d9471e904c1a605d36506081fcd4570662d83bcf74437c190849ae78e37a9aef87b1d4419b99b5301a15a71fff5066be5bc497af059c58a408b1a5c07763f993e677d51d0c21c4c39d56f007773a6a56059c12bc13909e9f08b4cbcbf5bc2970db01a8844494d162e4cec22078e0369c8e2a16106fcae27c11"
            ],
            "commitments": [
              "cm18vjq7jcp3mytqdtk4rxwnvfv9d23ln6ewm4t4gg5eqwf5q7xkgrsqfd3vg",
              "cm1f7akwpwfmfgawl4y5xhmpq5f3ktrklgana3j37pc6ftnmnq4vc8q6u0fd4"
            ],
            "proof": "ozkp1984mpvk20vv89rglyypgh2vnvuljs27xyh8nmkztewe5zhrng2kk6e2nwz7hng4ne7n36xklmlrpf3zrnldz84t9hhc7pe4nge3z6z6ees9pj5w4dt5pgskffezq2pqq2uv76nwyx3pkwalzc8mvqeueqp4dcq9w9syl3gmz7aaewrg3gg5nx7yr4srns8284gatp5q95gmwdnmj7c5uceau6f22n0228wxhlq090xxh4s2z4qhr40s6kvdydjc435kga0cnajnpaetye9d7e37x25znjj7y79fy3kemh28c6yvn6xqrr4wzekj5dvqlwa0mjjuzqqjzxaawglyakesecd0xyzec73qr6kpt57tyhdlzrzf5y0s2mzgexue2p28y82n4tgzhdsmfsse9alspvgy7e2vnz2p88aaf7ne3eumzt5wlnfnxwqr8taawlx3cvdrnt6ggqqg7pvpd2",
            "serial_numbers": [
              "sn1c9lz0g7nkhlsx5gtlj09d72sged0u334p6v49r5cpkkaqllvxursacerz2",
              "sn1em9lycttd5gz2zvuuakxxjpwg8dvqcctsyh99z96s6jhnvp0qvrqdumgpu"
            ],
            "transition_id": "as1tmffmpwmh53dvycwyhlx6qudmta4znhrc5fxmpyyc0njnfp3xvps339tjm",
            "value_balance": -150000000
          }
        ]
      }
    ]
  },
  "header": {
    "previous_ledger_root": "al1a6stxmq34dv6khmemf9yt7t9dphr7vp5dltnj0sj5m94rp5u9gxsc5eekt",
    "transactions_root": "ht1g9dc8e9fzpgk7sldlkt65adr95nvq40exee0ext79dym8vdtq59sp0kgxx",
    "string": "",
    "metadata": {
      "difficulty_target": 18446744073709552000,
      "height": 155,
      "nonce": "2681127824183644771725041926158243924323872634645974541565980169303937149358",
      "timestamp": 1637640201
    }
  }
}

To spend the transaction record, let's first decode the record using our view key and the ciphertext found in the transaction.

$ nemean decrypt_record --ciphertext="7e404cc875851b1c1b9de886767bc4f773fe8d6a13461d27f7da9b8b71907f04a38c16650c9d68a987a05727a3468f429fbff9032e20a467ec5e397d500e9806ccf66ac69f7ea6400fc3f932cc9abd86c75add6bdf5547f0a1e23b93b4ddf50bd285150f14abb2b3b3207c5d61975c1a66b4afa059a6d1ad49c476be39ef40129b13a0b2447bd835275b46e912c6428767fb10bb7d32155069e20e9162ff3c089d38bb0cafe2b727ec0dc92f1231392f412f8999fcbd927d5dd601703b49cf0ab7c483804a294be29a796b1a0cf6210a387cc5aabbe68884ccdcc3a5a6fa9b00b95ef09d1df62c89451792be91506041e64a22c0554c6d85fa4972be10c7870e24080e4489c67ee09e8789895ee39cfb80d95eecede36b394d9d225289d17a0bfdf9aeba41b4e15a38bc65330090ddd675b9ca14ae8b6a49c9d1a412e32e3409" --viewkey="AViewKey1nNE7ZmaY3gsynD8WfDGcVHpxHYmwtfzPFWKymQjuwHTm" | jq tostring
"{\"owner\":\"aleo1qnj20ajacfwf5wfs7h48zvr6gfudj92gs0ehr2z4ev24thcugyys0xegj4\",\"value\":150000000,\"payload\":\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\",\"program_id\":\"ap108dg24pwmezwu7hd9gt0dhrp759stge4sq4jecsg066usnclepfnhwn9a0xl5zv5spt7vvgwfqfsqt3dlw4\",\"serial_number_nonce\":\"sn1c9lz0g7nkhlsx5gtlj09d72sged0u334p6v49r5cpkkaqllvxursacerz2\",\"commitment_randomness\":\"cr1jq0cy4e56v0ch5snvzj5qqa3fga0cmk9tlgewnge5y728zxleuqssvgtex\"}"
$ export RECORD=7e404cc875851b1c1b9de886767bc4f773fe8d6a13461d27f7da9b8b71907f04a38c16650c9d68a987a05727a3468f429fbff9032e20a467ec5e397d500e9806ccf66ac69f7ea6400fc3f932cc9abd86c75add6bdf5547f0a1e23b93b4ddf50bd285150f14abb2b3b3207c5d61975c1a66b4afa059a6d1ad49c476be39ef40129b13a0b2447bd835275b46e912c6428767fb10bb7d32155069e20e9162ff3c089d38bb0cafe2b727ec0dc92f1231392f412f8999fcbd927d5dd601703b49cf0ab7c483804a294be29a796b1a0cf6210a387cc5aabbe68884ccdcc3a5a6fa9b00b95ef09d1df62c89451792be91506041e64a22c0554c6d85fa4972be10c7870e24080e4489c67ee09e8789895ee39cfb80d95eecede36b394d9d225289d17a0bfdf9aeba41b4e15a38bc65330090ddd675b9ca14ae8b6a49c9d1a412e32e3409

Get the ledger proofs.

$ export PROOF1=$(nemean --rpc=127.0.0.1:3035  getledgerproof --commitment=cm18vjq7jcp3mytqdtk4rxwnvfv9d23ln6ewm4t4gg5eqwf5q7xkgrsqfd3vg)
$ export PROOF2=$(nemean --rpc=127.0.0.1:3035  getledgerproof --commitment=cm1f7akwpwfmfgawl4y5xhmpq5f3ktrklgana3j37pc6ftnmnq4vc8q6u0fd4)

Create a transaction.

$ nemean send --to="aleo1sq7y28j7gld64w770d2xk50xyqu7ymndc5f7szkmgdujx0rhsqzsztk4nd" --ledger_proof=$PROOF1 --amount=149000000 --fee=1000000 --private_key="APrivateKey1zkp2QrQaL1miLcM5oWShjKCUYoXHoiEZn6Y9XrUDEpQhGGs" --record=$RECORD --ledger_proof=$PROOF2
a8a2358b0aa49123434b1757172e034d119cc282cfceb42210f886920ae6754d043539a82da297d5578504fcab00330074b29e65a6c941eb642a0c0a58aa40fd1b0bd8b4547f7b208e360fe088d1b60901005b6970fce912cd7c5cbe53cd7a74eb2379c6e495f031fc95a4ac70d20d770504a46a9afcc132af6edffa4bb3ee80da936eeb432d0c7a789f0d33156585e4fc01eabc12c3eb5347f1f78a560b9a84f47fa890b9b1e7d07f896c3d9288c795bf0ab2dc6565f59941a7ce4b951d1714e73a74c8a9bf94bdefed398188473bf2781062805f969e27bacc15dc88d572a94a324893809fdda9911dcf82675e9db32011850856350acf4dd6aa19bfcac4f146808046c66aadbf1bd433f77a58e000980f60bd0b7981dddc20c37717e9f830c89ee9eca669ed513b811b6ee1eb36399d0664b2879f1ab26244ddfe51aacc990d2de195a140baf392e7b33cc670056b350fe8f52e971368a56f7020394f223daa7467eb34ea7063a5b47fcdac99fc9efd0bf274c904d2251af9308f4aa555272c9691a1b770e8dc593d2c593ef23a958503d6dd9cece9577c7adb9b40b1d8c8c596b468bdec711e3318a884f49b8fbfbe0ccb92a4350172b7b05a453e2e5c269f8a4efebc20f5696cb7e5c9d99eb71f031068fcfb057dddc336dc9014871a13d93ba0f4ec636a5facf2b1fa4d7dbb9046094ef7e3a4122512826bc9226d000a90b3048da23dbc2d9fe486d68f5bbe76cd0d0d80c60a11fdb7e57fd80f603d623863fc1ec44d4758792e667093ad508dad044a15b8c3dbf092a7c588282243c3ad411cee1f6e799c0ed4f2efc77d099711088e2152af75c8f11e40ec2988989666c2c8a8ac197c7a27940c7bac2fd7f55a11f4b752b71c40e31acabbb8feb6ec9156d2eea1d5c5a0751c4b0d543700cb1601acce9e530798e4670f173e8beb6612a17313e137aee5c7c4d40f82d99a782f090d8ef2b8b017c1953a9bda74251fd847ec479b70886c0886122d052c2e227a12f0060dfeb55f336158c289df991ab3295d46db87d1657b88d3bc083c7872620126027b791dfe52c3c9202573560cfc954871c5f639630b4f6508ebca17d6e30ca7c40d19e5cf13949fed7c59d7b6fcdea5afef3d0bef312d54caefade2a3cb10bb284cc522e3b76fd56589f02c1e44fb69584305069a3f50aa516758da01701040420f0000000000950c476fd6d1a62bbb1bb014409a48f55e50ed97ccce27cfc010dd485434d383bf5a11544e955ecd5bf1a4c7fd4d249ccf9179fd4e0daad0e84fe55a4e3d091a7065a94b25fc328b0908cefc166a40d7e75adebdbab85154159ace4cc4ccfe00835d481947d8d0c69041c8f3262818d4fb6bac2512ddeab7261b5acd3fbac3545787614edf2107f575eedb55cc9be7a1aac4fe6584163cb12a3396ffe3b502dfd5fa8e2e5ff261f974651a8019f45f81256cb92cc05a5cb5e8fe6b9d2e36db801b2cd7f56412dcaec70a9fb638de9b14d058cece9e4e041cccc118afaa89362e4f0cdadefb9ca2fe3bdcf9f455390a735150a0bb57415e7a30cf3f1e578161e29b9cd2e371eaef2c753ab316d081abc043b02d07144cb045ded36b6999a95d00010000

Broadcast the transaction.

nemean --rpc=127.0.0.1:3035  send_transaction -txn=a8a2358b0aa49123434b1757172e034d119cc282cfceb42210f886920ae6754d043539a82da297d5578504fcab00330074b29e65a6c941eb642a0c0a58aa40fd1b0bd8b4547f7b208e360fe088d1b60901005b6970fce912cd7c5cbe53cd7a74eb2379c6e495f031fc95a4ac70d20d770504a46a9afcc132af6edffa4bb3ee80da936eeb432d0c7a789f0d33156585e4fc01eabc12c3eb5347f1f78a560b9a84f47fa890b9b1e7d07f896c3d9288c795bf0ab2dc6565f59941a7ce4b951d1714e73a74c8a9bf94bdefed398188473bf2781062805f969e27bacc15dc88d572a94a324893809fdda9911dcf82675e9db32011850856350acf4dd6aa19bfcac4f146808046c66aadbf1bd433f77a58e000980f60bd0b7981dddc20c37717e9f830c89ee9eca669ed513b811b6ee1eb36399d0664b2879f1ab26244ddfe51aacc990d2de195a140baf392e7b33cc670056b350fe8f52e971368a56f7020394f223daa7467eb34ea7063a5b47fcdac99fc9efd0bf274c904d2251af9308f4aa555272c9691a1b770e8dc593d2c593ef23a958503d6dd9cece9577c7adb9b40b1d8c8c596b468bdec711e3318a884f49b8fbfbe0ccb92a4350172b7b05a453e2e5c269f8a4efebc20f5696cb7e5c9d99eb71f031068fcfb057dddc336dc9014871a13d93ba0f4ec636a5facf2b1fa4d7dbb9046094ef7e3a4122512826bc9226d000a90b3048da23dbc2d9fe486d68f5bbe76cd0d0d80c60a11fdb7e57fd80f603d623863fc1ec44d4758792e667093ad508dad044a15b8c3dbf092a7c588282243c3ad411cee1f6e799c0ed4f2efc77d099711088e2152af75c8f11e40ec2988989666c2c8a8ac197c7a27940c7bac2fd7f55a11f4b752b71c40e31acabbb8feb6ec9156d2eea1d5c5a0751c4b0d543700cb1601acce9e530798e4670f173e8beb6612a17313e137aee5c7c4d40f82d99a782f090d8ef2b8b017c1953a9bda74251fd847ec479b70886c0886122d052c2e227a12f0060dfeb55f336158c289df991ab3295d46db87d1657b88d3bc083c7872620126027b791dfe52c3c9202573560cfc954871c5f639630b4f6508ebca17d6e30ca7c40d19e5cf13949fed7c59d7b6fcdea5afef3d0bef312d54caefade2a3cb10bb284cc522e3b76fd56589f02c1e44fb69584305069a3f50aa516758da01701040420f0000000000950c476fd6d1a62bbb1bb014409a48f55e50ed97ccce27cfc010dd485434d383bf5a11544e955ecd5bf1a4c7fd4d249ccf9179fd4e0daad0e84fe55a4e3d091a7065a94b25fc328b0908cefc166a40d7e75adebdbab85154159ace4cc4ccfe00835d481947d8d0c69041c8f3262818d4fb6bac2512ddeab7261b5acd3fbac3545787614edf2107f575eedb55cc9be7a1aac4fe6584163cb12a3396ffe3b502dfd5fa8e2e5ff261f974651a8019f45f81256cb92cc05a5cb5e8fe6b9d2e36db801b2cd7f56412dcaec70a9fb638de9b14d058cece9e4e041cccc118afaa89362e4f0cdadefb9ca2fe3bdcf9f455390a735150a0bb57415e7a30cf3f1e578161e29b9cd2e371eaef2c753ab316d081abc043b02d07144cb045ded36b6999a95d00010000
at1s8xaeuw706ruzc56v2nfum6l9ahwmruxp9ppjeqm93sr7phv6ursmsm9s3

Check for block inclusion.

nemean --rpc=127.0.0.1:3035  get_transaction --id=at1s8xaeuw706ruzc56v2nfum6l9ahwmruxp9ppjeqm93sr7phv6ursmsm9s3
{"transaction":{"transaction_id":"at1s8xaeuw706ruzc56v2nfum6l9ahwmruxp9ppjeqm93sr7phv6ursmsm9s3","ledger_root":"al1wjefuedxe9q7kep2ps9932jql5dshk9523lhkgywxc87pzx3kcysuz0439","inner_circuit_id":"ic14z3rtzc25jgjxs6tzat3wtsrf5gees5zel8tggsslzrfyzhxw4xsgdfe4qk6997427zsfl9tqqesq5fzw5q","transitions":[{"ciphertext_ids":["ar10uy00r2jneuqqkkfulgmchdrrv360sv4tsr7sv5h68j32g7p5gqqg5j6a0","ar1t4xmpy68yktxr2fegnlfqsyf254ymw8ec0lyt7hxffgkf4u655rs3ms2gd"],"ciphertexts":["62805f969e27bacc15dc88d572a94a324893809fdda9911dcf82675e9db32011850856350acf4dd6aa19bfcac4f146808046c66aadbf1bd433f77a58e000980f60bd0b7981dddc20c37717e9f830c89ee9eca669ed513b811b6ee1eb36399d0664b2879f1ab26244ddfe51aacc990d2de195a140baf392e7b33cc670056b350fe8f52e971368a56f7020394f223daa7467eb34ea7063a5b47fcdac99fc9efd0bf274c904d2251af9308f4aa555272c9691a1b770e8dc593d2c593ef23a958503d6dd9cece9577c7adb9b40b1d8c8c596b468bdec711e3318a884f49b8fbfbe0ccb92a4350172b7b05a453e2e5c269f8a4efebc20f5696cb7e5c9d99eb71f031068fcfb057dddc336dc9014871a13d93ba0f4ec636a5facf2b1fa4d7dbb9046094ef7e3a4122512826bc9226d000a90b3048da23dbc2d9fe486d68f5bbe76cd0d","0d80c60a11fdb7e57fd80f603d623863fc1ec44d4758792e667093ad508dad044a15b8c3dbf092a7c588282243c3ad411cee1f6e799c0ed4f2efc77d099711088e2152af75c8f11e40ec2988989666c2c8a8ac197c7a27940c7bac2fd7f55a11f4b752b71c40e31acabbb8feb6ec9156d2eea1d5c5a0751c4b0d543700cb1601acce9e530798e4670f173e8beb6612a17313e137aee5c7c4d40f82d99a782f090d8ef2b8b017c1953a9bda74251fd847ec479b70886c0886122d052c2e227a12f0060dfeb55f336158c289df991ab3295d46db87d1657b88d3bc083c7872620126027b791dfe52c3c9202573560cfc954871c5f639630b4f6508ebca17d6e30ca7c40d19e5cf13949fed7c59d7b6fcdea5afef3d0bef312d54caefade2a3cb10bb284cc522e3b76fd56589f02c1e44fb69584305069a3f50aa516758da017010"],"commitments":["cm1a27p9slt2drlrau22c9e4p85075fpwd3ulg8lztv8kfg33u4hu9qtt282d","cm1ktwx2e04n9q60njtj5w3w9888f6v32dljj77lmfesxyywwlj0qgq74v656"],"proof":"ozkp1j5xywm7k6xnzhwcmkq2ypxjg7409pmvhen8z0n7qzrw5s4p56wpm7ks3238f2hkdt0c6f3laf5jfenu30875urd26r5yle26fc7sjxnsvk55kf0ux29sjzxwlstx5sxhuadda0d6hpg4g9v6eexvfn87qzp46jqeglvdp35sg8y0xf3grr20k6avy5fdm64hycd44nflhtp4g4u8v98d7gg87467ak64ejd70gd2cnlxtpqk8jcj5vukll3m2qkl6hagutjl7fsljar9r2qpnazlsyjkewfvcpd9ed0gle4e6t3kmwqpktxh74jp9h9wcu9fld3cm6d3f5zcem8funsyrnxvzx9042ynvtj0pndda7uu5tlrhh8e732njznn29g2pw6hg9085vx08u090qtpu2dee5hrw84w7tr482e3d5yp40qy8vpdqu2yevz9mmfkk6ve49wsqqgj45z2u","serial_numbers":["sn1td5hpl8fztxhch9720xh5a8tyduudey47qcle9dy43cdyrthq5zqqjyg35","sn1534f4lxpx2hkahl6fwe7aqx6jdhwksedp3a838cdxv2ktp0ylsqsnspkk8"],"transition_id":"as1lte63rhyl2lf80u2fg72v2ew0v5qehj8wwssgw0zvaa3kkn8lv8q9g4w4d","value_balance":1000000}]},"metadata":{"block_hash":"ab13m78v9qf8kzauda4t2wh32z5yrmh9pe3yua6n4w6kt8qj3c3vszqqqywa0","block_height":176,"block_timestamp":1637790147,"transaction_index":1}}

You will notice a block_height. Congrats! We just spent a coinbase record in a new transaction.