Browse Source

Merge pull request #542 from jl777/spvdex

2.7x compression, new coins
etomic
jl777 7 years ago
committed by GitHub
parent
commit
a2def7aabb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      iguana/coins/axo_7776
  2. 2
      iguana/coins/basilisk/axo
  3. 1
      iguana/coins/basilisk/btch
  4. 2
      iguana/coins/basilisk/etomic
  5. 2
      iguana/coins/btch_7776
  6. 2
      iguana/coins/etomic_7776
  7. 18
      iguana/exchanges/LP_bitcoin.c
  8. 2
      iguana/exchanges/LP_include.h
  9. 695
      iguana/exchanges/LP_mmjson.c
  10. 125
      iguana/exchanges/LP_nativeDEX.c
  11. 2
      iguana/exchanges/LP_network.c
  12. 9
      iguana/exchanges/LP_rpc.c
  13. 2
      iguana/exchanges/coins
  14. 54
      iguana/exchanges/mm.c
  15. 2
      iguana/iguana_notary.c
  16. 3
      iguana/m_notary_run

2
iguana/coins/axo_7776

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"AXO.conf\",\"path\":\"${HOME#"/"}/.komodo/AXO\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"AXO\",\"name\":\"AXO\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"ba009d17\",\"p2p\":12926,\"rpc\":12927,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}"

2
iguana/coins/basilisk/axo

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"AXO.conf\",\"path\":\"${HOME#"/"}/.komodo/AXO\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"AXO\",\"name\":\"AXO\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"ba009d17\",\"p2p\":12926,\"rpc\":12927,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}"

1
iguana/coins/basilisk/btch

@ -0,0 +1 @@
curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"BTCH.conf\",\"path\":\"${HOME#"/"}/.komodo/BTCH\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCH\",\"name\":\"BTCH\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"b0ed1968\",\"p2p\":10160,\"rpc\":10161,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}"

