MultiChain / multichain-explorer

Web-based explorer for MultiChain blockchains
GNU Affero General Public License v3.0
177 stars 140 forks source link

Unrecognized MultiChain metadata, any way to improve the output? #4

Closed roderik closed 8 years ago

roderik commented 8 years ago

I made a transaction with metadata (sha256 hash in hex format) and the explorer shows Unrecognized MultiChain metadata for the transaction. Is there a format to use that is recognised?

bitcartel commented 8 years ago

What command did you run to create the transaction with metadata?

Please copy the JSON output from multichain-cli mychain getrawtransaction TXHASH 1 and let me know which output contains the metadata and what you see in the explorer.

roderik commented 8 years ago

I'm using the json-rpc interface, so here are the requests, data and responses. The metadata is created in PHP as follows:

bin2hex(hash('sha256', "some content")));

Sending the transaction:

==> Request: 
{
    "jsonrpc": "2.0",
    "method": "sendwithmetadatafrom",
    "id": 1431901949,
    "params": [
        "1B8cu3jUuoyjNQ2LX99PugPGQkqRSiaEQ1deb",
        "15aAj47gQTTuGmAFE4QXuJDZa83qYgycVhyt5N",
        {
            "PROPERTY": 1
        },
        "39333936333434613834623533323164393030393630316238303539316330653162316537663736663563393931353565303934633237306136303766363432"
    ]
}
==> Response: 
{
    "result": "683b920b0d4c69703eaa67b0219d500185992fff0191350f39ef56ff22260233",
    "error": null,
    "id": 1431901949
}

Getting the raw transaction:

==> Request: 
{
    "jsonrpc": "2.0",
    "method": "getrawtransaction",
    "id": 2146754526,
    "params": [
        "683b920b0d4c69703eaa67b0219d500185992fff0191350f39ef56ff22260233",
        1
    ]
}
==> Response: 
{
    "result": {
        "hex": "01000000019c2c1dd34a558a8d36bd1d947606cb74c0f246020df8b7af201aa8326233369d020000006a4730440220295eff8132d83e36233a27ba43c646d87a44cee4665626c04920da1d6f4ce61102205e6649e58a2d98f61560b5f18e53dbcb19ba92c5b2c4ebdde57a76d66a486075012103426fb7adf52bf714583e11a9677119bbd82595ea03128ddd3dc0b0bc7f9eee38ffffffff0300000000000000003176a91421d3aae5784db94c7a014de291888d0dcaff023c88ac1673706b715e00000009010000e7770100000000000000750000000000000000426a403933393633343461383462353332316439303039363031623830353931633065316231653766373666356339393135356530393463323730613630376636343200000000000000003176a914014adcf85738af413c498f6e8d51eff28b3209b588ac1673706b715e00000009010000e777fd7fc6a47e8d03007500000000",
        "txid": "683b920b0d4c69703eaa67b0219d500185992fff0191350f39ef56ff22260233",
        "version": 1,
        "locktime": 0,
        "vin": [
            {
                "txid": "9d36336232a81a20afb7f80d0246f2c074cb0676941dbd368d8a554ad31d2c9c",
                "vout": 2,
                "scriptSig": {
                    "asm": "30440220295eff8132d83e36233a27ba43c646d87a44cee4665626c04920da1d6f4ce61102205e6649e58a2d98f61560b5f18e53dbcb19ba92c5b2c4ebdde57a76d66a48607501 03426fb7adf52bf714583e11a9677119bbd82595ea03128ddd3dc0b0bc7f9eee38",
                    "hex": "4730440220295eff8132d83e36233a27ba43c646d87a44cee4665626c04920da1d6f4ce61102205e6649e58a2d98f61560b5f18e53dbcb19ba92c5b2c4ebdde57a76d66a486075012103426fb7adf52bf714583e11a9677119bbd82595ea03128ddd3dc0b0bc7f9eee38"
                },
                "sequence": 4294967295
            }
        ],
        "vout": [
            {
                "value": 0,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 21d3aae5784db94c7a014de291888d0dcaff023c OP_EQUALVERIFY OP_CHECKSIG 73706b715e00000009010000e7770100000000000000 OP_DROP",
                    "hex": "76a91421d3aae5784db94c7a014de291888d0dcaff023c88ac1673706b715e00000009010000e777010000000000000075",
                    "reqSigs": 1,
                    "type": "pubkeyhash",
                    "addresses": [
                        "15aAj47gQTTuGmAFE4QXuJDZa83qYgycVhyt5N"
                    ]
                },
                "assets": [
                    {
                        "name": "PROPERTY",
                        "issuetxid": "e7779b654a602e5c5b0d26587558806e0752b76229226bc6a7ae53874e483bf0",
                        "assetref": "94-265-30695",
                        "qty": 1,
                        "raw": 1
                    }
                ],
                "permissions": []
            },
            {
                "value": 0,
                "n": 1,
                "scriptPubKey": {
                    "asm": "OP_RETURN 39333936333434613834623533323164393030393630316238303539316330653162316537663736663563393931353565303934633237306136303766363432",
                    "hex": "6a4039333936333434613834623533323164393030393630316238303539316330653162316537663736663563393931353565303934633237306136303766363432",
                    "type": "nulldata"
                },
                "assets": [],
                "permissions": []
            },
            {
                "value": 0,
                "n": 2,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 014adcf85738af413c498f6e8d51eff28b3209b5 OP_EQUALVERIFY OP_CHECKSIG 73706b715e00000009010000e777fd7fc6a47e8d0300 OP_DROP",
                    "hex": "76a914014adcf85738af413c498f6e8d51eff28b3209b588ac1673706b715e00000009010000e777fd7fc6a47e8d030075",
                    "reqSigs": 1,
                    "type": "pubkeyhash",
                    "addresses": [
                        "1B8cu3jUuoyjNQ2LX99PugPGQkqRSiaEQ1deb"
                    ]
                },
                "assets": [
                    {
                        "name": "PROPERTY",
                        "issuetxid": "e7779b654a602e5c5b0d26587558806e0752b76229226bc6a7ae53874e483bf0",
                        "assetref": "94-265-30695",
                        "qty": 1.0e+15,
                        "raw": 999999999999997
                    }
                ],
                "permissions": []
            }
        ],
        "data": [
            "39333936333434613834623533323164393030393630316238303539316330653162316537663736663563393931353565303934633237306136303766363432"
        ]
    },
    "error": null,
    "id": 2146754526
}

Explorer output: https://www.dropbox.com/s/uwg71r7d1we7nwb/Screenshot%202016-02-16%2017.53.16.png?dl=0

bitcartel commented 8 years ago

Thanks, will look into this.

bitcartel commented 8 years ago

Updated. Explorer now shows the hex metadata.

roderik commented 8 years ago

Works great, thanks