1. Home
  2. Docs
  3. Enterprise Wallet
  4. Developer Documentation
  5. Withdrawals

Withdrawals

Users can withdraw crypto assets securely using Enterprise Wallet. Transactions go through only when the signatures of both user and Enterprise Wallet are present in the transaction.

Enterprise Wallet API Endpoint.

Create Withdrawals

Users can withdraw crypto assets securely using Enterprise Wallet. Transactions go through only when the signatures of both user and Enterprise Wallet are present in the transaction.

Request Type and Endpoint

POST /api/v1/wallets/:wallet_id/withdrawals

Request Query Parameters

ParameterTypeDescriptionRequired
wallet_idIntegerid of the wallet in which withdrawal has to be generatedYes
recipient_addressStringaddress to which the withdrawal should be madeYes
amountIntegervalue of bitcoin in sathoshi’sYes
fee_per_byteIntegerfee ( in sathoshi’s ) to be spend per byte of the bitcoin transactionNo
Request – Response Example
HTTP_METHOD=POST    
HOST=https://coinome.com/wallet  
URI=/api/v1/wallets/11/withdrawals    
CONTENT_TYPE=application/json   
ACCESS_TOKEN=2c6bbada11f6c21738deea51c215ba664d6f6a4a707e4e5fdc10161ee2bb6abf  
DATA='{"address":"2MyWWHiwWhNTABASboypdDrAdqfXw8GKbKc","amount": 63750,"fee_per_byte": 10}'

curl -H "Content-Type: $CONTENT_TYPE" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-X $HTTP_METHOD "$HOST$URI" \
-d "$DATA"
{
	"data": {
		"id": "8",
		"type": "withdrawal_create",
		"attributes": {
			"wallet_id": 280419742,
			"coin": "btc",
			"transaction_data": {
				"unsigned_tx": "020000000001015EC4844EE27FFD8F0A243704E8EC5889815D8A351E15D522DDC9C00A736B9AE80000000023220020AF1A8133E0E826F178727F1BD4D5D24E940339E2F20C285D0AE934636BE08D0BFEFFFFFF0380DE0F000000000017A9149741CDA5384AA5F4EAB04804CED0B358E1317AC087100400000000000017A9140214EECEAF5875BCFA84B888C5AEE43CE1491A3687FE9D0E000000000017A914DB640C34446368376ECC3825EDB5976ABA229A98870000000000",
				"sign_parts": [{
					"txid": "e89a6b730ac0c9dd22d5151e358a5d818958ece80437240a8ffd7fe24e84c45e",
					"vout": "0",
					"address": "2Mw4EM8j3zdzzHHAedkpoqesJGVtKNxUdgP",
					"amount": "2000000",
					"sign_hash": "C4DA169E779A39555AB9D3D785AB0E027659409E6F6CB8D51D352C6A1F2EDD70",
					"signing_keys": [{
						"child_pub": "029FB246B83D523977809DAE4D9AE4B89B83B1972C6985623F61106A0E9F430BE4",
						"path": "m/44/0/280419742/0/16"
					}]
				}]
			},
			"address": "2N72zrLuHGYxiz4hpTQs1CNXjutGHTAWAwF",
			"amount": 1040000,
			"status": "pending",
			"created_at": "2019-04-02T04:09:39.250Z",
			"updated_at": "2019-04-02T04:09:39.557Z"
		}
	}
}

Credence API Endpoint.

Sign Transaction

This endpoint in Credence, sign the transaction using the root private key provided.

After creating a transaction in Enterprise Wallet, it creates a raw transaction without signatures. If user has a 2/3 configuration multi signature wallet, two signatures are required for the transaction to be sucessfully transamitted to blockchain. Out of the three keys, Enterprise Wallet system holds one of them and the rest is owned by user. User can sign the transaction created using his private key via Credence Api. This action can also be performed using Credence desktop application.

Request Type and Endpoint

POST /credenceapi/v1/:coin_name/transaction/sign

Request Query Parameters

In the response of transaction create API in Enterprise Wallet, a key named transaction_data is present. Private key of the user merged with this transaction_data creates the parameters for Credence transaction sign.