2
iguana/coins/basilisk/etomic

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7778" --data "{\"conf\":\"ETOMIC.conf\",\"path\":\"${HOME#"/"}/.komodo/ETOMIC\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":0,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"ETOMIC\",\"name\":\"ETOMIC\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"072a90e8\",\"p2p\":10270,\"rpc\":10271,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}"

2
iguana/coins/btch_7776

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"BTCH.conf\",\"path\":\"${HOME#"/"}/.komodo/BTCH\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"BTCH\",\"name\":\"BTCH\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"b0ed1968\",\"p2p\":10160,\"rpc\":10161,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}"

2
iguana/coins/etomic_7776

@ -0,0 +1,2 @@
curl --url "http://127.0.0.1:7776" --data "{\"conf\":\"ETOMIC.conf\",\"path\":\"${HOME#"/"}/.komodo/ETOMIC\",\"unitval\":\"20\",\"zcash\":1,\"RELAY\":-1,\"VALIDATE\":0,\"prefetchlag\":-1,\"poll\":100,\"active\":1,\"agent\":\"iguana\",\"method\":\"addcoin\",\"startpend\":4,\"endpend\":4,\"services\":129,\"maxpeers\":8,\"newcoin\":\"ETOMIC\",\"name\":\"ETOMIC\",\"hasheaders\":1,\"useaddmultisig\":0,\"netmagic\":\"072a90e8\",\"p2p\":10270,\"rpc\":10271,\"pubval\":60,\"p2shval\":85,\"wifval\":188,\"txfee_satoshis\":\"10000\",\"isPoS\":0,\"minoutput\":10000,\"minconfirms\":2,\"genesishash\":\"027e3758c3a65b12aa1046462b486d0a63bfa1beae327897f56c5cfb7daaae71\",\"protover\":170002,\"genesisblock\":\"0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a000000000000000000000000000000000000000000000000000000000000000029ab5f490f0f0f200b00000000000000000000000000000000000000000000000000000000000000fd4005000d5ba7cda5d473947263bf194285317179d2b0d307119c2e7cc4bd8ac456f0774bd52b0cd9249be9d40718b6397a4c7bbd8f2b3272fed2823cd2af4bd1632200ba4bf796727d6347b225f670f292343274cc35099466f5fb5f0cd1c105121b28213d15db2ed7bdba490b4cedc69742a57b7c25af24485e523aadbb77a0144fc76f79ef73bd8530d42b9f3b9bed1c135ad1fe152923fafe98f95f76f1615e64c4abb1137f4c31b218ba2782bc15534788dda2cc08a0ee2987c8b27ff41bd4e31cd5fb5643dfe862c9a02ca9f90c8c51a6671d681d04ad47e4b53b1518d4befafefe8cadfb912f3d03051b1efbf1dfe37b56e93a741d8dfd80d576ca250bee55fab1311fc7b3255977558cdda6f7d6f875306e43a14413facdaed2f46093e0ef1e8f8a963e1632dcbeebd8e49fd16b57d49b08f9762de89157c65233f60c8e38a1f503a48c555f8ec45dedecd574a37601323c27be597b956343107f8bd80f3a925afaf30811df83c402116bb9c1e5231c70fff899a7c82f73c902ba54da53cc459b7bf1113db65cc8f6914d3618560ea69abd13658fa7b6af92d374d6eca9529f8bd565166e4fcbf2a8dfb3c9b69539d4d2ee2e9321b85b331925df195915f2757637c2805e1d4131e1ad9ef9bc1bb1c732d8dba4738716d351ab30c996c8657bab39567ee3b29c6d054b711495c0d52e1cd5d8e55b4f0f0325b97369280755b46a02afd54be4ddd9f77c22272b8bbb17ff5118fedbae2564524e797bd28b5f74f7079d532ccc059807989f94d267f47e724b3f1ecfe00ec9e6541c961080d8891251b84b4480bc292f6a180bea089fef5bbda56e1e41390d7c0e85ba0ef530f7177413481a226465a36ef6afe1e2bca69d2078712b3912bba1a99b1fbff0d355d6ffe726d2bb6fbc103c4ac5756e5bee6e47e17424ebcbf1b63d8cb90ce2e40198b4f4198689daea254307e52a25562f4c1455340f0ffeb10f9d8e914775e37d0edca019fb1b9c6ef81255ed86bc51c5391e0591480f66e2d88c5f4fd7277697968656a9b113ab97f874fdd5f2465e5559533e01ba13ef4a8f7a21d02c30c8ded68e8c54603ab9c8084ef6d9eb4e92c75b078539e2ae786ebab6dab73a09e0aa9ac575bcefb29e930ae656e58bcb513f7e3c17e079dce4f05b5dbc18c2a872b22509740ebe6a3903e00ad1abc55076441862643f93606e3dc35e8d9f2caef3ee6be14d513b2e062b21d0061de3bd56881713a1a5c17f5ace05e1ec09da53f99442df175a49bd154aa96e4949decd52fed79ccf7ccbce32941419c314e374e4a396ac553e17b5340336a1a25c22f9e42a243ba5404450b650acfc826a6e432971ace776e15719515e1634ceb9a4a35061b668c74998d3dfb5827f6238ec015377e6f9c94f38108768cf6e5c8b132e0303fb5a200368f845ad9d46343035a6ff94031df8d8309415bb3f6cd5ede9c135fdabcc030599858d803c0f85be7661c88984d88faa3d26fb0e9aac0056a53f1b5d0baed713c853c4a2726869a0a124a8a5bbc0fc0ef80c8ae4cb53636aa02503b86a1eb9836fcc259823e2692d921d88e1ffc1e6cb2bde43939ceb3f32a611686f539f8f7c9f0bf00381f743607d40960f06d347d1cd8ac8a51969c25e37150efdf7aa4c2037a2fd0516fb444525ab157a0ed0a7412b2fa69b217fe397263153782c0f64351fbdf2678fa0dc8569912dcd8e3ccad38f34f23bbbce14c6a26ac24911b308b82c7e43062d180baeac4ba7153858365c72c63dcf5f6a5b08070b730adb017aeae925b7d0439979e2679f45ed2f25a7edcfd2fb77a8794630285ccb0a071f5cce410b46dbf9750b0354aae8b65574501cc69efb5b6a43444074fee116641bb29da56c2b4a7f456991fc92b2\",\"debug\":0,\"seedipaddr\":\"78.47.196.146\"}"

18
iguana/exchanges/LP_bitcoin.c

@ -2196,8 +2196,18 @@ int32_t bitcoin_wif2addr(void *ctx,uint8_t wiftaddr,uint8_t taddr,uint8_t pubtyp
int32_t bitcoin_priv2wif(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8_t addrtype)
{
uint8_t data[128]; int32_t offset,len = 32;
offset = 1 + (wiftaddr != 0);
memcpy(data+offset,privkey.bytes,sizeof(privkey));
if ( wiftaddr != 0 )
{
//data[0] = wiftaddr;
//data[1] = addrtype;
offset = 2;
}
else
{
//data[0] = addrtype;
offset = 1;
}
memcpy(data+offset,privkey.bytes,len);
data[offset + len++] = 1;
len = base58encode_checkbuf(wiftaddr,addrtype,data,len);
if ( bitcoin_base58encode(wifstr,data,len) == 0 )
@ -2205,7 +2215,7 @@ int32_t bitcoin_priv2wif(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8_t a
char str[65]; printf("error making wif from %s\n",bits256_str(str,privkey));
return(-1);
}
if ( 1 )
if ( 0 )
{
uint8_t checktype; bits256 checkpriv; char str[65],str2[65];
if ( bitcoin_wif2priv(wiftaddr,&checktype,&checkpriv,wifstr) == sizeof(bits256) )
@ -2225,7 +2235,7 @@ int32_t bitcoin_priv2wiflong(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8
len = base58encode_checkbuf(wiftaddr,addrtype,data,len);
if ( bitcoin_base58encode(wifstr,data,len) == 0 )
return(-1);
if ( 1 )
if ( 0 )
{
uint8_t checktype; bits256 checkpriv; char str[65],str2[65];
if ( bitcoin_wif2priv(wiftaddr,&checktype,&checkpriv,wifstr) == sizeof(bits256) )

2
iguana/exchanges/LP_include.h

@ -29,7 +29,7 @@ voind dontprintf(char *formatstr,...) {}
#define LP_MAJOR_VERSION "0"
#define LP_MINOR_VERSION "1"
#define LP_BUILD_NUMBER "17742"
#define LP_BUILD_NUMBER "17752"
#define LP_BARTERDEX_VERSION 1
#define LP_MAGICBITS 1

695
iguana/exchanges/LP_mmjson.c

@ -0,0 +1,695 @@
/******************************************************************************
* Copyright © 2014-2017 The SuperNET Developers. *
* *
* See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at *
* the top-level directory of this distribution for the individual copyright *
* holder information and the developer policies on copyright and licensing. *
* *
* Unless otherwise agreed in a custom licensing agreement, no part of the *
* SuperNET software, including this file may be copied, modified, propagated *
* or distributed except according to the terms contained in the LICENSE file *
* *
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
//
// LP_mmjson.c
// marketmaker
//
#define MMJSON_IPADDR 255
#define MMJSON_BITS256 254
#define MMJSON_SECP33 253
#define MMJSON_SIG 252
#define MMJSON_RMD160 251
#define MMJSON_DECIMAL8 250
#define MMJSON_DECIMAL8STR 249
#define MMJSON_DECIMAL16 248
#define MMJSON_DECIMAL16STR 247
#define MMJSON_DECIMAL24 246
#define MMJSON_DECIMAL24STR 245
#define MMJSON_DECIMAL32 244
#define MMJSON_DECIMAL32STR 243
#define MMJSON_DECIMAL40 242
#define MMJSON_DECIMAL40STR 241
#define MMJSON_DECIMAL48 240
#define MMJSON_DECIMAL48STR 239
#define MMJSON_DOUBLE 238
#define MMJSON_DECIMAL64 237
#define MMJSON_DECIMAL64STR 236
#define MMJSON_TIMESTAMP 235
#define MMJSON_TIMEDIFF8 234
#define MMJSON_TIMEDIFF16 233
#define MMJSON_ZERO 232
#define MMJSON_ZEROSTR 231
#define MMJSON_COIN 230
#define MMJSON_STRING 229
#define MMJSON_ARRAY8 228
#define MMJSON_ARRAY16 227
#define MMJSON_ARRAY32 226
#define MMJSON_BOUNDARY 98
int32_t MM_numfields;
char *MM_fields[256] =
{
"timestamp", "getdPoW", "dPoW", "aliceid", "src", "base", "basevol", "dest", "rel", "relvol", "price", "requestid", "quoteid", "finished", "expired", "bobdeposit", "alicepayment", "bobpayment", "paymentspent", "Apaymentspent", "depositspent", "ind", "method", "swapstatus", "method2", "gettradestatus", "coin", "rmd160", "pub", "pubsecp", "sig", "session", "notify", "pubkey", "price64", "credits", "utxocoin", "n", "bal", "min", "max", "postprice", "notarized", "notarizedhash", "notarizationtxid", "wantnotify", "isLP", "gui", "nogui", "tradeid", "address", "txid", "vout", "srchash", "txfee", "quotetime", "satoshis", "desthash", "txid2", "vout2", "destaddr", "desttxid", "destvout", "feetxid", "feevout", "desttxfee", "destsatoshis", "pending", "reserved", "broadcast", "ismine", "simplegui", "request", "proof", "connect", "expiration", "iambob", "Bgui", "", "Agui", "bob", "srcamount", "bobtxfee", "alice", "destamount", "alicetxfee", "sentflags", "values", "result", "success", "status", "finishtime", "tradestatus", "pair", "connected", "warning", "critical", "endcritical",
};
char *MM_coins[256] =
{
"KMD", "BTC", "CRC", "VOT", "INN", "MOON", "CRW", "EFL", "GBX", "BCO", "BLK", "BTG", "BCH", "ABY", "STAK", "XZC", "QTUM", "PURA", "DSR", "MNZ", "BTCZ", "MAGA", "BSD", "IOP", "BLOCK", "CHIPS", "888", "ARG", "GLT", "ZER", "HODLC", "UIS", "HUC", "PIVX", "BDL", "ARC", "ZCL", "VIA", "ERC", "FAIR", "FLO", "SXC", "CREA", "TRC", "BTA", "SMC", "NMC", "NAV", "EMC2", "SYS", "I0C", "DASH", "STRAT", "MUE", "MONA", "XMY", "MAC", "BTX", "XRE", "LBC", "SIB", "VTC", "REVS", "JUMBLR", "DOGE", "HUSH", "ZEC", "DGB", "ZET", "GAME", "LTC", "SUPERNET", "WLC", "PANGEA", "DEX", "BET", "CRYPTO", "HODL", "MSHARK", "BOTS", "MGW", "COQUI", "KV", "CEAL", "MESH",
};
int32_t mmjson_coinfind(char *symbol)
{
int32_t i;
for (i=0; i<sizeof(MM_coins)/sizeof(*MM_coins); i++)
{
if ( MM_coins[i] == 0 )
return(-1);
if ( strcmp(MM_coins[i],symbol) == 0 )
return(i);
}
return(-1);
};
int32_t mmadd(char *field)
{
MM_fields[MM_numfields] = calloc(1,strlen(field)+1);
strcpy(MM_fields[MM_numfields],field);
return(MM_numfields++);
}
int32_t mmfind(char *field)
{
int32_t i;
if ( MM_numfields == 0 )
{
for (i=0; i<sizeof(MM_fields)/sizeof(*MM_fields); i++)
if ( MM_fields[i] == 0 )
break;
MM_numfields = i;
}
for (i=0; i<MM_numfields; i++)
{
if ( strcmp(MM_fields[i],field) == 0 )
return(i);
}
return(-1);
}
int32_t MMJSON_rwnum(int32_t rwflag,uint8_t *buf,uint64_t *longp,int32_t n)
{
int32_t i; uint64_t l = 0;
if ( rwflag != 0 )
{
l = *longp;
for (i=0; i<n; i++)
{
buf[i] = (uint8_t)l;
l >>= 8;
}
}
else
{
for (i=n-1; i>=0; i--)
{
l <<= 8;
l |= buf[i];
}
*longp = l;
}
return(n);
}
int32_t MMJSON_decodeitem(cJSON *lineobj,uint8_t *linebuf,int32_t i,int32_t len,int32_t ind,uint32_t *timestampp)
{
int32_t c,valind,j; char tmpstr[64],ipaddr[64],hexstr[256],arbstr[8192]; uint64_t l;
switch ( (valind= linebuf[i++]) )
{
case MMJSON_IPADDR:
i += MMJSON_rwnum(0,&linebuf[i],&l,4);
expand_ipbits(ipaddr,(uint32_t)l);
jaddstr(lineobj,MM_fields[ind],ipaddr);
break;
case MMJSON_BITS256:
init_hexbytes_noT(hexstr,&linebuf[i],32);
i += 32;
jaddstr(lineobj,MM_fields[ind],hexstr);
break;
case MMJSON_SECP33:
init_hexbytes_noT(hexstr,&linebuf[i],33);
i += 33;
jaddstr(lineobj,MM_fields[ind],hexstr);
break;
case MMJSON_SIG:
init_hexbytes_noT(hexstr,&linebuf[i],65);
i += 65;
jaddstr(lineobj,MM_fields[ind],hexstr);
break;
case MMJSON_RMD160:
init_hexbytes_noT(hexstr,&linebuf[i],20);
i += 20;
jaddstr(lineobj,MM_fields[ind],hexstr);
break;
case MMJSON_DECIMAL8:
l = linebuf[i++];
jaddnum(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL8STR:
l = linebuf[i++];
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL16:
i += MMJSON_rwnum(0,&linebuf[i],&l,2);
jaddnum(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL16STR:
i += MMJSON_rwnum(0,&linebuf[i],&l,2);
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL24:
i += MMJSON_rwnum(0,&linebuf[i],&l,3);
jaddnum(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL24STR:
i += MMJSON_rwnum(0,&linebuf[i],&l,3);
sprintf(tmpstr,"%llu",(long long)l);
jaddstr(lineobj,MM_fields[ind],tmpstr);
break;
case MMJSON_DECIMAL32:
i += MMJSON_rwnum(0,&linebuf[i],&l,4);
//printf("decimal32.%u %08x\n",(uint32_t)l,(uint32_t)l);
jaddnum(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL32STR:
i += MMJSON_rwnum(0,&linebuf[i],&l,4);
//printf("decimal32.%u %08x\n",(uint32_t)l,(uint32_t)l);
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL40:
i += MMJSON_rwnum(0,&linebuf[i],&l,5);
jaddnum(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL40STR:
i += MMJSON_rwnum(0,&linebuf[i],&l,5);
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL48:
i += MMJSON_rwnum(0,&linebuf[i],&l,6);
jaddnum(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL48STR:
i += MMJSON_rwnum(0,&linebuf[i],&l,6);
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_DOUBLE:
i += MMJSON_rwnum(0,&linebuf[i],&l,8);
//printf("double %llu -> %.8f\n",(long long)l,dstr(l));
jaddnum(lineobj,MM_fields[ind],dstr(l));
break;
case MMJSON_DECIMAL64:
i += MMJSON_rwnum(0,&linebuf[i],&l,8);
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_DECIMAL64STR:
i += MMJSON_rwnum(0,&linebuf[i],&l,8);
jadd64bits(lineobj,MM_fields[ind],l);
break;
case MMJSON_TIMESTAMP:
if ( *timestampp == 0 )
{
i += MMJSON_rwnum(0,&linebuf[i],&l,4);
*timestampp = (uint32_t)l;
jaddnum(lineobj,MM_fields[ind],l);
}
else
{
printf("timestamp %u already exists\n",*timestampp);
free_json(lineobj);
return(-1);
}
break;
case MMJSON_TIMEDIFF8:
jaddnum(lineobj,MM_fields[ind],*timestampp + linebuf[i++]);
break;
case MMJSON_TIMEDIFF16:
i += MMJSON_rwnum(0,&linebuf[i],&l,2);
jaddnum(lineobj,MM_fields[ind],*timestampp + l);
break;
case MMJSON_ZERO:
jaddnum(lineobj,MM_fields[ind],0);
break;
case MMJSON_ZEROSTR:
//printf("%s.zerostr\n",MM_fields[ind]);
jadd64bits(lineobj,MM_fields[ind],0);
break;
case MMJSON_COIN:
jaddstr(lineobj,MM_fields[ind],MM_coins[linebuf[i++]]);
break;
case MMJSON_STRING:
j = 0;
while ( (c= linebuf[i++]) != 0 )
{
if ( i > len )
{
printf("string overflow i.%d vs len.%d\n",i,len);
free_json(lineobj);
return(-1);
}
arbstr[j++] = c;
}
arbstr[j] = 0;
jaddstr(lineobj,MM_fields[ind],arbstr);
break;
default:
if ( valind < MMJSON_BOUNDARY )
jaddstr(lineobj,MM_fields[ind],MM_fields[valind]);
else
{
printf("%s unhandled valind.%d k.%d len.%d (%s)\n",MM_fields[ind],valind,i,len,jprint(lineobj,0));
free_json(lineobj);
return(-1);
}
break;
}
return(i);
}
char *MMJSON_decode(uint8_t *linebuf,int32_t len)
{
uint32_t timestamp = 0; uint64_t l; int32_t ind,i=0,j,m=-1; cJSON *obj,*item,*array,*lineobj = cJSON_CreateObject();
while ( i+1 < len )
{
//printf("ind.%d i.%d vs len.%d\n",linebuf[i],i,len);
if ( (ind= linebuf[i++]) >= MMJSON_BOUNDARY )
{
printf("illegal field ind.%d (%s)\n",ind,jprint(lineobj,0));
free_json(lineobj);
return(0);
}
if ( linebuf[i] == MMJSON_ARRAY8 )
{
i++;
m = linebuf[i++];
}
else if ( linebuf[i] == MMJSON_ARRAY16 )
{
i++;
i += MMJSON_rwnum(0,&linebuf[i],&l,2);
m = (int32_t)l;
}
else if ( linebuf[i] == MMJSON_ARRAY32 )
{
i++;
i += MMJSON_rwnum(0,&linebuf[i],&l,4);
m = (int32_t)l;
} else m = -1;
if ( m >= 0 )
{
//printf("%s i.%d m.%d\n",MM_fields[ind],i,m);
array = cJSON_CreateArray();
for (j=0; j<m; j++)
{
item = cJSON_CreateObject();
if ( (i= MMJSON_decodeitem(item,linebuf,i,len,ind,&timestamp)) < 0 )
{
printf("error decoding item ind.%d (%s)\n",ind,jprint(lineobj,0));
free_json(array);
free_json(lineobj);
return(0);
}
obj = jobj(item,MM_fields[ind]);
jaddi(array,jduplicate(obj));
free_json(item);
}
jadd(lineobj,MM_fields[ind],array);
}
else if ( (i= MMJSON_decodeitem(lineobj,linebuf,i,len,ind,&timestamp)) < 0 )
{
printf("error decoding item ind.%d (%s)\n",ind,jprint(lineobj,0));
free_json(lineobj);
return(0);
}
//printf("i.%d/%d ind.%d %s valind.%d\n",i,len,ind,MM_fields[ind],linebuf[i]);
}
return(jprint(lineobj,1));
}
int32_t MMJSON_encodeval(uint8_t *linebuf,int32_t k,int32_t ind,char *v,uint32_t *timestampp,cJSON *ptr)
{
double val; char checkstr[512]; uint64_t l; int32_t valind,len,isstr,coinind,j,dots,diff;
if ( strcmp("utxocoin",MM_fields[ind]) == 0 || strcmp("alice",MM_fields[ind]) == 0 || strcmp("bob",MM_fields[ind]) == 0 || strcmp("base",MM_fields[ind]) == 0 || strcmp("rel",MM_fields[ind]) == 0 || strcmp("coin",MM_fields[ind]) == 0 || strcmp("txfee",MM_fields[ind]) == 0 || strcmp("desttxfee",MM_fields[ind]) == 0 || strcmp("price64",MM_fields[ind]) == 0 || strcmp("satoshis",MM_fields[ind]) == 0 || strcmp("destsatoshis",MM_fields[ind]) == 0 )
isstr = 1;
else isstr = 0;
//printf("%s.(%s) k.%d\n",MM_fields[ind],v,k);
if ( (valind= mmfind(v)) >= 0 )
{
linebuf[k++] = valind;
return(k);
}
else if ( strcmp("0",v) == 0 )
{
if ( isstr != 0 )
linebuf[k++] = MMJSON_ZEROSTR;
else linebuf[k++] = MMJSON_ZERO;
return(k);
}
for (j=dots=0; v[j]!=0; j++)
{
if ( (v[j] < '0' || v[j] > '9') && v[j] != '.' )
break;
else if ( v[j] == '.' )
dots++;
}
if ( dots == 3 && v[j] == 0 && strlen(v) < 17 && is_ipaddr(v) != 0 )
{
//printf("<ipaddr> ");
linebuf[k++] = MMJSON_IPADDR;
l = calc_ipbits(v);
k += MMJSON_rwnum(1,&linebuf[k],&l,4);
}
else if ( dots == 1 && v[j] == 0 )
{
if ( (val= atof(v)) > SMALLVAL )
{
l = SATOSHIDEN * (val + 0.000000005);
sprintf(checkstr,"%.8f",dstr(l));
if ( strcmp(checkstr,v) == 0 )
{
//printf("<double> ");
linebuf[k++] = MMJSON_DOUBLE;
k += MMJSON_rwnum(1,&linebuf[k],&l,8);
} else printf("ERR.<%s %s> ",v,checkstr);
}
}
else if ( (len= is_hexstr(v,0)) == 64 )
{
//printf("<bits256> ");
linebuf[k++] = MMJSON_BITS256;
decode_hex(&linebuf[k],32,v), k += 32;
}
else if ( len == 66 )
{
//printf("<secp33> ");
linebuf[k++] = MMJSON_SECP33;
decode_hex(&linebuf[k],33,v), k += 33;
}
else if ( len == 65*2 )
{
//printf("<sig> ");
linebuf[k++] = MMJSON_SIG;
decode_hex(&linebuf[k],65,v), k += 65;
}
else if ( len == 40 )
{
//printf("<rmd160> ");
linebuf[k++] = MMJSON_RMD160;
decode_hex(&linebuf[k],20,v), k += 20;
}
else if ( len > 40 )
{
printf("ERR.<hex.%d> ",len/2);
}
else if ( is_decimalstr(v) != 0 && (l= calc_nxt64bits(v)) > 0 )
{
if ( l < 0x100 )
{
//printf("<decimal8> ");
if ( l == 0 )
{
linebuf[k++] = isstr != 0 ? MMJSON_ZEROSTR : MMJSON_ZERO;
}
else
{
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL8STR : MMJSON_DECIMAL8;
linebuf[k++] = (uint8_t)l;
}
}
else if ( l < 0x10000 )
{
//printf("<decimal16> ");
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL16STR : MMJSON_DECIMAL16;
k += MMJSON_rwnum(1,&linebuf[k],&l,2);
}
else if ( l < 0x1000000 )
{
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL24STR : MMJSON_DECIMAL24;
//printf("decimal24 %llu %s (%s) %d\n",(long long)l,v,MM_fields[ind],linebuf[k-1]);
k += MMJSON_rwnum(1,&linebuf[k],&l,3);
}
else if ( l < 0x100000000LL )
{
if ( v[0] != '"' && *timestampp == 0 && strcmp(MM_fields[ind],"timestamp") == 0 )
{
*timestampp = (uint32_t)atol(v);
//printf("<timestamp> ");
linebuf[k++] = MMJSON_TIMESTAMP;
l = *timestampp;
k += MMJSON_rwnum(1,&linebuf[k],&l,4);
}
else if ( v[0] != '"' && *timestampp != 0 && (diff= ((uint32_t)atol(v)-*timestampp)) < 0x100 && diff >= 0 )
{
//printf("<timediff.8> ");
linebuf[k++] = MMJSON_TIMEDIFF8;
linebuf[k++] = (uint8_t)diff;
}
else if ( v[0] != '"' && *timestampp != 0 && (diff= ((uint32_t)atol(v)-*timestampp)) < 0x10000 && diff >= 0 )
{
//printf("<timediff.16> ");
linebuf[k++] = MMJSON_TIMEDIFF16;
l = diff;
k += MMJSON_rwnum(1,&linebuf[k],&l,2);
}
else
{
//printf("<decimal32>.%u %08x\n",(uint32_t)l,(uint32_t)l);
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL32STR : MMJSON_DECIMAL32;
k += MMJSON_rwnum(1,&linebuf[k],&l,4);
}
}
else if ( l < 0x10000000000LL )
{
//printf("<decimal40> ");
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL40STR : MMJSON_DECIMAL40;
k += MMJSON_rwnum(1,&linebuf[k],&l,5);
}
else if ( l < 0x1000000000000LL )
{
//printf("<decimal48> ");
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL48STR : MMJSON_DECIMAL48;
k += MMJSON_rwnum(1,&linebuf[k],&l,6);
}
//else if ( l < 0x100000000000000LL )
// printf("<decimal56> ");
else
{
//printf("<decimal64> ");
linebuf[k++] = isstr != 0 ? MMJSON_DECIMAL64STR : MMJSON_DECIMAL64;
k += MMJSON_rwnum(1,&linebuf[k],&l,8);
}
}
else
{
if ( (ind= mmfind(v)) >= 0 )
linebuf[k++] = ind;
else
{
for (j=0; v[j]!=0; j++)
{
if ( v[j] >= 'a' && v[j] <= 'z' )
continue;
else break;
}
if ( v[j] == 0 )
{
printf("unexpected missing string value.(%s)\n",v);
ind = mmadd(v);
//printf("%s.<%s>.%d ",s,v,ind);
//linebuf[k++] = ind;
linebuf[k++] = MMJSON_STRING;
memcpy(&linebuf[k],v,strlen(v)+1);
k += (int32_t)strlen(v) + 1;
}
else
{
for (j=0; v[j]!=0; j++)
{
if ( v[j] >= 'A' && v[j] <= 'Z' )
continue;
else break;
}
if ( v[j] == 0 && (coinind= mmjson_coinfind(v)) >= 0 )
{
//printf("<coin> ");
linebuf[k++] = MMJSON_COIN;
linebuf[k++] = coinind;
}
/*else if ( strlen(v) == 34 )
{
printf("<coinaddr> ");
k += 22;
}*/
else
{
linebuf[k++] = MMJSON_STRING;
if ( v[0] == '"' )
{
v++;
v[strlen(v)-1] = 0;
}
//printf("str.<%s> ",v);
memcpy(&linebuf[k],v,strlen(v)+1);
k += (int32_t)strlen(v) + 1;
}
}
}
}
return(k);
}
int32_t MMJSON_encode(uint8_t *linebuf,char *line)
{
uint32_t timestamp; uint64_t l; char *decodestr,*s,*v=0; cJSON *lineobj,*array,*ptr; int32_t k=0,m,i,asize,ind,z,allocv_flag;
timestamp = 0;
if ( (lineobj= cJSON_Parse(line)) != 0 )
{
if ( line[strlen(line)-1] == '\n' )
line[strlen(line)-1] = 0;
//printf("%s\n",jprint(lineobj,0));
if ( (m= cJSON_GetArraySize(lineobj)) > 0 )
{
ptr = lineobj->child;
for (i=0; i<m; i++,ptr=ptr->next)
{
allocv_flag = 0;
s = jfieldname(ptr);
if ( (ind= mmfind(s)) < 0 )
{
printf("unexpected missing.(%s)\n",s);
linebuf[k++] = MMJSON_STRING;
memcpy(&linebuf[k],s,strlen(s)+1);
k += (int32_t)strlen(s) + 1;
ind = mmadd(s);
} else linebuf[k++] = ind;
//printf("%s ",s);
if ( (array= jobj(lineobj,s)) != 0 && is_cJSON_Array(array) != 0 )
{
asize = cJSON_GetArraySize(array);
if ( asize < 0x100 )
{
linebuf[k++] = MMJSON_ARRAY8;
linebuf[k++] = asize;
}
else if ( asize < 0x10000 )
{
linebuf[k++] = MMJSON_ARRAY16;
l = asize;
k += MMJSON_rwnum(1,&linebuf[k],&l,2);
}
else
{
linebuf[k++] = MMJSON_ARRAY32;
l = asize;
k += MMJSON_rwnum(1,&linebuf[k],&l,4);
}
for (z=0; z<asize; z++)
{
if ( (v= jprint(jitem(array,z),0)) != 0 )
{
//printf("%d.(%s k.%d).%d ",z,v,k,asize);
k = MMJSON_encodeval(linebuf,k,ind,v,&timestamp,ptr);
free(v);
} else printf("ERROR.(%s) ",jprint(jitem(array,z),0));
}
//printf("%s array.%d k.%d\n",MM_fields[ind],asize,k);
continue;
}
else if ( (v= jstr(lineobj,s)) == 0 )
{
v = jprint(jobj(lineobj,s),0);
//printf("allocate v.%p\n",v);
allocv_flag = 1;
}
if ( v != 0 )
{
//printf("%s\n",v);
k = MMJSON_encodeval(linebuf,k,ind,v,&timestamp,ptr);
}
else printf("ERROR.(%s) ",jprint(jobj(lineobj,s),0));
if ( allocv_flag != 0 && v != 0 )
{
//printf("free allocated v\n");
free(v);
}
//printf("m.%d values\n",m);
}
}
free_json(lineobj);
if ( (decodestr= MMJSON_decode(linebuf,k)) == 0 || strcmp(decodestr,line) != 0 )
{
for (i=0; i<k; i++)
printf("%d ",linebuf[i]);
printf(" k.%d error decoding (%s) -> (%s)\n",k,line,decodestr==0?"":decodestr);
if ( decodestr != 0 )
free(decodestr);
return(-1);
} //else printf("decoded\n");
free(decodestr);
}
return(k);
}
#ifndef FROM_MARKETMAKER
#define packetout "/Users/mac/mmjson/packet.out"
#define packetlog "/Users/mac/mmjson/packet.log"
int main(int argc, const char * argv[])
{
FILE *fp,*outfp; uint8_t linebuf[8192]; char line[8192],str[65]; int32_t i,k,compressed=0,n=0,total = 0;
outfp = fopen(packetout,"wb");
if ( (fp= fopen(packetlog,"rb")) != 0 )
{
while ( fgets(line,sizeof(line),fp) > 0 )
{
n++;
total += strlen(line);
if ( (k= MMJSON_encode(linebuf,line)) > 0 )
{
//printf("\n");
if ( outfp != 0 )
fwrite(linebuf,1,k,outfp);
compressed += k;
}
else
{
compressed += strlen(line);
//printf("error parsing.(%s)\n",line);
}
}
fclose(fp);
if ( outfp != 0 )
{
uint8_t *data,*bits; int32_t numbits; bits256 seed; long fsize = ftell(outfp);
fclose(outfp);
if ( (0) && (outfp= fopen(packetout,"rb")) != 0 )
{
data = calloc(1,fsize);
bits = calloc(1,fsize);
if ( fread(data,1,fsize,outfp) == fsize )
{
memset(seed.bytes,0,sizeof(seed));
decode_hex(seed.bytes,32,"ffffff070000810478800084000800b200101400002001400404844402d29fc4");
numbits = ramcoder_compress(bits,(int32_t)fsize,data,(int32_t)fsize,seed);
fclose(outfp);
printf("numbits.%d %d bytes %.1f seed.%s\n",numbits,numbits/8+1,(double)compressed/(numbits/8),bits256_str(str,seed));
}
}
}
} else printf("cant find packet.log\n");
printf("char *MM_fields[256] = \n{\n");
for (i=0; i<MM_numfields; i++)
printf("\"%s\", ",MM_fields[i]);
printf("\n};\nnumlines.%d size %d compressed.%d %.3f maxind.%d\n",n,total,compressed,(double)total/compressed,MM_numfields);
}
#endif

125
iguana/exchanges/LP_nativeDEX.c

@ -17,7 +17,6 @@
// LP_nativeDEX.c
// marketmaker
//
// compress packets
// portfolio to set prices from historical
// portfolio value based on ask?
// else claim path
@ -165,6 +164,7 @@ char *blocktrail_listtransactions(char *symbol,char *coinaddr,int32_t num,int32_
return(0);
}
#include "LP_mmjson.c"
#include "LP_socket.c"
#include "LP_secp.c"
#include "LP_bitcoin.c"
@ -347,11 +347,15 @@ char *LP_process_message(void *ctx,char *typestr,char *myipaddr,int32_t pubsock,
int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int32_t sock,char *remoteaddr,int32_t maxdepth)
{
int32_t recvlen=1,nonz = 0; cJSON *argjson; void *ptr; char methodstr[64],*retstr,*str; struct nn_pollfd pfd;
static char *line;
int32_t recvlen=1,msglen,nonz = 0; cJSON *argjson,*recvjson; void *ptr,*msg; char methodstr[64],*decodestr,*retstr,*str; struct nn_pollfd pfd;
if ( line == 0 )
line = calloc(1,1024*1024);
if ( sock >= 0 )
{
while ( nonz < maxdepth && recvlen > 0 )
{
decodestr = 0;
nonz++;
memset(&pfd,0,sizeof(pfd));
pfd.fd = sock;
@ -359,56 +363,67 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int
if ( nn_poll(&pfd,1,1) != 1 )
break;
ptr = 0;
//buf = malloc(1000000);
//if ( (recvlen= nn_recv(sock,buf,1000000,0)) > 0 )
if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 )
{
//ptr = buf;
methodstr[0] = 0;
//printf("%s.(%s)\n",typestr,(char *)ptr);
if ( 1 )
decodestr = 0;
if ( recvlen > 32768 )
{
cJSON *recvjson; char *mstr;//,*cstr;
if ( (recvjson= cJSON_Parse((char *)ptr)) != 0 )
printf("unexpectedly large packet\n");
}
else
{
msg = ptr;
msglen = recvlen;
if ( (recvjson= cJSON_Parse((char *)ptr)) == 0 )
{
if ( (mstr= jstr(recvjson,"method")) != 0 )//&& strcmp(mstr,"uitem") == 0 && (cstr= jstr(recvjson,"coin")) != 0 && strcmp(cstr,"REVS") == 0 )
if ( (decodestr= MMJSON_decode(ptr,recvlen)) != 0 )
{
//printf("%s RECV.(%s)\n",typestr,(char *)ptr);
}
if ( (recvjson= cJSON_Parse(decodestr)) != 0 )
{
msg = decodestr;
msglen = (int32_t)strlen(decodestr) + 1;
}
//printf("decoded.(%s)\n",decodestr);
} else printf("couldnt decode linebuf[%d]\n",recvlen);
}
methodstr[0] = 0;
//printf("%s.(%s)\n",typestr,(char *)ptr);
if ( recvjson != 0 )
{
safecopy(LP_methodstr,jstr(recvjson,"method"),sizeof(LP_methodstr));
free_json(recvjson);
}
}
int32_t validreq = 0;
if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen )
{
if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 )
int32_t validreq = 1;
/*if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen )
{
if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 )
{
//printf("magic check error\n");
} else validreq = 1;
recvlen -= sizeof(bits256);
}*/
if ( validreq != 0 )
{
//printf("magic check error\n");
} else validreq = 1;
recvlen -= sizeof(bits256);
}
if ( validreq != 0 )
{
if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 )
free(retstr);
if ( Broadcaststr != 0 )
{
//printf("self broadcast.(%s)\n",Broadcaststr);
str = Broadcaststr;
Broadcaststr = 0;
if ( (argjson= cJSON_Parse(str)) != 0 )
if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,msg,msglen,sock)) != 0 )
free(retstr);
if ( Broadcaststr != 0 )
{
portable_mutex_lock(&LP_commandmutex);
if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 )
//printf("self broadcast.(%s)\n",Broadcaststr);
str = Broadcaststr;
Broadcaststr = 0;
if ( (argjson= cJSON_Parse(str)) != 0 )
{
if ( (retstr= stats_JSON(ctx,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 )
free(retstr);
portable_mutex_lock(&LP_commandmutex);
if ( LP_tradecommand(ctx,myipaddr,pubsock,argjson,0,0) <= 0 )
{
if ( (retstr= stats_JSON(ctx,myipaddr,pubsock,argjson,remoteaddr,0)) != 0 )
free(retstr);
}
portable_mutex_unlock(&LP_commandmutex);
free_json(argjson);
}
portable_mutex_unlock(&LP_commandmutex);
free_json(argjson);
free(str);
}
free(str);
}
}
}
@ -417,6 +432,8 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int
nn_freemsg(ptr), ptr = 0;
//free(buf);
}
if ( decodestr != 0 )
free(decodestr);
}
}
return(nonz);
@ -860,7 +877,7 @@ void gc_loop(void *ctx)
void queue_loop(void *ctx)
{
struct LP_queue *ptr,*tmp; int32_t sentbytes,nonz,flag,duplicate,n=0;
struct LP_queue *ptr,*tmp; cJSON *json; uint8_t linebuf[32768]; int32_t k,sentbytes,nonz,flag,duplicate,n=0;
strcpy(queue_loop_stats.name,"queue_loop");
queue_loop_stats.threshold = 1000.;
while ( 1 )
@ -878,9 +895,9 @@ void queue_loop(void *ctx)
{
if ( LP_sockcheck(ptr->sock) > 0 )
{
bits256 magic;
magic = LP_calc_magic(ptr->msg,(int32_t)(ptr->msglen - sizeof(bits256)));
memcpy(&ptr->msg[ptr->msglen - sizeof(bits256)],&magic,sizeof(magic));
//bits256 magic;
//magic = LP_calc_magic(ptr->msg,(int32_t)(ptr->msglen - sizeof(bits256)));
//memcpy(&ptr->msg[ptr->msglen - sizeof(bits256)],&magic,sizeof(magic));
if ( 0 )
{
static FILE *fp;
@ -892,9 +909,25 @@ void queue_loop(void *ctx)
fflush(fp);
}
}
if ( (sentbytes= nn_send(ptr->sock,ptr->msg,ptr->msglen,0)) != ptr->msglen )
printf("%d LP_send sent %d instead of %d\n",n,sentbytes,ptr->msglen);
else flag++;
if ( (json= cJSON_Parse((char *)ptr->msg)) != 0 )
{
if ( ptr->msglen < sizeof(linebuf) )
{
if ( (k= MMJSON_encode(linebuf,(char *)ptr->msg)) > 0 )
{
if ( (sentbytes= nn_send(ptr->sock,linebuf,k,0)) != k )
printf("%d LP_send mmjson sent %d instead of %d\n",n,sentbytes,k);
else flag++;
}
}
free_json(json);
}
if ( flag == 0 )
{
if ( (sentbytes= nn_send(ptr->sock,ptr->msg,ptr->msglen,0)) != ptr->msglen )
printf("%d LP_send sent %d instead of %d\n",n,sentbytes,ptr->msglen);
else flag++;
}
ptr->sock = -1;
if ( ptr->peerind > 0 )
ptr->starttime = (uint32_t)time(NULL);

2
iguana/exchanges/LP_network.c

@ -152,7 +152,7 @@ void _LP_sendqueueadd(uint32_t crc32,int32_t sock,uint8_t *msg,int32_t msglen,in
ptr->crc32 = crc32;
ptr->sock = sock;
ptr->peerind = peerind;
ptr->msglen = (int32_t)(msglen + sizeof(bits256));
ptr->msglen = (int32_t)(msglen + 0*sizeof(bits256));
memcpy(ptr->msg,msg,msglen); // sizeof(bits256) at the end all zeroes
DL_APPEND(LP_Q,ptr);
LP_Qenqueued++;

9
iguana/exchanges/LP_rpc.c

@ -301,7 +301,12 @@ cJSON *LP_validateaddress(char *symbol,char *address)
jaddstr(retjson,"address",address);
bitcoin_addr2rmd160(coin->taddr,&addrtype,rmd160,address);
bitcoin_address(checkaddr,coin->taddr,addrtype,rmd160,20);
jadd(retjson,"isvalid",strcmp(address,checkaddr)==0? cJSON_CreateTrue() : cJSON_CreateFalse());
if ( addrtype != coin->pubtype && addrtype != coin->p2shtype )
{
jadd(retjson,"isvalid",cJSON_CreateFalse());
return(retjson);
}
jadd(retjson,"isvalid",strcmp(address,checkaddr)==0 ? cJSON_CreateTrue() : cJSON_CreateFalse());
if ( addrtype == coin->pubtype )
{
strcpy(script,"76a914");
@ -312,7 +317,7 @@ cJSON *LP_validateaddress(char *symbol,char *address)
jaddstr(retjson,"scriptPubKey",script);
}
bitcoin_address(coinaddr,coin->taddr,coin->pubtype,G.LP_myrmd160,20);
jadd(retjson,"ismine",strcmp(address,coin->smartaddr) == 0 ? cJSON_CreateTrue() : cJSON_CreateFalse());
jadd(retjson,"ismine",strcmp(coinaddr,coin->smartaddr) == 0 ? cJSON_CreateTrue() : cJSON_CreateFalse());
jadd(retjson,"iswatchonly",cJSON_CreateTrue());
jadd(retjson,"isscript",addrtype == coin->p2shtype ? cJSON_CreateTrue() : cJSON_CreateFalse());
return(retjson);

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

54
iguana/exchanges/mm.c

@ -109,6 +109,60 @@ int main(int argc, const char * argv[])
printf("ERROR\n");
exit(0);
}
else if ( argv[1] != 0 && strcmp(argv[1],"hush") == 0 )
{
uint32_t timestamp; char str[65],wifstr[128]; bits256 privkey; int32_t i;
timestamp = (uint32_t)time(NULL);
//printf("start hush vanitygen t.%u\n",timestamp);
for (i=0; i<1000000000; i++)
{
OS_randombytes(privkey.bytes,sizeof(privkey));
privkey.bytes[0] = 0x0e;
privkey.bytes[1] = 0x5b;
privkey.bytes[2] = 0xf9;
privkey.bytes[3] = 0xc6;
privkey.bytes[4] = 0x06;
privkey.bytes[5] = 0xdd;
privkey.bytes[6] = 0xbb;
bitcoin_priv2wiflong(0xab,wifstr,privkey,0x36);
if ( wifstr[2] == 'x' && wifstr[4] == 'H' && wifstr[5] == 'u' && wifstr[6] == 's' )//&& wifstr[3] == 'x' )
{
if ( wifstr[7] == 'h' && wifstr[8] == 'L' && wifstr[9] == 'i' )
{
//printf("i.%d %s -> wif.%s\n",i,bits256_str(str,privkey),wifstr);
if ( wifstr[10] == 's' && wifstr[11] == 't' )
{
printf("{\"iters\":%d,\"privkey\":\"%s\",\"wif\":\"%s\"}\n",i,bits256_str(str,privkey),wifstr);
break;
}
}
} //else printf("failed %s\n",wifstr);
}
//printf("done hush vanitygen done %u elapsed %d\n",(uint32_t)time(NULL),(uint32_t)time(NULL) - timestamp);
exit(0);
}
else if ( argv[1] != 0 && strcmp(argv[1],"vanity") == 0 && argv[2] != 0 )
{
uint32_t timestamp; uint8_t pubkey33[33]; char str[65],coinaddr[64],wifstr[128]; bits256 privkey; int32_t i,len; void *ctx;
ctx = bitcoin_ctx();
len = (int32_t)strlen(argv[2]);
timestamp = (uint32_t)time(NULL);
printf("start vanitygen (%s).%d t.%u\n",argv[2],len,timestamp);
for (i=0; i<1000000000; i++)
{
OS_randombytes(privkey.bytes,sizeof(privkey));
bitcoin_priv2pub(ctx,pubkey33,coinaddr,privkey,0,60);
if ( strncmp(coinaddr+1,argv[2],len-1) == 0 )
{
bitcoin_priv2wif(0,wifstr,privkey,188);
printf("i.%d %s -> %s wif.%s\n",i,bits256_str(str,privkey),coinaddr,wifstr);
if ( coinaddr[1+len-1] == argv[2][len-1] )
break;
} //else printf("failed %s\n",wifstr);
}
printf("done vanitygen.(%s) done %u elapsed %d\n",argv[2],(uint32_t)time(NULL),(uint32_t)time(NULL) - timestamp);
exit(0);
}
sprintf(dirname,"%s",GLOBAL_DBDIR), OS_ensure_directory(dirname);
sprintf(dirname,"%s/SWAPS",GLOBAL_DBDIR), OS_ensure_directory(dirname);
sprintf(dirname,"%s/PRICES",GLOBAL_DBDIR), OS_ensure_directory(dirname);

2
iguana/iguana_notary.c

@ -558,7 +558,7 @@ STRING_ARG(iguana,addnotary,ipaddr)
char NOTARY_CURRENCIES[][16] = { "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD",
"CNY", "RUB", "MXN", "BRL", "INR", "HKD", "TRY", "ZAR", "PLN", "NOK", "SEK", "DKK", "CZK", "HUF", "ILS", "KRW", "MYR", "PHP", "RON", "SGD", "THB", "BGN", "IDR", "HRK",
"REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "SHARK", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK" }; // "LTC",
"REVS", "SUPERNET", "DEX", "PANGEA", "JUMBLR", "BET", "CRYPTO", "HODL", "BOTS", "MGW", "COQUI", "WLC", "KV", "CEAL", "MESH", "MNZ", "CHIPS", "MSHARK", "AXO", "ETOMIC", "BTCH" }; // "LTC",
ZERO_ARGS(dpow,notarychains)
{

3
iguana/m_notary_run

@ -41,6 +41,9 @@ coins/kv_7776
coins/ceal_7776
coins/mesh_7776
coins/mnz_7776
coins/axo_7776
coins/etomic_7776
coins/btch_7776
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":900000}"
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"$myip\"}"

Loading…
Cancel
Save