jpcsupplies / Economy_mod

Basic Economy System for Space Engineers
13 stars 12 forks source link

proof of concept - cashier cheques - inter server currency #140

Open jpcsupplies opened 8 years ago

jpcsupplies commented 8 years ago

Was just pondering ways a player could if i implemented transport hub; take money with them to other servers.

Instead of everything going with them - how about a "cashiers cheque" instead, ie small fixed amounts of money.

Here is what i have come up with - current assumptions 1: Key point of transport hub is that you have a set of fixed destinations 2: Each player has a unique steam ID 3: players are the transport mechanism 4: codes only work on authorised destinations

ie - Step 1, admin creates a list of servers for his transport hub - the IP of these is used to generate a unique ID Step 2, the player selects how much money they wish to covert into a "cashier cheque" Step 3, this players steam ID combined with the destination server unique ID, combined with the amount of money is used to generate a special code. Step 4: this code is given to the player, which they write down, or copy into clipboard Step 5: the player uses the command to initiate connection to the authorised server (eg, like /debug does at the moment) Step 6: once connected to the authenticated server the player executes the command /redeem and then types or pastes their unique code. Step 7: the new server decodes the unique command and checks if their own server id, and the players steam ID match up. It then deposits the funds in the players account on that server, and marks that code as redeemed. We could have the extra step of including the originating server ID - and if it is not in the authorized server list of the new server, the payment is rejected. This could be an admin selected option however.

Step 8: The admins have a command to check redeemed codes which they share with each other periodically to confirm nobody is cheating. In the case of the same admin running all the servers in the travel group this makes things even easier to check.

Footnotes:

jpcsupplies commented 8 years ago

Note to self.. Really crude encryption.. Method 1

  1. Convert data to encode to string
  2. Scan over the string and convert each character to ascii codes
  3. Assemble the ascii codes into a (possibly) very long integer.. probably need to break it up in to divisions of a smaller number
  4. * optional create a crc by totalling the combined total of each ascii code, add a padding code and append to end of message
  5. Perform multiplication (based on key) of resulting long integer
  6. reassemble integers
  7. convert back to ascii codes and give output to operator
  8. operator inputs code to target system
  9. convert back to ascii codes
  10. disassemble into smaller number divisions
  11. Perform divide (based on key) of resulting long integer
  12. * optional extract crc code and padding then check crc adds up
  13. disassemble ascii codes back to characters
  14. if it is a number convert back to decimal; apply to players bank balance

Method 2: remove balance convert to number as above, and break up as appropriate add crc tag multiply by players steamid, multiply by our passcode output to player

player inputs to target server divide by our passcode divide by our steamid check crc code adds up update balance

Method 3: RSA system... hmmmm http://doctrina.org/How-RSA-Works-With-Examples.html

C# methods for going to from ascii http://stackoverflow.com/questions/5348844/how-to-convert-a-string-to-ascii http://stackoverflow.com/questions/17730706/how-to-convert-a-number-to-an-ascii-character http://www.dotnetperls.com/convert-string-byte-array

DIV/MOD maths functions http://www.tutorialspoint.com/csharp/csharp_operators.htm