jl777
7 years ago
committed by
GitHub
16 changed files with 867 additions and 56 deletions
@ -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\"}" |
|||
|
@ -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\"}" |
|||
|
@ -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\"}" |
@ -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\"}" |
|||
|
@ -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\"}" |
|||
|
@ -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\"}" |
|||
|
@ -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,×tamp)) < 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,×tamp)) < 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,×tamp,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,×tamp,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 |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue