Aquiver Crypto

Informations

​Forum post​
​Showcase video​
​Tebex link (buy)​

READ FIRST

This resource is standalone, so it is not linked to any framework, comes from that you will need to adjust some functions to fit your server, explanations below.
The script is written in Javascript (server,client), but you will do not need to edit any of them. Everything which is important is in the config file which is lua language.
I used Vue for the frontend.

Features

  • 'Real' crypto currency prices, we are using crypto-js api.
  • Wallet hash generated for the players, players can send crypto to online players with targetId, or offline with the target's wallet hash.
  • Payments history, outgoing-incoming.
  • Crypto transactions history, when someone buys/sells a crypto it is showed to everyone with his wallet hash.
  • Crypto price history chart, we are 'manually' saving the prices when the update happens, we could not find a free crypto-history api, so we implemented our 'system'. This means, if your server is not running, then it does not saves that days history.
  • There is a custom 'cryptobalance' linked to your wallet, we needed because we are using 3 decimals for the prices, and we did not wanted to mess with your server bank system, so you will need to top up your crypto account's balance to buy cryptos.
  • Crypto prices are also using 3 decimals.
  • Easily addable cryptocurrencys.

Dependency files

  • mysql
  • node required files. (crypto-js, etc.) if I know it well, fivem should automatically download it, if know install them via npm. (npm i crypto-js, etc.)

Installation

  • 1. Unzip the rar file, and copy the folder in your fivem resources folder.
  • 2. After you extracted the resource, you will need some cmd commands to execute. (You need to cd into your resource folder and type npm i, this will automatically install all of the required dependencies. (more info below)
  • 3. Import the .sql file into your database, do not forget to modify the mysql command to fit your database name. (currently: USE 'testserver';)
  • 4. Modify the language files if you do not want to use the default english, we both have locale files for the client/server and different for the html. (./translations.js || ./html/js/translations.js)
  • 5. You will need to modify the server/mysql.js, becase we are using Javascript, we could not use the default lua queries.
1
const pool = mysql.createPool({
2
host: "localhost",
3
user: "root",
4
database: "testserver",
5
port: 3306,
6
// password: YOURPASSWORD,
7
waitForConnections: true,
8
connectionLimit: 500,
9
queueLimit: 0,
10
timeout: 600000
11
})
Copied!
​

Dependency installation

After you have the extracted folder in your resources, you will need to grab up some cmd typings.
Open the cmd up, then cd (go into) your resource folder then type npm i.

Config

1
Config = {}
2
​
3
Config.CryptoFee = 2 -- percentage
4
Config.MaximumHistory = 500 -- maximum history to hold in mysql and load, REDUCE IT IF YOU WANT MORE PERFORMANCE
5
Config.UpdateTime = 60000 -- milisecond
6
Config.UpdateMarketCapsTime = 60000
7
Config.MaximumTransactionHistoryWallet = 100 -- BUY/SELL maximum transaction to hold in mysql per PLAYER! REDUCE IT IF YOU WANT MORE PERFORMANCE
8
Config.MaximumPlayerTransactionsHistory = 100 -- TRANSFER maximum transaction to hold in mysql per PLAYER!
9
Config.Cryptos = {
10
{'BTC','Bitcoin'},
11
{'BCH','Bitcoin Cash'},
12
{'MKR','Maker'},
13
{'ALGO','Algorand'},
14
{'ETH','Etherum'},
15
{'LTC','Litecoin'},
16
{'XMR','Monero'},
17
{'XRP','Ripple'},
18
{'DOGE','Dogecoin'},
19
{'SOL','Solana'}
20
}
21
​
22
exports('removeBank', function(source, amount, cb)
23
print(string.format('BANK REMOVED: %s from source: %s', amount, source))
24
​
25
if cb then cb() end
26
end)
27
​
28
exports('Notification', function(source, msg)
29
print(string.format('NOTIFICATION TO: %s MSG: %s', source, msg))
30
end)
31
​
32
exports('getBank', function(source)
33
return 500000
34
end)
35
​
36
exports('addBank', function(source, amount, cb)
37
print(string.format('BANK ADDED: %s to source: %s', amount, source))
38
​
39
if cb then cb() end
40
end)
41
​
42
​
43
​
44
-- THESE ARE NOT FOR YOU! --
45
exports('serverLog', function(log)
46
print(json.encode(log))
47
end)
48
exports('getConfigVal', function(key, cb)
49
if Config[key] then
50
if cb then cb(Config[key]) end
51
return Config[key]
52
else
53
if cb then cb() end
54
return
55
end
56
end)
57
exports('getPlayers', function()
58
return GetPlayers()
59
end)
Copied!

Pep talk

At first I really wanted to implement the full blockchains for the cryptos to see where it came from where it went and other things, but I came to the conclusion it does not worth the performance and the mysql saves. But yeah.

Adding more cryptocurrency

You want more cryptocurrency in your script?
πŸŽ‰
​
1
Config.Cryptos = {
2
{'BTC','Bitcoin'},
3
{'BCH','Bitcoin Cash'},
4
{'MKR','Maker'},
5
{'ALGO','Algorand'},
6
{'ETH','Etherum'},
7
{'LTC','Litecoin'},
8
{'XMR','Monero'},
9
{'XRP','Ripple'},
10
{'DOGE','Dogecoin'},
11
{'SOL','Solana'}
12
}
Copied!
Here is our default table for the cryptos, you can simply add yours too.
Below the link you will find a big JSON with bunch of cryptos, you will need into your config the code, the second argument in the table is the formatted name.
You will need to download the crypto image and put it to your ./html/img/ folder and name it like: BTC.png, QNT.png
https://www.cryptonator.com/api/currencies
www.cryptonator.com
​
​
​
​
​
​
Last modified 2mo ago