The Non Interactive Transaction Usage - gottstech/gotts-wallet GitHub Wiki

Firstly, let's show a raw transaction example here to give a basic idea about what this Non-Interactive Transaction looks like:

A raw transaction data with 1 SingleInput and 2 Outputs (including 1 Change Output and 1 Non-Interactive Output)
{
  "body": {
    "inputs": [
      {
        "SingleInput": {
          "features": "Plain",
          "commit": "0844d8233793b80d5dff0cf8a8e38a18c2b309fbd85feb605a4a525533f112492b"
        }
      }
    ],
    "outputs": [
      {
        "features": {
          "Plain": {
            "spath": "91cabd2459432e4e92eb4b0c3377f0e3728b321674de5ab72e858435"
          }
        },
        "commit": "09fa01597086bb00a883362a6b1529b80e029be8712fd5410fc279c726adc12f76",
        "value": 49112000000
      },
      {
        "features": {
          "SigLocked": {
            "locker": {
              "p2pkh": "d6d86a2a5f4a60c1a299a6189e13202ba15414ed75f8822fa89c76ee5b691d11",
              "pub_nonce": "02a5c2039751bb1c0be24be6d19ece1fe4ed1346e4ced0a204fd62e8b3f813af52",
              "secured_w": -3206831208187819192,
              "relative_lock_height": 1
            }
          }
        },
        "commit": "0824ba3ffd729692af9f4c87b17674cd9ff602e5e2a092a241fe089084afc40c0f",
        "value": 880000000
      }
    ],
    "kernels": [
      {
        "features": {
          "Plain": {
            "fee": 8000000
          }
        },
        "excess": "08124128e5cac5c812b203688fdb662be5d538d6d4c5c9871d87acc1f2a2ef0529",
        "excess_sig": "8426aabc0e7895956e9dbf10d6c809da365a661a6193dc30424c1b31afebbb9760d7538c89677c7511442fb9130f247b8ba0d40c5cbe6a1028a4c94dd8482d93"
      }
    ]
  }
}

Create a Non-Interactive Output

To create such kind of Non-Interactive Transaction, we need know an Address info of the receiver. Use address command to query the wallet address:

$ gotts-wallet --floonet address
1115 10:31:48 INFO - Using wallet configuration file at /Users/garyyu/.gotts/floo/gotts-wallet.toml
1115 10:31:48 INFO - This is Gotts-Wallet version [0.0.2] (git v0.0.2-1-gf9ed9c5), built for x86_64-apple-darwin by rustc 1.38.0 (625451e37 2019-09-23).
1115 10:31:48 INFO - A Wallet instance instantiated
Your current Gotts address for receiving: gs1qqddr0fze0jyms0ax4gz8pkqvv53yxh428hdj3uy0u94t938dayqlhm0fq8aq99vlg4
Command 'address' completed successfully

Then, use the receiver's address as the sending command destination parameter:

$ gotts-wallet --floonet send -d gs1qqddr0fze0jyms0ax4gz8pkqvv53yxh428hdj3uy0u94t938dayqlhm0fq8aq99vlg4 -f 100.0

1115 10:34:57 INFO - Using wallet configuration file at /Users/garyyu/.gotts/floo/gotts-wallet.toml
1115 10:34:57 INFO - This is Gotts-Wallet version [0.0.2] (git v0.0.2-1-gf9ed9c5), built for x86_64-apple-darwin by rustc 1.38.0 (625451e37 2019-09-23).
1115 10:34:57 INFO - A Wallet instance instantiated
1115 10:34:57 INFO - Tx created: 100.000000000 gotts to gs1qqddr0fze0jyms0ax4gz8pkqvv53yxh428hdj3uy0u94t938dayqlhm0fq8aq99vlg4 (strategy 'all')
Command 'send' completed successfully

For the command-line wallet, the receiver has to manually check the chain for querying those Non-Interactive Transaction coins, the command-line wallet can't automatically get those coins into the local wallet database. Here is an example to use the check command:

# Before running the check command

$ gotts-wallet --floonet outputs

