June 24, 2017, 01:11:36 am

Author Topic: how to use issued_colored_coins  (Read 1162 times)

wenchan3

  • Newbie
  • *
  • Posts: 8
    • View Profile
how to use issued_colored_coins
« on: April 10, 2015, 12:08:43 pm »
i want to issue asset, and this is my code...

var request = require('request');

request({
  method: 'POST',
  url: 'https://api.coinprism.com/v1/issueasset?format=json',
  headers: {
    'Content-Type': 'application/json'
  },
  body: "{  \"fees\": 1000,  \"from\": \"1Esd2TsA4gTS6YPeenxUMrxt246JbTg8Dt\",  \"address\": \"akZecC7M5CtDHstuWhq2Rs41anNEQb8yqvX\",  \"amount\": \"600\",  \"metadata\": \"u=https://site.com/assetdef\"}"
}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});




and i get this response


   "inputs":[ 
      { 
         "output_hash":"dd5ec863f948d64001f27decaa47b84c85011b7c438f069f3c436175f16b23c1",
         "output_index":0,
         "value":10000,
         "addresses":[ 
            "1Esd2TsA4gTS6YPeenxUMrxt246JbTg8Dt"
         ],
         "script_signature":"76a914982c817091bd594e12cc3e4b5ba7acd832ff731388ac",
         "asset_id":null,
         "asset_quantity":null
      }
   ],
   "outputs":[ 
      { 
         "index":0,
         "value":600,
         "addresses":[ 
            "1PgiwwXjjQKc1ek9fCvFDC71Sm4Ea9y2j7"
         ],
         "script":"76a914f8d6016baa108ef8b8f91111312e1eba0f65214a88ac",
         "asset_id":"AGJacxjmHwpEXbRFPGcsEdHkzu73tdoY2f",
         "asset_quantity":"600"
      },
      { 
         "index":1,
         "value":0,
         "addresses":[ 

         ],
         "script":"6a234f41010001d8041b753d68747470733a2f2f736974652e636f6d2f6173736574646566",
         "asset_id":null,
         "asset_quantity":null
      },
      { 
         "index":2,
         "value":8400,
         "addresses":[ 
            "1Esd2TsA4gTS6YPeenxUMrxt246JbTg8Dt"
         ],
         "script":"76a914982c817091bd594e12cc3e4b5ba7acd832ff731388ac",
         "asset_id":null,
         "asset_quantity":null
      }
   ],
   "amount":9000,
   "fees":1000
}

but when i opened coinprism website, and open "tansaction" tab, there is no transaction with 600 quantity
« Last Edit: April 10, 2015, 12:17:19 pm by wenchan3 »

zenki

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: how to use issued_colored_coins
« Reply #1 on: May 20, 2015, 12:53:07 pm »
Also, when I use the API four issue new olor or send an asset i have this error:
status: 400
headers: {Server=[Microsoft-IIS/8.5], Cache-Control=[no-cache], Expires=[-1], Pragma=[no-cache], Content-Length=[50], Date=[Wed, 20 May 2015 09:49:13 GMT], Content-Type=[application/json; charset=utf-8]}
body:{"Message":"Error","ErrorCode":"InvalidApiMethod"}

My code is like this:
public class TransactionBuilder {
public static void SendAsset() {

      String address = "https://testnet.api.coinprism.com";
      

      Client client = ClientBuilder.newClient();

      Entity payload = Entity
            .json("{  'fees': 1000,  'from': 'n1rTtCgS3tRmonD4s6FbcBMG49bQrb18wn',  "
                  + "'to': [ {'address':'bWxjNK57mGkcwwsNDzfAYx45qGrKnHJ9i1V', 'amount': '100000','asset_id':'oeED4i3XFGatENA87QcGAgab6nsPxReWSh'}]}");//
      Response response = client.target(address)
            .path("/v1/sendasset?format=json")
            .request(MediaType.APPLICATION_JSON_TYPE).post(payload);

      System.out.println("status: " + response.getStatus());
      System.out.println("headers: " + response.getHeaders());
      System.out.println("body:" + response.readEntity(String.class));
   }

   public static void main(String[] args) throws Exception {
      // IsuueColredCoins();
      SendAsset();
   }
}


« Last Edit: May 21, 2015, 02:17:56 pm by zenki »