Bitcoin Forum
May 06, 2024, 08:01:31 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [ALPHA TESTING] SPX Wallet - Ethash cross-chain trading (15 coins)  (Read 164 times)
SphinxCoin (OP)
Newbie
*
Offline Offline

Activity: 83
Merit: 0


View Profile WWW
May 07, 2019, 10:41:10 PM
Last edit: May 13, 2019, 12:54:58 AM by SphinxCoin
 #1

This is the very early alpha test of my SPX-Wallet for digital assets trading. The idea is to provide a tool that can be used to trade any digital asset, but for now it only accommodates Ethash based coins, 15 of them to be exact:

  • Akroma (AKA)
  • Aura (ARA)
  • Atheios (ATH)
  • Bitcoiin (B2G)
  • Callisto (CLO)
  • DubaiCoin (DBIX)
  • EtherSocial (ESN)
  • Ethereum Classic (ETC)
  • Ether-1 (ETHO)
  • Expanse (EXP)
  • Musicoin (MUSIC)
  • Nilu (NILU)
  • Nekonium (NULO)
  • Pirl (PIRL)
  • Ubiq (UBQ)

The wallet is available as a precompiled APK file to download (Android only for now), the source code will be published later on as soon as I setup the git node on the server ... the wallet will be open source, and so will be all parts of the project.

The wallet is part of my latest attempt at building a useful blockchain system that can add new services to the community. The wallet will provide right now the following functions:

  • Direct transfer for any of the 15 assets listed above, this has the same functions like using any web-based wallet where you hold the keys for your asset (public and private) but still use a remote RPC node to execute your transactions
  • Trading of assets, any from the above listed 15 assets, where you can place a market order for the asset and the amount you want to trade, and the asset and amount you want in return, and the backend server handles the matching and execution of your trade when matched. Right now Market Orders are limited to what I call "Private" orders, in which you set the counter-party of your trade so the order is locked to only that person. In other words, if you want to trade lets say 5 AKA for 15 ATH, and a friend wants to trade you that, so the market order provides you with the place to execute such a transaction, where you will make your order with 5 AKA for 15 ATH and set your friends AKA address in the order, and then your friend makes his order with 15 ATH for 5 AKA and sets your ATH address in the order the system will make the trade / swap for you

Now, how does that work, when you make an order, your order amount is transferred to a temp address and locked there for until the counter party makes its order. Once both sides have their order amounts locked, the system then releases the amounts to each side. The is a 0.1% commission fee on these orders (that's 1 in 1000 of the amount). Also when making a Market Order, the system checks for the current going network fee for the asset that you are placing the order on and locks 4x that value while the order is being processed. The reason that this is done is to cover the network fees for both the actual transfer of assets to your destination, and for the commission fee payment. In theory that should only be 2x the network fees, but as these fees tend to move a bit up and down, so even at 3x the fees held back, still it can happen that funds turn out to be too low to execute the required transactions. In the end, any remaining assets still remain in the temp address after both transactions are made, they are then returned to the originating address (your address), which I call the "dust" transaction.

The market order takes the following steps to execute:

  • You place your order
  • Your assets are transferred to a temp address and locked there waiting for their match
  • Once a match is located, assets are released to both parties
  • Once the swap is completed, then the commission fees are paid
  • After that, the temp account is checked to see if any assets still remain in it, and if so they are returned to the originating address

It is very important to understand that right now ONLY private orders are working, that is the orders that have a fixed destination address set in them, I have yet to complete the matching process for the "public" orders where you can place an order for anyone to grab. So what I do right now to test the system is that I make the orders from and to myself between two different assets.

The wallet has sort of a new feature that is not present in many of the other wallets out there is that it contains a contacts section. Now when you register your account and add the assets you want to use to the wallet, you should go to the "Profile" section and press the "Sync Account" button. This will sync your account with the server, sending your asset's public keys (wallet address), so you and anybody else can use your "Account name" to easily make transfers. All you have to do is press the "contacts" icon in the send assets section or the market order section, select the name of the person your want to send to, and the wallet automatically fetches their public key (wallet address) and sets it in the order form for you (it will be more apparent once you see it in the app).

Now to register your account:

  • In the login screen, press the "SWITCH TO REGISTER" button
  • select a username, this will be your handle in the system and the name that everybody will see in the contacts list
  • set your password, AND THIS IS VERY IMPORTANT, your password is used to encrypt your private keys on the phone's storage, and the password is not saved anywhere, not on your phone, and not on the backend server, and not anywhere, so if you lose it, right now there is no way to recover the private keys at all (there isn't a backup function yet implemented), but you can always screenshot the private keys from within the assets sections to keep a backup of them

