api_raw_and_muti_signed_transaction - UCHAIN-WORLD/uchain-fullnode GitHub Wiki

title: transaction api

  • help

    show command usage.

    • JS Parameters
     { 
       method: 'POST',  
       url: 'http://127.0.0.1:8707/rpc/v3',  
       headers:   
       {  
        'Content-Type': 'application/json'   
       },  
       body: 
       { 
         "jsonrpc": "3.0",  
         "method": "{COMMAND}",  
        "params": [ "test", "123456"],  
         "id": 7    
       },  
       json: true   
    };
    
  • Response (Example for shutdown)

    {
    "id": 7,
    "jsonrpc": "3.0",
    "result": "\nUsage: uc-cli shutdown [-h] [ADMINNAME] [ADMINAUTH]                      \n\n
    Info: stop ucd.                                                          \n\n
    Options (named):\n\n-h [--help]          Get a description and instructions for this command.\n\n
    Arguments (positional):\n\n
    ADMINNAME            admin name.                                         \n
    ADMINAUTH            admin password/authorization.                       \n"
    

}


  • createrawtx

    createrawtx
    • JS Parameters
        { 
            method: 'POST',  
            url: 'http://127.0.0.1:8707/rpc/v3',  
            headers:   
            {  
             'Content-Type': 'application/json'   
            },  
            body: 
           { 
          "id": 7   ,
         "jsonrpc": "3.0",  
         "method":"createrawtx",
         "params":[
         	{
         	"receivers":"UaWMHFWmZYwEFVbwEpaEeMHTm9UL451ZX8:10",
         	"senders":["UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx","USa9SKiMHZ3TRcodvJi6oGVgS65iy47Hh4"],
         	"type":0
         	}
         ]
       },  
            json: true   
         };
      
      • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : "040000000114cb3797e277624083e26f747c4abdaabeb406c736f22ead9ad2eb1a127ded330300000000ffffffff020a000000000000001976a914895e1ec4d6057ec2c66b77a06269b8bef211ddd288ac0100000000000000b6c613e4555223011976a914078910a58cea508623e2be9b38beb6e7d576e88088ac010000000000000000000000"
    }
    
    

  • decoderawtx

    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
          { 
             "id": 7   ,
            "jsonrpc": "3.0",  
       	    "method":"decoderawtx",
       	    "params":[
       	    	"040000000114cb3797e277624083e26f747c4abdaabeb406c736f22ead9ad2eb1a127ded330300000000ffffffff020a000000000000001976a914895e1ec4d6057ec2c66b77a06269b8bef211ddd288ac0100000000000000b6c613e4555223011976a914078910a58cea508623e2be9b38beb6e7d576e88088ac010000000000000000000000"
       	    ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    {
    	"hash" : "6ea59e149ff8e2c41504f0c7803f261db5522511074f7e63c9700a5ef4f42060",
    	"inputs" : 
    	[
    		{
    			"previous_output" : 
    			{
    				"hash" : "33ed7d121aebd29aad2ef236c706b4beaabd4a7c746fe283406277e29737cb14",
    				"index" : 3
    			},
    			"script" : "",
    			"sequence" : 4294967295
    		}
    	],
    	"lock_time" : "0",
    	"outputs" : 
    	[
    		{
    			"address" : "UaWMHFWmZYwEFVbwEpaEeMHTm9UL451ZX8",
    			"asset" : 
    			{
    				"type" : "ucn"
    			},
    			"index" : 0,
    			"locked_height_range" : 0,
    			"script" : "dup hash160 [ 895e1ec4d6057ec2c66b77a06269b8bef211ddd2 ] equalverify checksig",
    			"value" : 10
    		},
    		{
    			"address" : "UNfrtAxhJRi83PjTPjV3yNPKnjLYR22Bhx",
    			"asset" : 
    			{
    				"type" : "ucn"
    			},
    			"index" : 1,
    			"locked_height_range" : 0,
    			"script" : "dup hash160 [ 078910a58cea508623e2be9b38beb6e7d576e880 ] equalverify checksig",
    			"value" : 81999747074999990
    		}
    	],
    	"version" : "4"
    }
    }
    
    
    

  • signrawtx

    signrawtx

  • JS Parameters

      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
          { 
             "id": 7   ,
            "jsonrpc": 3.0,  
       	    "method":"signrawtx",
       	    "params":[
       	    	"yang",
       	    	"123456",
       	    	"04000000013df2c5ee383412017dd9f713e4a1c08f0f471cc0275942acb7547c262f0b67bd0300000000ffffffff020a000000000000001976a914895e1ec4d6057ec2c66b77a06269b8bef211ddd288ac010000000000000076d22cb64796af001976a914078910a58cea508623e2be9b38beb6e7d576e88088ac010000000000000000000000"
       	    ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    {
    	"hash" : "0cf07c59cd39bdcc8ae799f07e71bc9732ec34bedc0ee154627cb60e06fddc34",
    	"rawtx" : "04000000013df2c5ee383412017dd9f713e4a1c08f0f471cc0275942acb7547c262f0b67bd030000006a47304402201900948e47fe5655b1efa6f4ec1f2f85abfa55f3d4793f71f18de3ee1526e1c00220273cc2b10b9a4ad762d366886b869ae6b2dc43201a5f3b4dcf4eb9fb7eb291400121027c99068f735e53064682b9ef1f548a00191b5ffb2fd9b9c8f32cde97793a0ed4ffffffff020a000000000000001976a914895e1ec4d6057ec2c66b77a06269b8bef211ddd288ac010000000000000076d22cb64796af001976a914078910a58cea508623e2be9b38beb6e7d576e88088ac010000000000000000000000"
    }
    }
    
    
    

  • sendrawtx

    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
          { 
             "id": 7   ,
            "jsonrpc": 3.0,  
            "method":"sendrawtx",
       	    "params":[
       	    	"04000000013df2c5ee383412017dd9f713e4a1c08f0f471cc0275942acb7547c262f0b67bd030000006a47304402201900948e47fe5655b1efa6f4ec1f2f85abfa55f3d4793f71f18de3ee1526e1c00220273cc2b10b9a4ad762d366886b869ae6b2dc43201a5f3b4dcf4eb9fb7eb291400121027c99068f735e53064682b9ef1f548a00191b5ffb2fd9b9c8f32cde97793a0ed4ffffffff020a000000000000001976a914895e1ec4d6057ec2c66b77a06269b8bef211ddd288ac010000000000000076d22cb64796af001976a914078910a58cea508623e2be9b38beb6e7d576e88088ac010000000000000000000000"
       	    ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : "0cf07c59cd39bdcc8ae799f07e71bc9732ec34bedc0ee154627cb60e06fddc34"
    }
    
    
    

  • checkpublickey

    Show public key of address

    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
            { 
        "id": 7   ,
       "jsonrpc": 3.0,  
      "method":"checkpublickey",
      "params":[
      	"test1",
      	"456789",
      	"UVgjjVHYn9XF72dXW2mdYEFWHA1qNziyNb"
      ]
     },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    {
    	"address" : "UVgjjVHYn9XF72dXW2mdYEFWHA1qNziyNb",
    	"public_key" : "032579683a9b17c29b99102c04989b5b28c814a92fa65558c680cb7126c6af0042"
    }
    }
    
    
    

    • createmultisigtx

    createmultisigtx

    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
    { 
             "id": 7   ,
            "jsonrpc": 3.0,  
           "method":"createmultisigtx",
           "params":[
           	{
           		"symbol":"BLOCK",
           		"type":3
           	},
           	"test1",
           	"456789",
           	"34EHRzpwKmFno8zPi3YvXBgqwzZGbYhS3a",
           	"MKow3n2psKMwLuzufxoJzPycTyEiUcFJSQ",
           	333
           ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    "02000000016453713104d144387553bcb0fa457f40d2dc5fb916bd9e2256835a4b6de48d4c00000000b500483045022100cbfdda943648344dc03fd92a905072082af93dfd4f166e3d1bb258e3437069790220321ee22c6a2543392909e21cd347d009a6d32173c23700424b45b4592d4075e3014c69522102729cae0c16009f44440f306b76fafb7a7d2503741a619c15b41ff927c1afd6b92103d29f0b96f332e50d6014cb91c334214ecb8caf2881a97e7d944bdf4e5fd6a39e2103f97e079ccae21e1ee65d5ee64e5c27d7d6ce9a867cec75e9736ad5f258329e0253aeffffffff02100d0000000000001976a9146a20e940e8d7be0a49c598e91fa79c8b36e5353588ac0100000000000000d0fb01000000000017a91457e1a19e5ee4c0065f8fd76b0351fa145e44435a87010000000000000000000000"
    }
    
    
    • Example 2, send token
    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
        { 
             "id": 7   ,
            "jsonrpc": 3.0,  
           "method":"createmultisigtx",
           "params":[
           	{
           		"symbol":"BLOCK",
           		"type":3
           	},
           	"test1",
           	"456789",
           	"34EHRzpwKmFno8zPi3YvXBgqwzZGbYhS3a",
           	"MKow3n2psKMwLuzufxoJzPycTyEiUcFJSQ",
           	333
           ]
          },  
          json: true   
       };
    
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : "02000000027228f5e854b565c2abc0c76d03be2b35aee4e6ee1d5df31bf586944b7a0230dc000000009300483045022100e483f215974cd4033887e48bb1a8db7dc5d7ed189078a8a1769efa643f7b8ea202205f4c803a979c910fcc23acfffebe0c7cb6c3e5354b8eaa0b5ba52159cdeda5ba014c47522102f611da5c3c78472855aad6af94b6e56521999f3884bc25165720349556b823062103d54aa74f5832252992cc61ce62bc91e66f2715720cb15256d1bf132fef1f777852aeffffffff1fef544624891be0b3b7e3374a6ebeba3b989b8609f1812e2333d1ffb756e7cc0000000092004730440220243819f923a1d2bea11c2da729a746886ab1d6deef980d8effc64e2acd472b580220042ff9c7e7df3c6911f0e52283b053b00452acb8be4bfc90aed9a98f24f83783014c47522102f611da5c3c78472855aad6af94b6e56521999f3884bc25165720349556b823062103d54aa74f5832252992cc61ce62bc91e66f2715720cb15256d1bf132fef1f777852aeffffffff0300000000000000001976a91482a46ca6e0ac21a3b41eff496a57a902ec47654788ac0100000002000000020000001a414c4943453230313830353138543131313730392e41535345544d010000000000003ec642480000000017a9141bda177776546d2766bcfac2fc7a87cae746de1e870100000000000000000000000000000017a9141bda177776546d2766bcfac2fc7a87cae746de1e870100000002000000020000001a414c4943453230313830353138543131313730392e41535345549b0200000000000000000000"
    

  • createmultisigaddress

    create multi-signed address

    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
      { 
             "id": 7   ,
            "jsonrpc": 3.0,  
            "method":"createmultisigaddress",
       	    "params":[
       	    	{
       	    		"signaturenum":2,
       	    		"publickeynum":2,
       	    		"selfpublickey":"0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d",
       	    		"publickey":"020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84"
       	    	},
       	    	"test1",
       	    	"456789"
       	    ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    {
    "address" : "38fZvvVpYCKjtq3i7m1rsYffSQDBK97ktZ",
    "description" : "",
    "index" : 1,
    "m" : 2,
    "multisig_script" : "2 [ 020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84 ]  [ 0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d ] 2 checkmultisig",
    "n" : 2,
    "public_keys" : 
    [
    	"020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84",
    	"0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d"
    ],
    "self_publickey" : "0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d"
    }
    }
    

  • showmultisigaddresses

    Check multi-signed address.
    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
      { 
             "id": 7   ,
            "jsonrpc": 3.0,  
           "method":"showmultisigaddresses",
           "params":[
           	"test1",
           	"456789"
           ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    
    [
    	{
    		"address" : "38fZvvVpYCKjtq3i7m1rsYffSQDBK97ktZ",
    		"description" : "",
    		"index" : 1,
    		"m" : 2,
    		"multisig_script" : "2 [ 020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84 ]  [ 0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d ] 2 checkmultisig",
    		"n" : 2,
    		"public_keys" : 
    		[
    			"020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84",
    			"0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d"
    		],
    		"self_publickey" : "0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d"
    	}
    ]
    }
    

    • deletemultisigaddress

    delete multi-signed address.
    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
              { 
        "id": 7   ,
      "jsonrpc": 3.0,  
       "method":"deletemultisigaddress",
       "params":[
       	"test1",
       	"456789",
       	"38fZvvVpYCKjtq3i7m1rsYffSQDBK97ktZ"
       ]
     },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" : 
    [
    	{
    		"address" : "38fZvvVpYCKjtq3i7m1rsYffSQDBK97ktZ",
    		"description" : "",
    		"index" : 1,
    		"m" : 2,
    		"multisig_script" : "2 [ 020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84 ]  [ 0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d ] 2 checkmultisig",
    		"n" : 2,
    		"public_keys" : 
    		[
    			"020633c5cc2314f8a464c888ca4c98c4eac69cb468ec2e904decb8a5973bc17d84",
    			"0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d"
    		],
    		"self_publickey" : "0386e78227d2e2a80e5d99a727a48b67501ea87223634544a38ae1c1720e59167d"
    	}
    ]
    }
    


  • signmultisigtx

    signmultisigtx
    • JS Parameters
      { 
          method: 'POST',  
          url: 'http://127.0.0.1:8707/rpc/v3',  
          headers:   
          {  
           'Content-Type': 'application/json'   
          },  
          body: 
       {
             "id": 7   ,
            "jsonrpc": 3.0,  
       	    "method":"signmultisigtx",
       	    "params":[
       	    	"test1",
       	    	"456789",
       	    	"--broadcast",
       	    	"02000000016453713104d144387553bcb0fa457f40d2dc5fb916bd9e2256835a4b6de48d4c00000000b500483045022100cbfdda943648344dc03fd92a905072082af93dfd4f166e3d1bb258e3437069790220321ee22c6a2543392909e21cd347d009a6d32173c23700424b45b4592d4075e3014c69522102729cae0c16009f44440f306b76fafb7a7d2503741a619c15b41ff927c1afd6b92103d29f0b96f332e50d6014cb91c334214ecb8caf2881a97e7d944bdf4e5fd6a39e2103f97e079ccae21e1ee65d5ee64e5c27d7d6ce9a867cec75e9736ad5f258329e0253aeffffffff02100d0000000000001976a9146a20e940e8d7be0a49c598e91fa79c8b36e5353588ac0100000000000000d0fb01000000000017a91457e1a19e5ee4c0065f8fd76b0351fa145e44435a87010000000000000000000000"
       	    	
       	    ]
          },  
          json: true   
       };
    
    • Response
    {
    "id" : 7,
    "jsonrpc" : "3.0",
    "result" :  "02000000016453713104d144387553bcb0fa457f40d2dc5fb916bd9e2256835a4b6de48d4c00000000fdfd0000483045022100cbfdda943648344dc03fd92a905072082af93dfd4f166e3d1bb258e3437069790220321ee22c6a2543392909e21cd347d009a6d32173c23700424b45b4592d4075e3014730440220018b6a113d89de18b6c3c7090758cf9e4ca24e7762a2796b872bf6d2d1015b96022046b4518aa9451e617dff9467db7fe0c0d45811d0884faed51e343fec2c4579ff014c69522102729cae0c16009f44440f306b76fafb7a7d2503741a619c15b41ff927c1afd6b92103d29f0b96f332e50d6014cb91c334214ecb8caf2881a97e7d944bdf4e5fd6a39e2103f97e079ccae21e1ee65d5ee64e5c27d7d6ce9a867cec75e9736ad5f258329e0253aeffffffff02100d0000000000001976a9146a20e940e8d7be0a49c598e91fa79c8b36e5353588ac0100000000000000d0fb01000000000017a91457e1a19e5ee4c0065f8fd76b0351fa145e44435a87010000000000000000000000"
    }