UTXO transaction based model in multichain

+2 votes
Hello guys,
I was exploring UTXO model in multichain so i have issued 1000 assets to address 1Xs5ZRKETcsATQp4AgZPodfco14Amcx4FvYoc1 and after that i have send 100 assets to 19Ga6X4QY6TYgsXJQKJWDrThNJ7SvuwHYNNTCS so according to that i could identify UTXO transaction based on spendable property .(see below unspent command )
Now in this transaction spendable property is false for sender that means that was a unspent transaction input for sender(1Xs5ZRKETcsATQp4AgZPodfco14Amcx4FvYoc1) and sender has locked that tx and send it to reciever (19Ga6X4QY6TYgsXJQKJWDrThNJ7SvuwHYNNTCS) for receiver that tx is unspent tx output (UTXO), am i right?
2)what is inside scriptPubKey for sender(1Xs5ZRKETcsATQp4AgZPodfco14Amcx4FvYoc1)?
3)what is inside scriptPubKey for receiver(19Ga6X4QY6TYgsXJQKJWDrThNJ7SvuwHYNNTCS)?
4)where could i find UTXO db?
5)how can i see unspent transaction input for each address?
 

chain1: listunspent
{"method":"listunspent","params":[],"id":1,"chain_name":"chain1"}

[
    {
        "txid" : "04b5ca711bc525f23cec29fff18b8fa01583ec8ae4e9e8ff5ba5dd2071739bf3",
        "vout" : 0,
        "address" : "19Ga6X4QY6TYgsXJQKJWDrThNJ7SvuwHYNNTCS",
        "account" : "",
        "scriptPubKey" : "76a9143d2d7e8db672718c20365ba06eee65f7b1e408f988ac1473706b700400000000000000ffffffff66ee355c75",
        "amount" : 0.00000000,
        "confirmations" : 10,
        "cansend" : false,
        "spendable" : false,
        "assets" : [
        ],
        "permissions" : [
            {
                "for" : null,
                "connect" : false,
                "send" : false,
                "receive" : true,
                "create" : false,
                "issue" : false,
                "mine" : false,
                "admin" : false,
                "activate" : false,
                "startblock" : 0,
                "endblock" : 4294967295,
                "timestamp" : 1547038310
            }
        ]
    },
    {
        "txid" : "04b5ca711bc525f23cec29fff18b8fa01583ec8ae4e9e8ff5ba5dd2071739bf3",
        "vout" : 1,
        "address" : "1Xs5ZRKETcsATQp4AgZPodfco14Amcx4FvYoc1",
        "account" : "",
        "scriptPubKey" : "76a914e45b2ee7f8b041a657980786c23ac4692f509b2788ac",
        "amount" : 0.00000000,
        "confirmations" : 10,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
        ],
        "permissions" : [
        ]
    },
    {
        "txid" : "e739464ab3c29aae1a73a1e5f8c8830d3759aa3089a077463734102adccb227d",
        "vout" : 0,
        "address" : "19Ga6X4QY6TYgsXJQKJWDrThNJ7SvuwHYNNTCS",
        "account" : "",
        "scriptPubKey" : "76a9143d2d7e8db672718c20365ba06eee65f7b1e408f988ac1c73706b7153e8925805934a0da47f950b01816389102700000000000075",
        "amount" : 0.00000000,
        "confirmations" : 10,
        "cansend" : false,
        "spendable" : false,
        "assets" : [
            {
                "name" : "asset1",
                "assetref" : "25-265-25481",
                "qty" : 100.00000000
            }
        ],
        "permissions" : [
        ]
    },
    {
        "txid" : "e739464ab3c29aae1a73a1e5f8c8830d3759aa3089a077463734102adccb227d",
        "vout" : 1,
        "address" : "1Xs5ZRKETcsATQp4AgZPodfco14Amcx4FvYoc1",
        "account" : "",
        "scriptPubKey" : "76a914e45b2ee7f8b041a657980786c23ac4692f509b2788ac1c73706b7153e8925805934a0da47f950b01816389905f01000000000075",
        "amount" : 0.00000000,
        "confirmations" : 10,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
            {
                "name" : "asset1",
                "assetref" : "25-265-25481",
                "qty" : 900.00000000
            }
        ],
        "permissions" : [
        ]
    }
]

6)As per my understanding of bitcoin in that when sender sends any asset to receipient then that transaction gets locked and send to receipient.
But here when i run lockunspent it is giving me output like this:

how to see all locked transaction which was initiated by sender?

chain1: listlockunspent
{"method":"listlockunspent","params":[],"id":1,"chain_name":"chain1"}

[
]

7) How can i identify sender does not trying to do double spend of particular asset?
 
Thanks,
Khetesh Rotangan
asked Jan 9, 2019 by kheteshrotangan

1 Answer

0 votes

There are a lot of questions here so let me focus on the core ones.

The UTXO database can be queried for specific outputs using the gettxout API. There is no API access for listing all the UTXOs in the database currently.

If a node is tracking an address, you can see all the UTXOs for that address by passing that address in the third parameter to the listunspent command.

"Locking" is not about spent transactions – it's about the node internally labeling certain UTXOs as not to be spent unless explicitly named in parameters to commands like createrawexchange or createrawtransaction. These UTXOs won't "selected for spending by APIs like sendfrom.

All protection against double spending is handled automatically by the platform, you do not need to worry about this.

All commands are documented in more detail here: https://www.multichain.com/developers/json-rpc-api/

answered Jan 10, 2019 by MultiChain
then what should be meaning of listlockunspent api?
even i am not getting any output here ........ it should atleast show which transactions are with locked label
The listlockunspent API shows UTXOs that have been locked in that node, by APIs such as lockunspent, preparelockunspent, or createrawtransaction/createrawsendfrom with 'lock' in the last parameter.
i have understood about listlockunspent... Thanks for your quick answer

Now just wanted to lget ittle bit more clarity on  this sentence:
"APIs such as lockunspent, preparelockunspent, or createrawtransaction/createrawsendfrom with 'lock' in the last parameter"

can you explain this little more with example


Thanks in advance
These first two APIs explicitly lock a UTXO. And the last two have an option of locking the input UTXOs that they are using for the transaction they are building.
ok so now for if node wants to do new transaction then createrawtransaction/createrawsendfrom command have option for locking input right?

if that is the case then what is the use of that?
just curios to understand
You lock a UTXO to prevent it being selected for spending in another transaction. For example there can be a delay between calling createrawsendfrom to create a transaction, and actually sending that transaction. In the meantime you wouldn't want any of the UTXOs used by the transaction to be spent by some different transaction, since that would prevent the earlier transaction from being accepted.
...