1115 10:38:44 INFO - Using wallet configuration file at /Users/garyyu/.gotts/floo/gotts-wallet.toml
1115 10:38:44 INFO - This is Gotts-Wallet version [0.0.2] (git v0.0.2-1-gf9ed9c5), built for x86_64-apple-darwin by rustc 1.38.0 (625451e37 2019-09-23).
1115 10:38:44 INFO - A Wallet instance instantiated

Wallet Outputs - Account 'default' - Block Height: 112
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
 Output Commitment                                                   MMR Index  Block Height  Locked Until  Status   Coinbase?  Change?  # Confirms  Value    Tx 
=================================================================================================================================================================
 086f62624dc8479429e705dbba3144dcae226549ed51ecc56e1c63c451f102a5ac  None       112           0             Unspent  false      true     1           129.105  3 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

total displayed outputs: 1
Command 'outputs' completed successfully
# 'check' command example

$ ./target/release/gotts-wallet --pass 338517 --floonet check
1115 10:40:25 INFO - Using wallet configuration file at /Users/garyyu/.gotts/floo/gotts-wallet.toml
1115 10:40:25 INFO - This is Gotts-Wallet version [0.0.2] (git v0.0.2-1-gf9ed9c5), built for x86_64-apple-darwin by rustc 1.38.0 (625451e37 2019-09-23).
1115 10:40:25 INFO - A Wallet instance instantiated
1115 10:40:25 INFO - Starting wallet check...
1115 10:40:25 INFO - Updating all wallet outputs, please wait ...
1115 10:40:25 INFO - Starting wallet check.
1115 10:40:25 INFO - Checking 73 outputs, up to index 130. (Highest index: 126)
1115 10:40:25 INFO - Plain Output found: Commitment(086f62624dc8479429e705dbba3144dcae226549ed51ecc56e1c63c451f102a5ac), amount: 129105000000, key_id: Identifier(0300000000000000000000000400000000), mmr_index: 245,
1115 10:40:25 INFO - Checking 3 outputs, up to index 130. (Highest index: 130)
1115 10:40:25 INFO - SigLocked Output found: Commitment(09d3aee1dd7f6d2742e7e15c8ca6f0b486735e347520fb48f689edd7a5943c1d23), amount: 100000000000, key_id: Identifier(04ffffffffffffffff0000000000000001), mmr_index: 5,
1115 10:40:25 INFO - collect_chain_outputs: 2 utxo outputs identified
1115 10:40:25 INFO - Identified 2 wallet_outputs as belonging to this wallet
1115 10:40:25 WARN - Confirmed output for 100000000000 with Identifier(04ffffffffffffffff0000000000000001) Commitment(09d3aee1dd7f6d2742e7e15c8ca6f0b486735e347520fb48f689edd7a5943c1d23) exists in UTXO set but not in wallet. Restoring.
1115 10:40:25 INFO - Repaired wallet in 0m0s
1115 10:40:25 INFO - Wallet check complete
Command 'check' completed successfully
# After 'check'

$ gotts-wallet --floonet outputs
1115 10:41:28 INFO - Using wallet configuration file at /Users/garyyu/.gotts/floo/gotts-wallet.toml
1115 10:41:28 INFO - This is Gotts-Wallet version [0.0.2] (git v0.0.2-1-gf9ed9c5), built for x86_64-apple-darwin by rustc 1.38.0 (625451e37 2019-09-23).
1115 10:41:28 INFO - A Wallet instance instantiated

Wallet Outputs - Account 'default' - Block Height: 112
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
 Output Commitment                                                   MMR Index  Block Height  Locked Until  Status   Coinbase?  Change?  # Confirms  Value    Tx 
=================================================================================================================================================================
 08f187c21f5336e784d2ea93297ce95c123585d46d4adf9e9515c883ab4220e967  5          112           112           Unspent  false               1           100.0    0 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
 086f62624dc8479429e705dbba3144dcae226549ed51ecc56e1c63c451f102a5ac  None       112           0             Unspent  false      true     1           129.105  3 
-----------------------------------------------------------------------------------------------------------------------------------------------------------------

total displayed outputs: 2
Command 'outputs' completed successfully

Spend a Non-Interactive Output

