Transformers main network API

0 19
Avatar for Sak1e_
Written by
10 months ago

Transformers main network API

This document is an RPC interface document for transformers chain. The document is applicable to transformers version v0.22.2. The document introduces some commonly used information acquisition interfaces, transaction interfaces and callback interfaces.

Enable RPC interface (important)

Before starting the program, first open the configuration file config.json, refer to the following configuration

If you need to enable rpc power supply, please modify the config.json file and set rpc to true

Query class interface

The following interfaces are the default APIs of the mainnet node and can be called directly.

1.get_height(Get height)

2.get_balance(Get address balance)

3. get_tx_info(Get transaction information interface)

4.get_block interface

This interface is an RPC interface, and the request parameters are as follows:

1.parameter top(start from what height) num(The number of traversal heights starting from top)

2. Call example

http://IP:port/get_block?top=10&num=20

return as follows:

    {
        "block":{//block
            "hash":"18dfcf300540bd04d26c118d1d52f9393b44592ecb865528afb92ffbc46dd48f",//block hash
            "height":10,//block height
            "time":1680254879190916//block time
        },
        "tx":[//transaction body
            {
                "Consensus":8,//Transaction consensus number
                "Cost":0,//Transaction packaging fee
                "Gas":0,//gas fee
                "Type":"Tx",//Large transaction type ,Currently only the main transaction
                "identity":"127AKiaP7DTfaNiUaSAgLu66FcZCYYVLvY",//transaction packer
                "time":1680254875731987,//transaction hour
                "txHash":"3a97c7b4ece389c7b5043f1d1c7aa2e173100c21e9f8f4b1c24cab1b480b3614",//transaction hash
                "txType":1,//Small types of transactions: ordinary transactions, pledges, investments, etc.
                "utxo":{
                    "multisign":[
                        {
                            "pub":"xJMwFzmD+qN+X5lYxz30/ZQlvKqITqUpubMTNrhtbbqMX1QJjv4JlgLp2FuzdpvQEWmM4qhIksqdzck0PAQkAQ==",
                            "sign":"xJMwFzmD+qN+X5lYxz30/ZQlvKqITqUpubMTNrhtbbqMX1QJjv4JlgLp2FuzdpvQEWmM4qhIksqdzck0PAQkAQ=="
                        }
                    ],
                    "owner":[
                        "157XxCrhoSZ62YKykxhPa38BogExCwxxvn"//Initiator of the transaction
                    ],
                    "vin":{
                        "prevout":{
                            "hash":[
                                "561925ff253dcae91b6bd55001d0bf6f10657082c2dc175ab08c03c4ca4b4b6d"//utxo used
                            ]
                        },
                        "vinsign":[
                            {
                                 "pub":"MCowBQYDK2VwAyEACkFeTyQOZGETJFm3NXnIK9XGDrPOVa8gdNhUYaPRuh0=",//The public key signed for vin, in base64 format
                                 "sign":"e2U/6RpXQJbCVScqV1SVg7czcWXMC+a7yVt+Z7JzFKDc1p4ym/ZkLzkTbgsJTaHLK7JzECM4beyYpzCIjtRfBA=="//Signature information for vin, in base64 format
                            }
                        ]
                    },
                    "vout":[
                        {
                            "addr":"1E5GEcuipacDnrrstY4xkih5sBYfacwmTh",//transaction recipient
                            "value":100000000//Amount received by the recipient
                        },
                        {
                            "addr":"157XxCrhoSZ62YKykxhPa38BogExCwxxvn",
                            "value":73969459600
                        },
                        {
                            "addr":"VirtualBurnGas",//Burn the address
                            "value":20200//Burn the anount
                        }
                    ]
                },
                "verifySign":[
                    {
                        "pub":"MCowBQYDK2VwAyEAcgX+Tp6PyrEYMA2Kn1wsvbJcUJzt4/JvBLBp0rzec10=",//Signer's public key
                        "sign":"mx3rg+Zf35yQnsTr4qOa9zYef94jEy9CBNTlG9hH93ZZviR/J5r5To6LPSJtCfD0T8kVsjc9OvnsJTMjokl6Ag==",//Signer's signature information
                        "signaddr":"127AKiaP7DTfaNiUaSAgLu66FcZCYYVLvY"//Signer's base58
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEApFoqoHUjXmh5LWzT8LInB/uyjAgTALdS/xxc9DQEZN4=",
                        "sign":"GZDaoFMBSc9KgKDmMciUJz8KPu/pyZ3do+P56Syih3Zcmjz5y6eZ+9oASOFR1sgiUNilZCBDqGLyods8qIzECg==",
                        "signaddr":"16rk424JYwsBeHiigiQXBwhzyGsHjC5qUx"
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEA3Z26vzI+gcPqhQJ52XRDgT8uPooIYeXn15HJT0ejB8U=",
                        "sign":"ZTJLMZKfVD722R2EHmcmQU8ibC3l5+xbpSb2stpRsYFZtnnoa2JMZJZf9l6g1hbH9z/7yCwXvIQ59hRb8XDjCA==",
                        "signaddr":"16mGAbCN8aZ61MBWqj65JnuuUMz3XwFhvk"
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEAQYklNAOAKvgiZCpjqiHaAJ5TQ8xK4054H2LGQUbyLRI=",
                        "sign":"W2KtfpA22BZlbYzX6/oE8t16cgye1JfuWwP41EFW/N104oADTkbaFkj8xAISeZ9EYHw0y3WCvxbKQDNhG/XlDQ==",
                        "signaddr":"1GtTw5rpFjtxDMS7UAbejnVBHF9qPijpj7"
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEAj2L9HbLfQHUUtsY9tku/QH36zhIG69W5Gg+zVIKf20A=",
                        "sign":"29YbwkvfKOd7KaNrxoqxaeLV5ieIbxRm2Kx3zjtbpgsHZ7+lqsq9bUsa/UOxQ5yERFe56GnolF2S5w1joEqhAQ==",
                        "signaddr":"1HwQJd6eo3X9kSgwTcbj37JSc3YaYcm5FV"
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEAAU3jnfVhy+Bqf6LWKIzLU96SQsv04n3QPrs+b8SklmQ=",
                        "sign":"d+r2pLNLRvBWms4f/QGK6C0iTHaYLI9/Q4fPR5ggh3XOt2QM9hvTkUSFpZ9MusFmyOelhA3jrYT69NBu53iBBg==",
                        "signaddr":"1GVmxduCHqzi6Ebxazy1xNMCFAkjHJHBz3"
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEAs3LkwwNG6Ej77oxv8qS8KlCtvw6C4M8H4rldQiq4A/4=",
                        "sign":"pPJb+5tMFmQdNGxxFfrHiSF43HgWAjpWVhH+vnRX6+YDq17AcG4yW3i1IZJacDyZtDaTbCT1D5UG+trxMSeVAQ==",
                        "signaddr":"18MBP2QMp9wsxJmHu9CKGxMnofTFAhcngw"
                    },
                    {
                        "pub":"MCowBQYDK2VwAyEApS6VOfVLV3bCeanR35FZW/i129wd1XFNFA1YaRJlNXY=",
                        "sign":"m556KFsIYy+rWCX0SHdeV6EGQqSnlrf+AECre35+oEtu6vgtwaseuwbWiAkrwlpkD+8IKNMjjNmzWeKV0MokCQ==",
                        "signaddr":"13qCpfVgU5MhfCUTLKfBFCufi71hP44dt3"
                    }
                ]
            }
        ]
    }
    

5.info interface(return data in non-json format)

1
$ 0.00
Avatar for Sak1e_
Written by
10 months ago

Comments