decred.org/dcrdex@v1.0.5/spec/accounts.mediawiki (about) 1 =Account Creation= 2 3 __TOC__ 4 5 An account is uniquely identified by the client's public account key (pubkey), 6 which the client provides during registration. 7 After registration, the client does not identify themselves with their pubkey 8 directly. 9 Instead, the account is identified by an '''account ID''', which is the 10 double Blake-256 hash of the client's pubkey, 11 '''''<code>blake256(blake256(pubkey))</code>''''', provided as a hex-encoded 12 string in API messages. 13 14 ==Step 1: Registration== 15 16 The user creates a WebSocket connection and sends their 17 [[fundamentals.mediawiki/#Identities_based_on_Public_Key_Infrastructure_PKI_Key_Pairs|public account key]]. 18 The message is signed with the corresponding private account key. The response 19 includes the server's public key. The server's public key will also be 20 pre-published for further validation. 21 22 '''Request route:''' <code>register</code>, '''originator: ''' client 23 24 <code>payload</code> 25 {| 26 ! field !! type !! description 27 |- 28 | pubkey || string || hex-encoded public account key 29 |- 30 | timestamp || int || UNIX timestamp (milliseconds) 31 |- 32 | sig || string || hex-encoded signature of serialized registration. serialization described below 33 |} 34 35 '''Registration serialization''' 36 37 {| 38 ! field !! size (bytes) !! description 39 |- 40 | pubkey || 33 || the user's public account key 41 |- 42 | timestamp || 8 || the client's UNIX timestamp (milliseconds) 43 |} 44 45 '''DEX response''' 46 47 <code>result</code> 48 {| 49 ! field !! type !! description 50 |- 51 | pubkey || string || hex-encoded server public key 52 |- 53 | address || string || fee address 54 |- 55 | fee || int || fee (atoms) 56 |- 57 | timestamp || int || UNIX timestamp (milliseconds) 58 |- 59 | sig || string || hex-encoded signature of the serialized response. serialization described below 60 |} 61 62 '''Response serialization''' 63 64 {| 65 ! field !! size (bytes) !! description 66 |- 67 | DEX pubkey || 33 || the server's public key 68 |- 69 | client pubkey || 33 || the client's public account key 70 |- 71 | timestamp || 8 || the server's UNIX timestamp (milliseconds) 72 |- 73 | fee || 8 || registration fee (atoms) 74 |- 75 | address || varies || UTF-8 encoded fee address 76 |} 77 78 ==Step 2: Fee Notification== 79 80 The client pays the fee on-chain and notifies the DEX of the transaction detail. 81 The fee is paid with a standard P2PKH output to the address received in step 1. 82 Once the transaction is mined and has the 83 [[fundamentals.mediawiki/#Exchange_Variables|requisite number of confirmations (swapconf)]], 84 the client should send their fee notification to complete 85 the registration process. 86 87 '''Request route:''' <code>notifyfee</code>, '''originator: ''' client 88 89 <code>payload</code> 90 {| 91 ! field !! type !! description 92 |- 93 | accountid || string || client's account ID 94 |- 95 | coinid || string || hex-encoded coin ID 96 |- 97 | timestamp || int || UNIX timestamp (milliseconds) 98 |- 99 | sig || string || hex-encoded signature of serialized fee notification. serialization described below 100 |} 101 102 '''Notification serialization''' 103 104 {| 105 ! field !! size (bytes) !! description 106 |- 107 | account ID || 32 || client account ID 108 |- 109 | coin ID || asset-dependent || the coin ID 110 |} 111 112 <code>result</code> 113 114 {| 115 ! field !! type !! description 116 |- 117 | sig || string || server hex-encoded signature of client's serialized notification 118 |} 119 120 The client can then authenticate their connection using the 121 <code>connect</code> route and begin trading.