ParameterTypeDescriptionRequired
coin_nameStringSupported coin name. eg: bitcoinYes
x_privStringRoot private keyYes
unsigned_txStringRaw transaction hex, a value in output of transaction createYes
sign_parts[sign_part]vAn array of sign parts.Yes
Request – Response Example
curl --request POST \
  --url http://localhost:5000/credenceapi/v1/bitcoin/transaction/sign \
  --header 'content-type: application/json' \
  --data '{
  "unsigned_tx": "020000000001017E3DEB8EF3D28C94D7CB28C9E5988A93E05445578CDCA24C425D8C9691CD5CAF0100000023220020D1D2A8F19DFA12223B5B2F4C842DC033678EED6BAC8F284361E40ED90AAC6668FEFFFFFF02881300000000000017A914EA7424896B39239C97994EDF192A7D0766A9515D87300F11000000000017A9149DB50405A7DC6178F1AFFDE474E18C2D156CCA41870000000000",
  "x_priv": "xprv9s21ZrQH143K42NeaXRcakg3b9ZGMXEEiBC3VbjxFxabEj4g2yMsE98uRpVP3zkdA6F6Nrz8yfXNZRxnWqZw8ckPJokEyzAgv6jEz3Ff7GS",
  "sign_parts": [
    {
      "txid": "",
      "vout": 0,
      "address": "",
      "amount": "",
      "sign_hash": "185c0be5263dce5b4bb50a047973c1b6272bfbd0103a89444597dc40b248ee7c",
      "signing_keys": [
        {
          "child_pub": "032fd4a01886eda61253c2038e22fa1f6cad2a1a0b407795c4712c01703581ff31",
          "path": "m/0/0/0"
        },
       {
          "child_pub": "032fd4a01886eda61253c2038e22fa1f6cad2a1a0b407795c4712c01703581ff31",
          "path": "m/0/0/0"
        }
      ]
    }
  ]
}'
{
  "unsigned_tx": "020000000001017E3DEB8EF3D28C94D7CB28C9E5988A93E05445578CDCA24C425D8C9691CD5CAF0100000023220020D1D2A8F19DFA12223B5B2F4C842DC033678EED6BAC8F284361E40ED90AAC6668FEFFFFFF02881300000000000017A914EA7424896B39239C97994EDF192A7D0766A9515D87300F11000000000017A9149DB50405A7DC6178F1AFFDE474E18C2D156CCA41870000000000",
  "verified": false,
  "sign_parts": [
    {
      "txid": "",
      "vout": 0,
      "address": "",
      "amount": "",
      "sign_hash": "185c0be5263dce5b4bb50a047973c1b6272bfbd0103a89444597dc40b248ee7c",
      "signing_keys": [
        {
          "child_pub": "032fd4a01886eda61253c2038e22fa1f6cad2a1a0b407795c4712c01703581ff31",
          "path": "m/0/0/0",
          "signature": "304402204F26B272ACDDDA6F9A848D453A202AABC3942A8758034CB9BCFE2C78BC242DD3022009938278FE2C477D99F7D0AE0EAF8861CB88F7C799E294DAD4DD71FDD67D816F01",
          "verified": false
        },
        {
          "child_pub": "032fd4a01886eda61253c2038e22fa1f6cad2a1a0b407795c4712c01703581ff31",
          "path": "m/0/0/0",
          "signature": "304402204F26B272ACDDDA6F9A848D453A202AABC3942A8758034CB9BCFE2C78BC242DD3022009938278FE2C477D99F7D0AE0EAF8861CB88F7C799E294DAD4DD71FDD67D816F01",
          "verified": false
        }
      ]
    }
  ]
}

Finalize Transaction

This endpoint creates a new withdrawal from the user’s wallet.

POST /api/v1/wallets/:wallet_id/withdrawals/:id/finalize

Request Query Parameters

ParameterTypeDescriptionRequired
wallet_idIntegerID of withdrawal to be finalizedYes
idIntegerRaw transaction hex, a value in output of transaction createYes
client_signed_txnJSONResponse of sign transaction api from CredenceYes
Request – Response Example
HTTP_METHOD=POST    
HOST=https://coinome.com/wallet  
URI=/api/v1/wallets/11/withdrawals/78/finalize    
CONTENT_TYPE=application/json   
ACCESS_TOKEN=2c6bbada11f6c21738deea51c215ba664d6f6a4a707e4e5fdc10161ee2bb6abf  
DATA='{
    "client_signed_txn":{
				"unsigned_tx": "01000000017048FA94314E336556F31049A73321C9E6C695C6CA4DCBB5E900C7ED6A32A37F0000000000FEFFFFFF03400D03000000000017A9145E89F6ACBB87947D408ED837005C3A396FEB58C9872C010000000000001976A91476D35AC97D948690C85A0A12870D8D6542389B0388AC22A0E30E0000000017A914FA2C622EB4F772AC889B9B3B6ED8D5C44EB167968700000000",
				"sign_parts": [{
					"txid": "7fa3326aedc700e9b5cb4dcac695c6e6c92133a74910f35665334e3194fa4870",
					"vout": "0",
					"address": "8yARyfNUTBQsjaV2fvwhNK14NGCo9L7bgs",
					"amount": "250000000",
					"sign_hash": "59E3B9A4A85BE2105501BA4B6E4CFA4531DB6B32A77C03851C04DE2647E042D9",
					"signing_keys": [{
						"child_pub": "033FB523B98474E9D88BA3CF097C47E377B4617F3282B30A8C0FE1EE8C98FB4AF8",
						"path": "m/44/5/1811404329/0/125"
					}, {
						"child_pub": "0277C6DFFEF92B81358422D4E32BD23D3BB693FB57EB04774545E55F1E2D3A7147",
						"path": "m/44/5/1811404329/0/125"
					}]
				}]
			}
}'

