-
Notifications
You must be signed in to change notification settings - Fork 5
ScarletCoin Wiki
Check the index to quickly find what you need:
- Generate new address
- Request a refresh
- Sending ScarletCoins
- Import an existing address
- Check TXID
- Mining
The wallet generates a random 16 characters string and it gets hashed into sha256.
It will then send a post request to the server.
The data sent to the server must be a 64 characters string.
E.g.: 71d9e0ga798b4ef13b9cfca045f06a6a23a61db32b0738d39f8b4db52157d464
When the server receives a 64 characters string, it will generate a random 16 characters string and send it back to the wallet.
E.g.: bZRud5RMNRdI7zLL
The wallet sends a request like this:
refresh
+wallet address
It will look like this:
refreshbZRud5RMNRdI7zLL
When the server recieves a request that starts with refresh
, it will check for the address total ScarletCoins and send back the amount of coins, like this:
1000
If the address doesn't exist, it will return this:
Address does not exist
To send money, the request you need to send is built like this:
send
+coins amount
+#
+complete sender address
+#
+receiver address
It will look like this (without the '+', obviously):
send
+1000
+#
+bZRud5RMNRdI7zLL:71d9e0ga798b4ef13b9cfca045f06a6a23a61db32b0738d39f8b4db52157d464
+#
+6ZRGt5RM9ioI6zKz
If the tx succeedes, the response will be:
'Sent. \nTxid = {txid}'
The other possible server responses are:
"You can't send money to yourself"
"Sender or destinatary do not exist"
"You can't send more than what you have"
"You can't send 0"
You'll need to send a post request that looks like this:
import
+hash
It will look like this:
import71d9e0ga798b4ef13b9cfca045f06a6a23a61db32b0738d39f8b4db52157d464
If the server responds with the 16 characters wallet address, it will import it.
If the received hash is found in the database, it will send the 16 characters wallet address.
E.g.: bZRud5RMNRdI7zLL
Else, it will send this:
non existant
To request the txid history of a specific address, the wallet will send:
request_txs
+wallet address
Which looks like this:
request_txs
+bZRud5RMNRdI7zLL
When the server receives a request that starts with request_txs
, it will look in the txs database.
When it fetches the txs made from or to the wallet address, it will send the full txid followed by a #
.
The full txid looks like this:
txid:sender address:receiver address:scarlet coin amount
So it will send a response like this:
full txid
+#
And it will look like this:
72i1HSCvSi8ICIWWRd21BGgOhSp9R4J7:bZRudRRMNRdItzLL:dHP5LamLNPDMfXzM:5#tLYc1WdX3Flr1YNG4p2fVqY71n1Vx8Gd:bZRudRRMNRdItzLL:dHP5LamLNPDMfXzM:3
The miner will try to generate a SHA256 hash that starts with (for now) four zeroes.
To do that, it will make a random multiplication between two big numbers, encode it and make it hex.
Then it will hash the hex value and check if the first 4 values are == 0.
Example:
0x3b3e1c5704
---sha256---> 0000490724893ee20cb4d237959ee4ee5b57a9aa0c5a04ca71932326f8498c5b
Since this hash starts with 4 zeroes, it will create a post request like this:
mined
+hex
+#
+miner wallet address
And it will look like this:
mined
+0x3b3e1c5704
+#
+bZRud5RMNRdI7zLL
The server will parse the hex and check if the sha256 hash starts with 4 zeroes.
If it does, it will add +1 ScarletCoins to the miner wallet address.
If it doesn't (or if the hex has already been mined by someone else), it will return this:
Hash is not valid
or Already mined