Suppose we have a Non-Interactive Output 098c206a346d829a8e46f55bb6cfd3fc404bc322952cd9a853b800e0c3951088df:

$ curl -0 -XGET -u gotts:`cat ~/.gotts/floo/.api_secret`  http://127.0.0.1:13513/v1/chain/outputs/byids?id=098c206a346d829a8e46f55bb6cfd3fc404c322952cd9a853b800e0c3951088df
[
  {
    "output": {
      "features": {
        "SigLocked": {
          "locker": {
            "p2pkh": "ab9926027c6c037c9629b5b78b647ab8fd43a6aeef76d1d16716c7d445a1e92f",
            "pub_nonce": "02cd86fef6f5dc9781dbc119f992ae273a060625e8c589a65cfc52ebc3c6425333",
            "secured_w": -85552299586497779,
            "relative_lock_height": 1
          }
        }
      },
      "commit": "098c206a346d829a8e46f55bb6cfd3fc404bc322952cd9a853b800e0c3951088df",
      "value": 3000000000000
    },
    "height": 182,
    "mmr_index": 5
  }
]

To spend it (with an Interactive Transaction):

$ gotts-wallet --floonet send -d http://xx.xx.xx.xx:13515 300.00 -f
1121 09:42:18 INFO - Using wallet configuration file at /Users/garyyu/.gotts/floo/gotts-wallet.toml
1121 09:42:18 INFO - This is Gotts-Wallet version [0.0.2] (git v0.0.2-2-gd6e7a71), built for x86_64-apple-darwin by rustc 1.39.0 (4560ea788 2019-11-04).
1121 09:42:18 INFO - A Wallet instance instantiated
1121 09:42:18 INFO - Tx created: 300.000000000 gotts to http://xx.xx.xx.xx:13515 (strategy 'all')
1121 09:42:18 INFO - Tx sent ok
Command 'send' completed successfully

The raw transaction data:

{
  "body": {
    "inputs": [
      {
        "SingleInput": {
          "features": "Plain",
          "commit": "0870edd4139427fb3f2fe1901dc820dda59431aa9cf642ba01703468a1b8498117"
        }
      },
      {
        "InputsWithUnlocker": {
          "inputs": [
            {
              "features": "SigLocked",
              "commit": "098c206a346d829a8e46f55bb6cfd3fc404bc322952cd9a853b800e0c3951088df"
            }
          ],
          "unlocker": {
            "timestamp": "2019-11-21T01:42:18Z",
            "sig": "de5f51170d2bd2bafa6f6223a13aa42ceb8e0b9a4296ee026732cf533670360b3557d8b6585b21fd7abf6552db6b0f0bd9dcf1f116760741acbd707aeaee19bb",
            "pub_key": "035a37a4597c89b83fa6aa0470d80c6522435eaa3ddb28f08fe16ab2c4ede901fb"
          }
        }
      }
    ],
    "outputs": [
      {
        "features": {
          "Plain": {
            "spath": "df0d61967960ec6dd48098972d7f2bba0e2f8f4d4b897d75cb98d717"
          }
        },
        "commit": "08833ad405d60d1b38584360858f3f2cbef2f469f8640abaa25be25cd4e46256e6",
        "value": 3759981000000
      },
      {
        "features": {
          "Plain": {
            "spath": "01ee5e4641a2e5947792bb4449887fc878ad90746d231e35f114db27"
          }
        },
        "commit": "091029823356c684ef3d6c3a40475f51187270aaea7bd425a83b746bb990dc486d",
        "value": 300000000000
      }
    ],
    "kernels": [
      {
        "features": {
          "Plain": {
            "fee": 7000000
          }
        },
        "excess": "09f3435cfa72d337a32cac8cc1e5de880cedccbf642e786b5d1d51317fde37d840",
        "excess_sig": "9b6d50176605c982415bf2d690fed8b044803d40df4ecba6c0f57b53b57b554c11c28404a8ccc0ff1fb2eb78c876da3246d00f85758bd8ed0b9866124707c60e"
      }
    ]
  }
}
⚠️ **GitHub.com Fallback** ⚠️