curl -H "Content-Type: $CONTENT_TYPE" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-X $HTTP_METHOD "$HOST$URI" \
-d "$DATA"
{
    "data": {
        "id": "12",
        "type": "withdrawal_finalize",
        "attributes": {
            "wallet_id": 789797987,
            "coin": "btc",
            "txid": "44f8ea3284b78cd7d4e9e72fa3a7d7a4194738dd943b556561cab386516b88cf",
            "address": "asdadsadsada",
            "status": "success",
            "amount": 60000,
            "confirmations": 2,
            "block_height": 145628,
            "block_hash": "qweqdsadawdasdaseadcsadead",
            "created_at": "2019-03-29T04:41:15.917Z",
            "updated_at": "2019-03-29T04:41:15.917Z",
            "details": {
                "fee": 42500,
                "fee_per_byte": 1
            }
        }

    }
}

Enterprise Wallet API Endpoint.

List Withdrawals

This endpoint lists all withdrawal for a specific wallet.

Request Type and Endpoint

GET /api/v1/wallets/:wallet_id/withdrawals

Request Query Parameters

ParameterTypeDescriptionRequired
wallet_idIntegerid of the wallet in which withdrawal has to be generatedYes
Request – Response Example
HTTP_METHOD=GET    
HOST=https://coinome.com/wallet 
URI=/api/v1/wallets/11/withdrawals    
CONTENT_TYPE=application/json   
ACCESS_TOKEN=2c6bbada11f6c21738deea51c215ba664d6f6a4a707e4e5fdc10161ee2bb6abf  

curl -H "Content-Type: $CONTENT_TYPE" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-X $HTTP_METHOD "$HOST$URI" 
{
    "data": [{
        "id": "78",
        "type": "withdrawal",
        "attributes": {
            "id": 78,
            "wallet_id": 11,
            "txid": "44f8ea3284b78cd7d4e9e72fa3a7d7a4194738dd943b556561cab386516b88cf",
            "recipient_address": "2N9xsrCHy6gRh4QjiRT1NQwLLd9rJKVWHEG",
            "amount": 60000,
            "fee": 4860,
            "block_height": null,
            "block_hash": null,
            "confirmations": null,
            "fee_per_byte": 10,
            "status": "success"
        }
    }]
}

Enterprise Wallet API Endpoint.

Show Withdrawals

This endpoint retrieves a specific withdrawal.

Request Type and Endpoint

GET /api/v1/wallets/:wallet_id/withdrawals/:id

Request Query Parameters

ParameterTypeDescriptionRequired
wallet_idIntegerid of the wallet in which withdrawal has to be generatedYes
idIntegerID of withdrawal to be finalizedYes
Request – Response Example
HTTP_METHOD=GET    
HOST=https://coinome.com/wallet
URI=/api/v1/wallets/11/withdrawals/78      
CONTENT_TYPE=application/json   
ACCESS_TOKEN=2c6bbada11f6c21738deea51c215ba664d6f6a4a707e4e5fdc10161ee2bb6abf  

curl -H "Content-Type: $CONTENT_TYPE" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-X $HTTP_METHOD "$HOST$URI" 
{
	"data": {
		"id": "8",
		"type": "withdrawal",
		"attributes": {
			"wallet_id": 280419742,
			"coin": "btc",
			"transaction_data": {
				"unsigned_tx": "020000000001015EC4844EE27FFD8F0A243704E8EC5889815D8A351E15D522DDC9C00A736B9AE80000000023220020AF1A8133E0E826F178727F1BD4D5D24E940339E2F20C285D0AE934636BE08D0BFEFFFFFF0380DE0F000000000017A9149741CDA5384AA5F4EAB04804CED0B358E1317AC087100400000000000017A9140214EECEAF5875BCFA84B888C5AEE43CE1491A3687FE9D0E000000000017A914DB640C34446368376ECC3825EDB5976ABA229A98870000000000",
				"sign_parts": [{
					"txid": "e89a6b730ac0c9dd22d5151e358a5d818958ece80437240a8ffd7fe24e84c45e",
					"vout": "0",
					"address": "2Mw4EM8j3zdzzHHAedkpoqesJGVtKNxUdgP",
					"amount": "2000000",
					"sign_hash": "C4DA169E779A39555AB9D3D785AB0E027659409E6F6CB8D51D352C6A1F2EDD70",
					"signing_keys": [{
						"child_pub": "029FB246B83D523977809DAE4D9AE4B89B83B1972C6985623F61106A0E9F430BE4",
						"path": "m/44/0/280419742/0/16"
					}]
				}]
			},
			"txid": "4a361c8069ffad6e900a72069f717ea887602a20045dbb205a748b97198fab46",
			"address": "2N72zrLuHGYxiz4hpTQs1CNXjutGHTAWAwF",
			"amount": 1040000,
			"confirmations": null,
			"status": "success",
			"block_height": null,
			"block_hash": null,
			"created_at": "2019-04-02T04:09:39.250Z",
			"updated_at": "2019-04-02T04:14:08.802Z",
			"details": {
				"fee": 1010,
				"fee_per_byte": 1
			}
		}
	}
}