Once you register, you will be taken back to the login screen, login with your password, and then go to the Assets section. To add assets (create your own key pairs for each asset) just press the plus "+" sign in the upper right corner, select the asset, and click "GENERATE". Both public and private keys will be generated for you (you can take a screen shot of this screen to backup your private key to use anywhere - like myetherwallet for example). You can then add funds to your assets by transferring normally to your new wallet address. Each asset can only have one address.

To check your balance, the assets page has a pull option (pull the page down to check for balance updates), and to send out assets:

  • click on any of the assets you have, then click on the "Send" button at the bottom
  • select the asset you want to send from (only assets with balance will show up, so make sure that you have updated the balance before trying to send)
  • your balance will show up and so will the current network fees for that asset (note that these transactions there are no commission fees on them, they are normal "same-asset" transfers like doing them using any web wallet
  • you can then:
    • type in the recipient address, or
    • scan a q-code using the "q-code" button at the top right, or
    • select a contact from the other registered contacts on the system using the "contacts" button also on the top right corner
  • type in the amount you want to send, or press "SEND ALL" to send all your balance
  • and click "SEND"

once the transaction is executed, the transaction hash will be displayed.

To make a Market order:

  • go to the Market section and click the add "+" button at the upper right corner
  • select the originating asset you want to trade and add the amount you are offering to trade
  • select the destination asset you want to receive and the amount you want to get
  • set the recipient address - and THIS IS VERY IMPORTANT - either again by typing the address, scanning the q-code, or selecting from the contacts
  • click the "CREATE ORDER" button

You will see some messages showing you the status of your order submission which are:

  • The balance of your originating asset to see if there is enough funds
  • The amount set is then transferred to its locking address
  • Then you will get a result showing all the order details, including the address of the locking wallet and the transaction hash for the transfer, which you could then check using that asset's explorer on the web (that has to be done manually for now, later this will be added into the wallet)

Once the order is submitted, press the back arrow "<-" button at the top left corner to go back to the market screen, and refresh the page by again pulling the page down. Now every order goes through many stages and each has its own status:

  • 10: Order is submitted but funds have not reached the temp locking address yet
  • 12: Funds have reached the temp wallet
  • 20: Match has been found for the order
  • 21: Match process is initiated, i.e. funds are being sent to both parties
  • 22: Match is completed, i.e. transaction has reached a block on the asset's network
  • 31: Fees are being issued
  • 32: Fees issuance is completed
  • 41: Checking if temp wallet has dust in it, and if so then initiate refund to originating wallet
  • 42: Dust issuance is completed
  • 50: Order is completed and ready to be moved to SPX blockchain (will explain in a bit)

In reality, both sender and receiver get their funds at the "22" status, yet the order remains open to complete the remaining stages of issuing commission fees and returning dust.

Now this entire system is actually built on a blockchain system that I developed to accommodate the trading of any digital asset. This blockchain is written (and still is being written) from scratch. Unlike traditional blockchains, this has a bit different structure to encapsulate the assets transactions with its blocks, and since the assets will come from different chain (even though right now they are all ethash based assets, the objective is to include all digital assets that can be accessed via API and RPC), the structure of the order is a bit different, and so is the structure of the transaction, and so of the block.

Here is a sample of how an order looks like (I will explain the structure in details in the whitepaper):

Code:
        {
          "id": "002cb440-6dc7-11e9-86a4-95ac509c07db",
          "outputs": {},
          "orders": {
            "order": {
              "id": "634d6700-6dc6-11e9-86a4-95ac509c07db",
              "spxId": "0416e301e53723a00ebf1b88349a9f42dd3bff136aaf62d8b9183beb101eb5d1adf685a4a4a8c606e4ad4e885712c2d1e1ca2ac8fede9ec3f6",
              "spxSig": "303d021c65224bc472e9cdf1dbcc7c02e478d00c94c6a1b29dbce366d954a992021d00db064bdc59f0d86bfb5d2c883cd82aeabf3b8a299150c8593e4b92b3",
              "headerTrx": {
                "timestamp": 1556903444853,
                "nodeHash": "5597aacbce4d635a2514e4a69d1c64066e749602b424ad14acf3d450c4ec1da1",
                "balanceKey": "0494bd924864527aa4e4b55e3eb8767aa033c549a0ba6a941d595b0eb6e24e6e275c6e8143ba36ac9dd37efc510771c2103c98a3d3358db579",
                "publicKey": "04d76a4a53d586d2cc5e7df2348100b0a105efe0be1702b7f5f9d85a16fe0ac1f08c1c17c29c600c36fe10b4b542d4f611a3006b9e7c03220a",
                "orderHash": "38477d93c8044263c95bbeb3c9efbcaa93ebf338198cd6009fa2e37bd16cb444",
                "privateHash": "f711b52d3f21127e90e8d27d6761af81bc1b482e37187d3a47fcf731127cc7c4",
                "orderSignature": "303d021d00d214fffdcc843aee673920fd221c685c88b4ceaac1c23ade5e2f4ebc021c1cb5595d504850ddd7fc695bb005a9b3e14a4f361df3600462dbc0bd",
                "notes": "",
                "orderStatus": 50,
                "laststamp": 1556903687959
              },
              "originTrx": {
                "symbol": "AKA",
                "fromAddress": "0x1ffF87c4bd0d18e6E7C77B794Df72Dd553DC9e48",
                "toAddress": "0x1ffF87c4bd0d18e6E7C77B794Df72Dd553DC9e48",
                "amount": 1,
                "trxHash": "0xcca83eb0b092216abc6bc427a5f31c6967dd3d371c9415f0829c5cf778bd6754",
                "blockId": 3115037,
                "timestamp": 1556903594166
              },
              "destTrx": {
                "symbol": "ESN",
                "address": "0xe6d3B62F54D01B0f6F70267018A4B6304ED108C2",
                "amount": 1,
                "orderHash": "18b096237bad2140b8ed7dd0ab8a3350303dfc0a0f3f7124fc935f69def4e3c8"
              },
              "isTrx": {
                "address": "0xeDCc062e442681A816a4E7810858fe059420c05C",
                "amount": 1.002764,
                "fees": 0.001764,
                "trxHash": "0xced66e1dd76d664574560e995125e7ff480c0ecf47c80e1de46e0131241d4986",
                "blockId": 3115030,
                "timestamp": 1556903500985
              },
              "feeTrx": {
                "address": "0x6c07418b1181bF05D1fcC2679971a23d38E9faAF",
                "amount": 0.001,
                "trxHash": "0xd46f4e072f438646cc8b789bdef217bcee91def01adc4fe8ea3fd4952582d5e7",
                "blockId": 3115039,
                "timestamp": 1556903625346
              },
              "dustTrx": {
                "amount": 0.000441,
                "trxHash": "0xf70be41d8d09d81e9d23712c42c9d2dc236548aabb2cbf1900011127ef3ed1c0",
                "blockId": 3115045,
                "timestamp": 1556903657407
              }
            }
          }

and here is how a block looks like (again detailed explanation for it will be in the white paper):

Code:
    {
      "blockId": 20,
      "timestamp": 1557096862,
      "prevHash": "001190a615684dcd1ab825084a0e57528c83768dd56d1deca016189bb4ea16c5",
      "hash": "0017d7032e5c9b71cdeda81bb4c5fc66ac158f0d5ff2ec0516e91f867f6a46ae",
      "nonce": 1852,
      "difficulty": 11,
      "data": [
        {
          "id": "a7382220-6f88-11e9-8594-5783d4e4c961",
          "outputs": {},
          "orders": {
            "order": {
              "id": "a17331a0-6f87-11e9-8f11-576422446ca7",
              "spxId": "04d16d1c120761fb2533c9461579cc6e1e8a45a4d461d206a24456a34e8880f6032712869a78d35efb502d6227f1b7ac38f894256a53f41343",
              "spxSig": "303e021d00eaaea8c3f64e1857e0a0946111c0ef19dc9546293543e5acc71dfc6b021d00b747177fa31b3cb5f7c2547cf45530aef9ec5a1e127b921824e5a415",
              "headerTrx": {
                "timestamp": 1557096393,
                "nodeHash": "5597aacbce4d635a2514e4a69d1c64066e749602b424ad14acf3d450c4ec1da1",
                "balanceKey": "0494bd924864527aa4e4b55e3eb8767aa033c549a0ba6a941d595b0eb6e24e6e275c6e8143ba36ac9dd37efc510771c2103c98a3d3358db579",
                "publicKey": "04d76a4a53d586d2cc5e7df2348100b0a105efe0be1702b7f5f9d85a16fe0ac1f08c1c17c29c600c36fe10b4b542d4f611a3006b9e7c03220a",
                "orderHash": "316a6e445fec7f87954489968b468503dd6adb5b3d1a07d817a1fd318cc3bbbf",
                "privateHash": "47d1cf588a483ad47b860577d47b0b3d8f040e9e4c0b0d202aa3f1725558f330",
                "orderSignature": "303d021d00e10dc22271e53a176f48eb79e46f4cdc8f2b9059f9774f307b00f537021c65962d45059c8d76963f9185f62ec5921e41111383d555a12d53fd04",
                "notes": "",
                "orderStatus": 50,
                "laststamp": 1557096802
              },
              "originTrx": {
                "symbol": "AKA",
                "fromAddress": "0xCeEf853dAE9e8ceF63bCc8F0d724AA0036c4c123",
                "toAddress": "0x1ffF87c4bd0d18e6E7C77B794Df72Dd553DC9e48",
                "amount": 5,
                "trxHash": "0xbfcba28e9e9495c9fff1cc44386c91c0c4358da57788744ffeca11de56b7039e",
                "blockId": 3129686,
                "timestamp": 1557096485
              },
              "destTrx": {
                "symbol": "ESN",
                "address": "0x765F614B4cEa61D49Dd5831D5daC998Ef0150873",
                "amount": 5,
                "orderHash": "5b0779af2f5f7c045d696d8d99a6a23b87c488c3c60600c0651326cef5321581"
              },
              "isTrx": {
                "address": "0xeDCc062e442681A816a4E7810858fe059420c05C",
                "amount": 5.00668,
                "fees": 0.00168,
                "trxHash": "0x25335d354ab2193edd329c35e93d74d72c0aec06f98e485da7581e0b436b3864",
                "blockId": 3129682,
                "timestamp": 1557096422
              },
              "feeTrx": {
                "address": "0x6c07418b1181bF05D1fcC2679971a23d38E9faAF",
                "amount": 0.005,
                "trxHash": "0xc7d261a0b352807f1e7ff1c3da84dc211097e6662c3f11e702a059b8dfeb914e",
                "blockId": 3129694,
                "timestamp": 1557096518
              },
              "dustTrx": {
                "amount": 0.00042,
                "trxHash": "0xf5b3fadb57a3a1c6cc97f0ac798f407494ac8d245c66f87e93afe77a3b0e8b26",
                "blockId": 3129696,
                "timestamp": 1557096583
              }
            }
          },
          "input": {
            "timestamp": 1557096832,
            "hash": "3e71c5c4a4ab3ae3c45e2e6ff6efcef93dc5a1750576ee4c4ed9135eac719f43",
            "balanceKey": "0494bd924864527aa4e4b55e3eb8767aa033c549a0ba6a941d595b0eb6e24e6e275c6e8143ba36ac9dd37efc510771c2103c98a3d3358db579",
            "balance": 200000023,
            "nodeKey": "04d76a4a53d586d2cc5e7df2348100b0a105efe0be1702b7f5f9d85a16fe0ac1f08c1c17c29c600c36fe10b4b542d4f611a3006b9e7c03220a",
            "signature": "303e021d00c6768fc238090a64821b60015bf6d942729894b7362923cfd35d58f6021d00d75b4b7bcbc53fe36a082e4f70781604f6a2ee21cd3c464f496cbea9"
          }
        },
        {
          "id": "a739f6e0-6f88-11e9-8594-5783d4e4c961",
          "outputs": {
            "0494bd924864527aa4e4b55e3eb8767aa033c549a0ba6a941d595b0eb6e24e6e275c6e8143ba36ac9dd37efc510771c2103c98a3d3358db579": 1
          },
          "orders": {},
          "input": {
            "timestamp": 1557096832,
            "hash": "5ccc26f6e77cbfc7d92fb13be0b6bb50cef657c5686d1382a0373c129b08eef6",
            "balanceKey": "reward",
            "balance": 0,
            "nodeKey": "reward",
            "signature": ""
          }
        },
        {
          "id": "a73a1df0-6f88-11e9-8594-5783d4e4c961",
          "outputs": {
            "04d16d1c120761fb2533c9461579cc6e1e8a45a4d461d206a24456a34e8880f6032712869a78d35efb502d6227f1b7ac38f894256a53f41343": 1
          },
          "orders": {},
          "input": {
            "timestamp": 1557096832,
            "hash": "47340d3d5e419a20d402af2d26cb18dea32f58ae0f464ce654ae2003adc85e43",
            "balanceKey": "reward",
            "balance": 0,
            "nodeKey": "reward",
            "signature": ""
          }
        }
      ]
    }


Now all of this is running on what I call the SphinxChain and using what I call the SPX-ID (which is basically your public key on the SPX blockchain) and I also call it SPX-Token since it will hold your SPX-T assets. You get (for now) 1 SPX token with every completed market order.

It is important to understand:

  • This is an alpha release and I'm putting it out there now just to test it, so please:
    • use it very carefully
    • do not put a lot of funds in it (even though things are working, still I am still testing it)
  • right now I'm testing using a very modest server and have not tested it for heavy loads, so things could be a bit slow at some points
  • all 15 assets running, I am running my own nodes for them to make sure that the wallets can reach their respective nodes (public RPC nodes could be a bit unstable, although I am planning to make it an option to use them later on, so users can set their own RPC nodes to use for their assets)
  • again .... this is ALPHA stage ... go easy please Smiley


Well ... that's a lot of words with no images or anything ... so if you made it that far ... give it a try and let me know what you think!

BTW: this is where it all started:

SPX10

SPXED

This is the history of this project, going from the ethash PoA based coin (SPX10) to the decentralized exchange (SPXED) to this here. In reality all these other projects will come together as part of the SphinxChain eco-system, but I am working on my own (which I don't mind) but things tend to take their own pace !!!

The Discord channel could be found here.

Hope you like and enjoy and find this useful !!!



Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!