├── LICENSE ├── README.md ├── doc ├── allclasses-frame.html ├── allclasses-noframe.html ├── com │ └── theforceprotocol │ │ ├── blockchainrpc │ │ ├── BigDecimalUtil.html │ │ ├── BitcoinClient.html │ │ ├── Configuration.html │ │ ├── EOS.html │ │ ├── TransactionRecord.html │ │ ├── USDTClient.html │ │ ├── ethclient │ │ │ ├── AccountHelper.html │ │ │ ├── EthTransferClient.html │ │ │ ├── Web3JClient.html │ │ │ ├── package-frame.html │ │ │ ├── package-summary.html │ │ │ └── package-tree.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html │ │ └── util │ │ ├── CommonUtils.html │ │ ├── package-frame.html │ │ ├── package-summary.html │ │ └── package-tree.html ├── constant-values.html ├── deprecated-list.html ├── help-doc.html ├── index-files │ ├── index-1.html │ ├── index-10.html │ ├── index-11.html │ ├── index-12.html │ ├── index-13.html │ ├── index-14.html │ ├── index-15.html │ ├── index-16.html │ ├── index-17.html │ ├── index-2.html │ ├── index-3.html │ ├── index-4.html │ ├── index-5.html │ ├── index-6.html │ ├── index-7.html │ ├── index-8.html │ └── index-9.html ├── index.html ├── overview-frame.html ├── overview-summary.html ├── overview-tree.html ├── package-list ├── script.js └── stylesheet.css ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── theforceprotocol │ │ ├── DemoApplication.java │ │ ├── blockchainrpc │ │ ├── BitcoinClient.java │ │ ├── TransactionRecord.java │ │ ├── USDTClient.java │ │ └── ethclient │ │ │ ├── AccountHelper.java │ │ │ ├── EthTransferClient.java │ │ │ └── Web3JClient.java │ │ ├── config │ │ └── BeanConfig.java │ │ ├── controller │ │ ├── AirdropController.java │ │ ├── BTCController.java │ │ ├── EthController.java │ │ └── UsdtController.java │ │ ├── repository │ │ ├── AirdropRepository.java │ │ ├── AirdropResultRepository.java │ │ ├── Forairdrop.java │ │ ├── ForairdropResult.java │ │ ├── TxInfo.java │ │ └── TxInfoRepository.java │ │ └── util │ │ └── CommonUtils.java └── resources │ ├── application.properties │ └── help.md └── test └── java └── com └── theforceprotocol └── DemoApplicationTests.java /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 theforceprotocol 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 授权许可 2 | 本项目采用 MIT 开源授权许可证,完整的授权说明已放置在 LICENSE 文件中。 3 | 4 | ### 功能介绍 5 | 本部分模块主要是对接公链,其中包括BTC/ETH/OMNI,其代码能够实现签名、广播等功能。 6 | -------------------------------------------------------------------------------- /doc/allclasses-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 所有类 8 | 9 | 10 | 11 | 12 | 13 |

所有类

14 |
15 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/allclasses-noframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 所有类 8 | 9 | 10 | 11 | 12 | 13 |

所有类

14 |
15 | 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/blockchainrpc/ethclient/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.blockchainrpc.ethclient 8 | 9 | 10 | 11 | 12 | 13 |

com.theforceprotocol.blockchainrpc.ethclient

14 |
15 |

16 | 21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/blockchainrpc/ethclient/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.blockchainrpc.ethclient 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

程序包 com.theforceprotocol.blockchainrpc.ethclient

74 |
75 |
76 | 103 |
104 | 105 |
106 | 107 | 108 |
跳过导航链接
109 | 110 | 111 | 112 | 121 |
122 | 149 | 150 | 151 | 152 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/blockchainrpc/ethclient/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.blockchainrpc.ethclient 类分层结构 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

程序包com.theforceprotocol.blockchainrpc.ethclient的分层结构

74 | 程序包分层结构: 75 | 78 |
79 |
80 |

类分层结构

81 | 90 |
91 | 92 |
93 | 94 | 95 |
跳过导航链接
96 | 97 | 98 | 99 | 108 |
109 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/blockchainrpc/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.blockchainrpc 8 | 9 | 10 | 11 | 12 | 13 |

com.theforceprotocol.blockchainrpc

14 |
15 |

16 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/blockchainrpc/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.blockchainrpc 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

程序包 com.theforceprotocol.blockchainrpc

74 |
75 |
76 | 117 |
118 | 119 |
120 | 121 | 122 |
跳过导航链接
123 | 124 | 125 | 126 | 135 |
136 | 163 | 164 | 165 | 166 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/blockchainrpc/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.blockchainrpc 类分层结构 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

程序包com.theforceprotocol.blockchainrpc的分层结构

74 | 程序包分层结构: 75 | 78 |
79 |
80 |

类分层结构

81 | 93 |
94 | 95 |
96 | 97 | 98 |
跳过导航链接
99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/util/package-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.util 8 | 9 | 10 | 11 | 12 | 13 |

com.theforceprotocol.util

14 |
15 |

16 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/util/package-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.util 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

程序包 com.theforceprotocol.util

74 |
75 |
76 | 93 |
94 | 95 |
96 | 97 | 98 |
跳过导航链接
99 | 100 | 101 | 102 | 111 |
112 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /doc/com/theforceprotocol/util/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | com.theforceprotocol.util 类分层结构 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

程序包com.theforceprotocol.util的分层结构

74 | 程序包分层结构: 75 | 78 |
79 |
80 |

类分层结构

81 | 88 |
89 | 90 |
91 | 92 | 93 |
跳过导航链接
94 | 95 | 96 | 97 | 106 |
107 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /doc/constant-values.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 常量字段值 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

常量字段值

74 |

目录

75 | 78 |
79 |
80 | 81 | 82 |

com.theforceprotocol.*

83 | 118 |
119 | 120 |
121 | 122 | 123 |
跳过导航链接
124 | 125 | 126 | 127 | 136 |
137 | 164 | 165 | 166 | 167 | -------------------------------------------------------------------------------- /doc/deprecated-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 已过时的列表 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

已过时的 API

74 |

目录

75 |
76 | 77 |
78 | 79 | 80 |
跳过导航链接
81 | 82 | 83 | 84 | 93 |
94 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /doc/help-doc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | API 帮助 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

此 API 文档的组织方式

74 |
此 API (应用程序编程接口) 文档包含对应于导航栏中的项目的页面, 如下所述。
75 |
76 |
77 | 176 | 此帮助文件适用于使用标准 doclet 生成的 API 文档。
177 | 178 |
179 | 180 | 181 |
跳过导航链接
182 | 183 | 184 | 185 | 194 |
195 | 222 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /doc/index-files/index-1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | A - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

A

76 |
77 |
AccountHelper - com.theforceprotocol.blockchainrpc.ethclient中的类
78 |
 
79 |
AccountHelper() - 类 的构造器com.theforceprotocol.blockchainrpc.ethclient.AccountHelper
80 |
 
81 |
82 | A B C E F G I L M N R S T U W 
83 | 84 |
85 | 86 | 87 |
跳过导航链接
88 | 89 | 90 | 91 | 100 |
101 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /doc/index-files/index-10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | N - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

N

76 |
77 |
newAccount() - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.AccountHelper
78 |
 
79 |
newBip39Wallet(String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.AccountHelper
80 |
 
81 |
newWalletFile(String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.AccountHelper
82 |
 
83 |
84 | A B C E F G I L M N R S T U W 
85 | 86 |
87 | 88 | 89 |
跳过导航链接
90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/index-files/index-11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | R - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

R

76 |
77 |
READ_TIMEOUT - 类 中的静态变量com.theforceprotocol.blockchainrpc.ethclient.Web3JClient
78 |
 
79 |
80 | A B C E F G I L M N R S T U W 
81 | 82 |
83 | 84 | 85 |
跳过导航链接
86 | 87 | 88 | 89 | 98 |
99 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /doc/index-files/index-12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | S - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

S

76 |
77 |
send(String, double, String) - 类 中的方法com.theforceprotocol.blockchainrpc.EOS
78 |
 
79 |
sendGet(String, String) - 类 中的静态方法com.theforceprotocol.util.CommonUtils
80 |
 
81 |
setCode(Integer) - 类 中的方法com.theforceprotocol.blockchainrpc.TransactionRecord
82 |
 
83 |
setDescription(String) - 类 中的方法com.theforceprotocol.blockchainrpc.TransactionRecord
84 |
 
85 |
setTxHash(String) - 类 中的方法com.theforceprotocol.blockchainrpc.TransactionRecord
86 |
 
87 |
success(String) - 类 中的静态方法com.theforceprotocol.blockchainrpc.TransactionRecord
88 |
 
89 |
SUCCESS_CODE - 类 中的静态变量com.theforceprotocol.blockchainrpc.TransactionRecord
90 |
 
91 |
92 | A B C E F G I L M N R S T U W 
93 | 94 |
95 | 96 | 97 |
跳过导航链接
98 | 99 | 100 | 101 | 110 |
111 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /doc/index-files/index-13.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | T - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

T

76 |
77 |
TransactionRecord - com.theforceprotocol.blockchainrpc中的类
78 |
79 |
交易成功
80 |
81 |
TransactionRecord() - 类 的构造器com.theforceprotocol.blockchainrpc.TransactionRecord
82 |
 
83 |
transferBtc(String, String, double, String) - 类 中的方法com.theforceprotocol.blockchainrpc.BitcoinClient
84 |
 
85 |
transferERC20(String, String, String, String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
86 |
 
87 |
transferERC20(String, String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
88 |
 
89 |
transferERC20ByNonce(String, String, String, String, BigInteger) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
90 |
 
91 |
transferERC20ByNonce(String, String, BigInteger) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
92 |
 
93 |
transferETHToAddress(String, String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
94 |
 
95 |
transferETHToAddress(String, String, String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
96 |
 
97 |
transferUsdt(String, String, String, double, String) - 类 中的方法com.theforceprotocol.blockchainrpc.USDTClient
98 |
 
99 |
100 | A B C E F G I L M N R S T U W 
101 | 102 |
103 | 104 | 105 |
跳过导航链接
106 | 107 | 108 | 109 | 118 |
119 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /doc/index-files/index-14.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | U - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

U

76 |
77 |
USDTClient - com.theforceprotocol.blockchainrpc中的类
78 |
 
79 |
USDTClient() - 类 的构造器com.theforceprotocol.blockchainrpc.USDTClient
80 |
 
81 |
UsdtInstance() - 类 中的静态方法com.theforceprotocol.blockchainrpc.USDTClient
82 |
 
83 |
84 | A B C E F G I L M N R S T U W 
85 | 86 |
87 | 88 | 89 |
跳过导航链接
90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/index-files/index-15.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | W - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

W

76 |
77 |
Web3JClient - com.theforceprotocol.blockchainrpc.ethclient中的类
78 |
 
79 |
withdrawBtc(String, double) - 类 中的方法com.theforceprotocol.blockchainrpc.BitcoinClient
80 |
 
81 |
withdrawUsdt(String, double) - 类 中的方法com.theforceprotocol.blockchainrpc.USDTClient
82 |
 
83 |
WRITE_TIMEOUT - 类 中的静态变量com.theforceprotocol.blockchainrpc.ethclient.Web3JClient
84 |
 
85 |
86 | A B C E F G I L M N R S T U W 
87 | 88 |
89 | 90 | 91 |
跳过导航链接
92 | 93 | 94 | 95 | 104 |
105 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /doc/index-files/index-16.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | U - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C D E F G I L M N O R S T U W  73 | 74 | 75 |

U

76 |
77 |
USDTClient - com.theforceprotocol.blockchainrpc中的类
78 |
 
79 |
USDTClient() - 类 的构造器com.theforceprotocol.blockchainrpc.USDTClient
80 |
 
81 |
UsdtInstance() - 类 中的静态方法com.theforceprotocol.blockchainrpc.USDTClient
82 |
 
83 |
84 | A B C D E F G I L M N O R S T U W 
85 | 86 |
87 | 88 | 89 |
跳过导航链接
90 | 91 | 92 | 93 | 102 |
103 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/index-files/index-17.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | W - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C D E F G I L M N O R S T U W  73 | 74 | 75 |

W

76 |
77 |
Web3JClient - com.theforceprotocol.blockchainrpc.ethclient中的类
78 |
 
79 |
withdrawBtc(String, double) - 类 中的方法com.theforceprotocol.blockchainrpc.BitcoinClient
80 |
 
81 |
withdrawUsdt(String, double) - 类 中的方法com.theforceprotocol.blockchainrpc.USDTClient
82 |
 
83 |
WRITE_TIMEOUT - 类 中的静态变量com.theforceprotocol.blockchainrpc.ethclient.Web3JClient
84 |
 
85 |
86 | A B C D E F G I L M N O R S T U W 
87 | 88 |
89 | 90 | 91 |
跳过导航链接
92 | 93 | 94 | 95 | 104 |
105 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /doc/index-files/index-2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | B - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

B

76 |
77 |
BigDecimalUtil - com.theforceprotocol.blockchainrpc中的类
78 |
79 |
数据计算工具类
80 |
81 |
BigDecimalUtil() - 类 的构造器com.theforceprotocol.blockchainrpc.BigDecimalUtil
82 |
 
83 |
BitcoinClient - com.theforceprotocol.blockchainrpc中的类
84 |
 
85 |
BitcoinClient() - 类 的构造器com.theforceprotocol.blockchainrpc.BitcoinClient
86 |
 
87 |
BtcInstance() - 类 中的静态方法com.theforceprotocol.blockchainrpc.BitcoinClient
88 |
 
89 |
90 | A B C E F G I L M N R S T U W 
91 | 92 |
93 | 94 | 95 |
跳过导航链接
96 | 97 | 98 | 99 | 108 |
109 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /doc/index-files/index-3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | C - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

C

76 |
77 |
calculationFee(int) - 类 中的静态方法com.theforceprotocol.util.CommonUtils
78 |
79 |
计算手续费
80 |
81 |
com.theforceprotocol.blockchainrpc - 程序包 com.theforceprotocol.blockchainrpc
82 |
 
83 |
com.theforceprotocol.blockchainrpc.ethclient - 程序包 com.theforceprotocol.blockchainrpc.ethclient
84 |
 
85 |
com.theforceprotocol.util - 程序包 com.theforceprotocol.util
86 |
 
87 |
CommonUtils - com.theforceprotocol.util中的类
88 |
 
89 |
CommonUtils() - 类 的构造器com.theforceprotocol.util.CommonUtils
90 |
 
91 |
Configuration - com.theforceprotocol.blockchainrpc中的类
92 |
 
93 |
Configuration() - 类 的构造器com.theforceprotocol.blockchainrpc.Configuration
94 |
 
95 |
CONNECT_TIMEOUT - 类 中的静态变量com.theforceprotocol.blockchainrpc.ethclient.Web3JClient
96 |
 
97 |
98 | A B C E F G I L M N R S T U W 
99 | 100 |
101 | 102 | 103 |
跳过导航链接
104 | 105 | 106 | 107 | 116 |
117 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /doc/index-files/index-4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | E - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

E

76 |
77 |
encodeTransferData(String, BigInteger) - 类 中的静态方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
78 |
 
79 |
EOS - com.theforceprotocol.blockchainrpc中的类
80 |
 
81 |
EOS() - 类 的构造器com.theforceprotocol.blockchainrpc.EOS
82 |
 
83 |
estimateGas(Transaction) - 类 中的静态方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
84 |
 
85 |
EthInstance() - 类 中的静态方法com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
86 |
 
87 |
EthTransferClient - com.theforceprotocol.blockchainrpc.ethclient中的类
88 |
89 |
ETH转账
90 |
91 |
EthTransferClient() - 类 的构造器com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient
92 |
 
93 |
94 | A B C E F G I L M N R S T U W 
95 | 96 |
97 | 98 | 99 |
跳过导航链接
100 | 101 | 102 | 103 | 112 |
113 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /doc/index-files/index-5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | F - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

F

76 |
77 |
fail() - 类 中的静态方法com.theforceprotocol.blockchainrpc.TransactionRecord
78 |
 
79 |
fail(String) - 类 中的静态方法com.theforceprotocol.blockchainrpc.TransactionRecord
80 |
 
81 |
82 | A B C E F G I L M N R S T U W 
83 | 84 |
85 | 86 | 87 |
跳过导航链接
88 | 89 | 90 | 91 | 100 |
101 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /doc/index-files/index-7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | I - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

I

76 |
77 |
importPrivateKey(String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.AccountHelper
78 |
 
79 |
init() - 类 中的方法com.theforceprotocol.blockchainrpc.BitcoinClient
80 |
 
81 |
init() - 类 中的方法com.theforceprotocol.blockchainrpc.USDTClient
82 |
 
83 |
Instance() - 类 中的静态方法com.theforceprotocol.blockchainrpc.BitcoinClient
84 |
 
85 |
Instance() - 类 中的静态方法com.theforceprotocol.blockchainrpc.USDTClient
86 |
 
87 |
isScriptAddress(String) - 类 中的方法com.theforceprotocol.blockchainrpc.BitcoinClient
88 |
 
89 |
90 | A B C E F G I L M N R S T U W 
91 | 92 |
93 | 94 | 95 |
跳过导航链接
96 | 97 | 98 | 99 | 108 |
109 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /doc/index-files/index-8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | L - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

L

76 |
77 |
littleEndian2BigEndianString(String) - 类 中的静态方法com.theforceprotocol.util.CommonUtils
78 |
 
79 |
loadWalletFile(String, String) - 类 中的方法com.theforceprotocol.blockchainrpc.ethclient.AccountHelper
80 |
 
81 |
82 | A B C E F G I L M N R S T U W 
83 | 84 |
85 | 86 | 87 |
跳过导航链接
88 | 89 | 90 | 91 | 100 |
101 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /doc/index-files/index-9.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | M - 索引 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
A B C E F G I L M N R S T U W  73 | 74 | 75 |

M

76 |
77 |
mOkHttpClient - 类 中的静态变量com.theforceprotocol.blockchainrpc.ethclient.Web3JClient
78 |
 
79 |
80 | A B C E F G I L M N R S T U W 
81 | 82 |
83 | 84 | 85 |
跳过导航链接
86 | 87 | 88 | 89 | 98 |
99 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /doc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 生成的文档 (无标题) 8 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | <noscript> 70 | <div>您的浏览器已禁用 JavaScript。</div> 71 | </noscript> 72 | <h2>框架预警</h2> 73 | <p>请使用框架功能查看此文档。如果看到此消息, 则表明您使用的是不支持框架的 Web 客户机。链接到<a href="overview-summary.html">非框架版本</a>。</p> 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /doc/overview-frame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 概览列表 8 | 9 | 10 | 11 | 12 | 13 |
所有类
14 |
15 |

程序包

16 | 21 |
22 |

 

23 | 24 | 25 | -------------------------------------------------------------------------------- /doc/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 概览 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
程序包 
程序包说明
com.theforceprotocol.blockchainrpc 
com.theforceprotocol.blockchainrpc.ethclient 
com.theforceprotocol.util 
94 |
95 | 96 |
97 | 98 | 99 |
跳过导航链接
100 | 101 | 102 | 103 | 112 |
113 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /doc/overview-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 类分层结构 8 | 9 | 10 | 11 | 12 | 13 | 23 | 26 | 27 |
28 | 29 | 30 |
跳过导航链接
31 | 32 | 33 | 34 | 43 |
44 | 71 | 72 |
73 |

所有程序包的分层结构

74 | 程序包分层结构: 75 | 80 |
81 |
82 |

类分层结构

83 | 99 |
100 | 101 |
102 | 103 | 104 |
跳过导航链接
105 | 106 | 107 | 108 | 117 |
118 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /doc/package-list: -------------------------------------------------------------------------------- 1 | com.theforceprotocol.blockchainrpc 2 | com.theforceprotocol.blockchainrpc.ethclient 3 | com.theforceprotocol.util 4 | -------------------------------------------------------------------------------- /doc/script.js: -------------------------------------------------------------------------------- 1 | function show(type) 2 | { 3 | count = 0; 4 | for (var key in methods) { 5 | var row = document.getElementById(key); 6 | if ((methods[key] & type) != 0) { 7 | row.style.display = ''; 8 | row.className = (count++ % 2) ? rowColor : altColor; 9 | } 10 | else 11 | row.style.display = 'none'; 12 | } 13 | updateTabs(type); 14 | } 15 | 16 | function updateTabs(type) 17 | { 18 | for (var value in tabs) { 19 | var sNode = document.getElementById(tabs[value][0]); 20 | var spanNode = sNode.firstChild; 21 | if (value == type) { 22 | sNode.className = activeTableTab; 23 | spanNode.innerHTML = tabs[value][1]; 24 | } 25 | else { 26 | sNode.className = tableTab; 27 | spanNode.innerHTML = "" + tabs[value][1] + ""; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.example 7 | demo 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | demo 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.0.3.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | api-v1-client-java-mvn-repo 30 | https://raw.githubusercontent.com/blockchain/api-v1-client-java/mvn-repo/ 31 | 32 | true 33 | always 34 | 35 | 36 | 37 | mvn-nemp-ftp 38 | Nemp's Maven Repository 39 | http://mvn.neemre.com/ 40 | 41 | 42 | 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-starter 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-web 51 | 52 | 53 | 54 | com.github.briandilley.jsonrpc4j 55 | jsonrpc4j 56 | 1.1 57 | 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-starter-test 63 | test 64 | 65 | 66 | org.projectlombok 67 | lombok 68 | 1.18.0 69 | 70 | 71 | commons-codec 72 | commons-codec 73 | 1.11 74 | 75 | 76 | com.alibaba 77 | fastjson 78 | 1.2.47 79 | 80 | 81 | info.blockchain 82 | api 83 | LATEST 84 | 85 | 86 | org.bitcoinj 87 | bitcoinj-core 88 | 0.15 89 | compile 90 | 91 | 92 | com.neemre.btcd-cli4j 93 | btcd-cli4j-core 94 | 0.5.1 95 | 96 | 97 | com.neemre.btcd-cli4j 98 | btcd-cli4j-daemon 99 | 0.5.1 100 | 101 | 102 | 103 | com.squareup.okio 104 | okio 105 | 1.15.0 106 | 107 | 108 | org.web3j 109 | core 110 | 3.4.0 111 | 112 | 113 | com.squareup.okio 114 | okio 115 | 116 | 117 | 118 | 119 | 120 | org.springframework.boot 121 | spring-boot-starter-data-jpa 122 | 123 | 124 | 125 | mysql 126 | mysql-connector-java 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | org.springframework.boot 135 | spring-boot-maven-plugin 136 | 137 | 138 | 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | @SpringBootApplication 8 | @EnableScheduling 9 | public class DemoApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(DemoApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/blockchainrpc/TransactionRecord.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.blockchainrpc; 2 | 3 | /** 4 | * 交易成功 5 | * 6 | * @author Mingliang 7 | * @date 2019/3/1 18:26 8 | **/ 9 | public class TransactionRecord { 10 | public final static Integer SUCCESS_CODE = 200; 11 | private final static Integer FAIL_CODE = 500; 12 | 13 | private Integer code; 14 | 15 | private String txHash; 16 | 17 | private String description; 18 | 19 | public static TransactionRecord success(String txHash) { 20 | TransactionRecord tr = new TransactionRecord(); 21 | tr.setCode(SUCCESS_CODE); 22 | tr.setTxHash(txHash); 23 | return tr; 24 | } 25 | 26 | public static TransactionRecord fail() { 27 | return fail("转账失败"); 28 | } 29 | 30 | public static TransactionRecord fail(String txHash) { 31 | TransactionRecord tr = new TransactionRecord(); 32 | tr.setCode(FAIL_CODE); 33 | tr.setTxHash(txHash); 34 | return tr; 35 | } 36 | 37 | public Integer getCode() { 38 | return code; 39 | } 40 | 41 | public void setCode(Integer code) { 42 | this.code = code; 43 | } 44 | 45 | public String getTxHash() { 46 | return txHash; 47 | } 48 | 49 | public void setTxHash(String txHash) { 50 | this.txHash = txHash; 51 | } 52 | 53 | public String getDescription() { 54 | return description; 55 | } 56 | 57 | public void setDescription(String description) { 58 | this.description = description; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/blockchainrpc/ethclient/AccountHelper.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.blockchainrpc.ethclient; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.web3j.crypto.*; 6 | import org.web3j.protocol.Web3j; 7 | import org.web3j.protocol.http.HttpService; 8 | 9 | import java.io.File; 10 | import java.math.BigInteger; 11 | import java.util.List; 12 | 13 | public class AccountHelper { 14 | private Logger logger = LoggerFactory.getLogger(AccountHelper.class); 15 | private String keystoreDir = "C:\\keystore"; 16 | 17 | private void logAccount(String[] tuple) { 18 | logger.info("Private Key: " + tuple[0]); 19 | logger.info("Public Key: " + tuple[1]); 20 | logger.info("address: " + tuple[2]); 21 | } 22 | 23 | private String[] getAccountTuple(ECKeyPair keyPair) { 24 | return new String[]{ 25 | keyPair.getPrivateKey().toString(16), 26 | keyPair.getPublicKey().toString(16), 27 | Keys.getAddress(keyPair) 28 | }; 29 | } 30 | 31 | public String[] newAccount() throws Exception { 32 | ECKeyPair keyPair = Keys.createEcKeyPair(); 33 | String[] tuple = getAccountTuple(keyPair); 34 | return tuple; 35 | } 36 | 37 | public String[] importPrivateKey(String privateKey) throws Exception { 38 | BigInteger key = new BigInteger(privateKey, 16); 39 | ECKeyPair keyPair = ECKeyPair.create(key); 40 | String[] tuple = getAccountTuple(keyPair); 41 | logAccount(tuple); 42 | return tuple; 43 | } 44 | 45 | public String newWalletFile(String password) throws Exception { 46 | File dest = new File(keystoreDir); 47 | String walletFileName = WalletUtils.generateNewWalletFile(password, dest, true); 48 | logger.info("Wallet file: " + walletFileName); 49 | return walletFileName; 50 | } 51 | 52 | public String[] loadWalletFile(String password, String walletFileName) throws Exception { 53 | String src = keystoreDir + "/" + walletFileName; 54 | Credentials credentials = WalletUtils.loadCredentials(password, src); 55 | ECKeyPair keyPair = credentials.getEcKeyPair(); 56 | String[] tuple = getAccountTuple(keyPair); 57 | logAccount(tuple); 58 | return tuple; 59 | } 60 | 61 | private void logBip39Wallet(Bip39Wallet wallet) { 62 | logger.info("Bip39 wallet file: " + wallet.getFilename()); 63 | logger.info("Bip39 wallet mnemonic: " + wallet.getMnemonic()); 64 | } 65 | 66 | public String[] newBip39Wallet(String password) throws Exception { 67 | File dest = new File(keystoreDir); 68 | Bip39Wallet wallet = WalletUtils.generateBip39Wallet(password, dest); 69 | logBip39Wallet(wallet); 70 | return new String[]{wallet.getFilename(), wallet.getMnemonic()}; 71 | } 72 | 73 | private void logAccounts(List accounts) { 74 | for (int i = 0; i < accounts.size(); i++) { 75 | logger.info("account " + i + ": " + accounts.get(i)); 76 | } 77 | } 78 | 79 | public String[] getNodeAccounts() throws Exception { 80 | Web3j web3j = Web3j.build(new HttpService("https://mainnet.infura.io/opPa")); 81 | List accounts = web3j.ethAccounts().send().getAccounts(); 82 | logAccounts(accounts); 83 | return accounts.toArray(new String[accounts.size()]); 84 | } 85 | 86 | public static void main(String[] args) throws Exception { 87 | AccountHelper accountHelper = new AccountHelper(); 88 | //创建密钥对 89 | String[] tuple = accountHelper.newAccount(); 90 | //导入私钥 91 | String[] tuple2 = accountHelper.importPrivateKey(tuple[0]); 92 | //创建钱包文件 93 | String walletFileName = accountHelper.newWalletFile("123"); 94 | //载入钱包文件,创建账户凭证 95 | accountHelper.loadWalletFile("123", walletFileName); 96 | //查看节点账户 97 | accountHelper.getNodeAccounts(); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/blockchainrpc/ethclient/Web3JClient.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.blockchainrpc.ethclient; 2 | 3 | import org.web3j.protocol.Web3j; 4 | import org.web3j.protocol.http.HttpService; 5 | 6 | public class Web3JClient { 7 | private static String ip = "https://mainnet.infura.io/opPa"; 8 | 9 | private Web3JClient() { 10 | } 11 | 12 | private volatile static Web3j web3j; 13 | 14 | public static Web3j getClient() { 15 | if (web3j == null) { 16 | synchronized (Web3JClient.class) { 17 | if (web3j == null) { 18 | web3j = Web3j.build(new HttpService(ip)); 19 | } 20 | } 21 | } 22 | return web3j; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/config/BeanConfig.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.config; 2 | 3 | import com.googlecode.jsonrpc4j.JsonRpcHttpClient; 4 | import org.apache.tomcat.util.codec.binary.Base64; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | import java.net.URL; 9 | import java.util.HashMap; 10 | import java.util.Map; 11 | 12 | @Configuration 13 | public class BeanConfig { 14 | 15 | @Bean 16 | public JsonRpcHttpClient client() throws Throwable { 17 | // 身份认证 18 | String cred = Base64.encodeBase64String(("username" + ":" + "password").getBytes()); 19 | Map headers = new HashMap <>(1); 20 | headers.put("Authorization", "Basic " + cred); 21 | return new JsonRpcHttpClient(new URL("http://" + "ip" + ":" + "8332"), headers);//BTC 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/controller/AirdropController.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.controller; 2 | 3 | import com.theforceprotocol.blockchainrpc.TransactionRecord; 4 | import com.theforceprotocol.blockchainrpc.ethclient.AccountHelper; 5 | import com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient; 6 | import com.theforceprotocol.repository.*; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestParam; 12 | import org.springframework.web.bind.annotation.ResponseBody; 13 | 14 | import java.math.BigInteger; 15 | import java.util.ArrayList; 16 | import java.util.HashMap; 17 | import java.util.List; 18 | import java.util.Map; 19 | 20 | @Controller 21 | @RequestMapping(path = "/airdrop") 22 | public class AirdropController { 23 | @Autowired 24 | private AirdropRepository airdropRepository; 25 | 26 | @Autowired 27 | private AirdropResultRepository airdropResultRepository; 28 | @Autowired 29 | private TxInfoRepository txInfoRepository; 30 | 31 | BigInteger curEtherScanNonce = new BigInteger("0"); 32 | private static int nonce = 0; 33 | 34 | @GetMapping(path = "/add") 35 | public @ResponseBody 36 | String addAirdropUser(@RequestParam String address, @RequestParam String count) { 37 | Forairdrop forairdrop = new Forairdrop(); 38 | forairdrop.setAddress(address); 39 | forairdrop.setCount(count); 40 | airdropRepository.save(forairdrop); 41 | return "add " + "address: " + address + ",count:" + count; 42 | } 43 | 44 | @GetMapping(path = "/del") 45 | public @ResponseBody 46 | String addAirdropUser(@RequestParam String id) { 47 | int index = Integer.parseInt(id.trim()); 48 | airdropRepository.deleteById(index); 49 | return "del " + "id: " + id; 50 | } 51 | 52 | @GetMapping(path = "/all") 53 | public @ResponseBody 54 | Iterable getAllUsers() { 55 | return airdropRepository.findAll(); 56 | } 57 | 58 | @GetMapping(path = "/airdrop") 59 | public @ResponseBody 60 | List airdrop() throws Exception { 61 | Iterable userList = airdropRepository.findAll(); 62 | List trs = new ArrayList<>(); 63 | 64 | curEtherScanNonce = EthTransferClient.EthInstance().getAddressNonce(); 65 | 66 | for (Forairdrop airdrop : userList) { 67 | TransactionRecord tr = EthTransferClient.EthInstance().transferERC20ByNonce(airdrop.getAddress(), airdrop.getCount() + "000000000000000000", curEtherScanNonce); 68 | trs.add(tr); 69 | 70 | ForairdropResult result = new ForairdropResult(); 71 | result.setAddress(airdrop.getAddress()); 72 | result.setCount(airdrop.getCount()); 73 | result.setTxid(tr.getTxHash()); 74 | 75 | TxInfo txInfo = new TxInfo(); 76 | txInfo.setAmount(airdrop.getCount()); 77 | 78 | txInfo.setNonce(curEtherScanNonce.intValue()); 79 | txInfo.setToaddress(airdrop.getAddress()); 80 | txInfo.setTxhash(tr.getTxHash()); 81 | txInfoRepository.save(txInfo); 82 | 83 | airdropResultRepository.save(result); 84 | 85 | curEtherScanNonce = curEtherScanNonce.add(BigInteger.valueOf(1)); 86 | } 87 | 88 | return trs; 89 | } 90 | 91 | @GetMapping(path = "/ethkeygen") 92 | public @ResponseBody 93 | List> keyGen(@RequestParam String cnt) throws Exception { 94 | List> result = new ArrayList<>(); 95 | for (int i = 0; i < Integer.parseInt(cnt); i++) { 96 | AccountHelper accountHelper = new AccountHelper(); 97 | String[] tuple = accountHelper.newAccount(); 98 | Map one = new HashMap<>(); 99 | one.put("PrivateKey", tuple[0]); 100 | one.put("Address", "0x" + tuple[2]); 101 | result.add(one); 102 | } 103 | return result; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/controller/BTCController.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.googlecode.jsonrpc4j.JsonRpcHttpClient; 5 | import com.theforceprotocol.blockchainrpc.BitcoinClient; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.PathVariable; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | import javax.annotation.security.PermitAll; 13 | import java.util.Map; 14 | 15 | /** 16 | * @author michael 17 | * 18 | */ 19 | @RestController 20 | @RequestMapping(value = "/btc") 21 | public class BTCController { 22 | @RequestMapping("/withdraw/{toAddress}/{amount}") 23 | public String Withdraw(@PathVariable String toAddress, @PathVariable String amount) throws Throwable{ 24 | return JSON.toJSONString(BitcoinClient.BtcInstance().withdrawBtc(toAddress, Double.parseDouble(amount))); 25 | } 26 | 27 | @RequestMapping("/transfer/{fromAddress}/{toAddress}/{amount}/{fromPrivateKey}") 28 | public String Transfer(@PathVariable String fromAddress, @PathVariable String toAddress, @PathVariable String amount, @PathVariable String fromPrivateKey) throws Throwable{ 29 | return JSON.toJSONString(BitcoinClient.BtcInstance().transferBtc(fromAddress, toAddress, Double.parseDouble(amount), fromPrivateKey)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/controller/EthController.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.googlecode.jsonrpc4j.JsonRpcHttpClient; 5 | import com.theforceprotocol.blockchainrpc.USDTClient; 6 | import com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | /** 13 | * @author michael 14 | * 15 | */ 16 | @RestController 17 | @RequestMapping(value = "/eth") 18 | public class EthController { 19 | @RequestMapping("/transfer/{fromPrivateKey}/{toAddress}/{amount}") 20 | public String transferETHToAddress(@PathVariable String fromPrivateKey, @PathVariable String toAddress, @PathVariable String amount) throws Throwable{ 21 | return JSON.toJSONString(EthTransferClient.EthInstance().transferETHToAddress(fromPrivateKey, toAddress, amount)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/controller/UsdtController.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.googlecode.jsonrpc4j.JsonRpcHttpClient; 5 | import com.theforceprotocol.blockchainrpc.BitcoinClient; 6 | import com.theforceprotocol.blockchainrpc.USDTClient; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.web.bind.annotation.PathVariable; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | /** 13 | * @author michael 14 | * 15 | */ 16 | @RestController 17 | @RequestMapping(value = "/usdt") 18 | public class UsdtController { 19 | @RequestMapping("/withdraw/{toAddress}/{amount}") 20 | public String Withdraw(@PathVariable String toAddress, @PathVariable String amount) throws Throwable{ 21 | return JSON.toJSONString(USDTClient.UsdtInstance().withdrawUsdt(toAddress, Double.parseDouble(amount))); 22 | } 23 | 24 | @RequestMapping("/transfer/{fromAddress}/{toAddress}/{feeAddress}/{amount}/{fromPrivateKey}") 25 | public String Transfer(@PathVariable String fromAddress, @PathVariable String toAddress, @PathVariable String feeAddress, @PathVariable String amount, @PathVariable String fromPrivateKey) throws Throwable{ 26 | return JSON.toJSONString(USDTClient.UsdtInstance().transferUsdt(fromAddress, toAddress, feeAddress, Double.parseDouble(amount), fromPrivateKey)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/repository/AirdropRepository.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface AirdropRepository extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/repository/AirdropResultRepository.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface AirdropResultRepository extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/repository/Forairdrop.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.repository; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | import javax.validation.constraints.Pattern; 7 | 8 | 9 | @Entity 10 | @Data 11 | @Table(name="forairdrop") 12 | public class Forairdrop { 13 | @Id 14 | @GeneratedValue(strategy=GenerationType.AUTO) 15 | private Integer id; 16 | 17 | @Pattern(regexp = "0x[a-fA-F\\d]{40}", message = "invalid eth address") 18 | private String address; 19 | private String count; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/repository/ForairdropResult.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.repository; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | import javax.validation.constraints.Pattern; 7 | 8 | 9 | @Entity 10 | @Data 11 | @Table(name="forairdrop_result") 12 | public class ForairdropResult { 13 | @Id 14 | @GeneratedValue(strategy=GenerationType.AUTO) 15 | private Integer id; 16 | 17 | @Pattern(regexp = "0x[a-fA-F\\d]{40}", message = "invalid eth address") 18 | private String address; 19 | private String count; 20 | private String txid; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/repository/TxInfo.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.repository; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.*; 6 | import javax.validation.constraints.Pattern; 7 | 8 | @Entity 9 | @Data 10 | @Table(name="txinfo") 11 | public class TxInfo { 12 | @Id 13 | @GeneratedValue(strategy= GenerationType.AUTO) 14 | private Integer id; 15 | 16 | @Pattern(regexp = "0x[a-fA-F\\d]{40}", message = "invalid eth address") 17 | private String toaddress; 18 | 19 | private String txhash; 20 | 21 | private Integer nonce; 22 | 23 | private String amount; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/repository/TxInfoRepository.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | 6 | public interface TxInfoRepository extends JpaRepository { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/main/java/com/theforceprotocol/util/CommonUtils.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol.util; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.alibaba.fastjson.JSONObject; 5 | 6 | import java.io.BufferedReader; 7 | import java.io.InputStreamReader; 8 | import java.math.BigDecimal; 9 | import java.net.URL; 10 | import java.net.URLConnection; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | public class CommonUtils { 15 | public static String littleEndian2BigEndianString(String original) { 16 | String reverse = ""; 17 | int length = original.length(); 18 | for(int i = length - 1; i >=0;i -=2) 19 | reverse =reverse +original.substring(i -1,i +1); 20 | return reverse; 21 | } 22 | 23 | public static String sendGet(String url, String param) { 24 | String result = ""; 25 | BufferedReader in = null; 26 | try { 27 | String urlNameString = url + "?" + param; 28 | URL realUrl = new URL(urlNameString); 29 | // 打开和URL之间的连接 30 | URLConnection connection = realUrl.openConnection(); 31 | // 设置通用的请求属性 32 | connection.setRequestProperty("accept", "*/*"); 33 | connection.setRequestProperty("connection", "Keep-Alive"); 34 | connection.setRequestProperty("user-agent", 35 | "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); 36 | // 建立实际的连接 37 | connection.connect(); 38 | // 获取所有响应头字段 39 | Map> map = connection.getHeaderFields(); 40 | // 遍历所有的响应头字段 41 | for (String key : map.keySet()) { 42 | System.out.println(key + "--->" + map.get(key)); 43 | } 44 | // 定义 BufferedReader输入流来读取URL的响应 45 | in = new BufferedReader(new InputStreamReader( 46 | connection.getInputStream())); 47 | String line; 48 | while ((line = in.readLine()) != null) { 49 | result += line; 50 | } 51 | } catch (Exception e) { 52 | System.out.println("发送GET请求出现异常!" + e); 53 | e.printStackTrace(); 54 | } 55 | // 使用finally块来关闭输入流 56 | finally { 57 | try { 58 | if (in != null) { 59 | in.close(); 60 | } 61 | } catch (Exception e2) { 62 | e2.printStackTrace(); 63 | } 64 | } 65 | return result; 66 | } 67 | 68 | /** 69 | * 计算手续费 70 | * 71 | * @param inputCount 72 | * @return 73 | */ 74 | public static BigDecimal calculationFee(int inputCount) { 75 | //计算手续费获取每个字节的手续费 76 | /* 77 | {"fastestFee":30,"halfHourFee":30,"hourFee":28} 78 | */ 79 | String url="https://bitcoinfees.earn.com/api/v1/fees/recommended"; 80 | //计算字节大小和费用 81 | String result=CommonUtils.sendGet(url,null); 82 | JSONObject response = JSON.parseObject(result); 83 | BigDecimal keyCount = BigDecimal.valueOf((inputCount * 148 + 44) * ((int)response.get("hourFee")/4)); 84 | return keyCount; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.jpa.hibernate.ddl-auto=none 2 | spring.datasource.url= 3 | spring.datasource.username= 4 | spring.datasource.password= -------------------------------------------------------------------------------- /src/main/resources/help.md: -------------------------------------------------------------------------------- 1 | == Blockchain == 2 | clearmempool 3 | getbestblockhash 4 | getblock "hash" ( verbose ) 5 | getblockchaininfo 6 | getblockcount 7 | getblockhash index 8 | getblockheader "hash" ( verbose ) 9 | getchaintips 10 | getdifficulty 11 | getmempoolancestors txid (verbose) 12 | getmempooldescendants txid (verbose) 13 | getmempoolentry txid 14 | getmempoolinfo 15 | getrawmempool ( verbose ) 16 | gettxout "txid" n ( includemempool ) 17 | gettxoutproof ["txid",...] ( blockhash ) 18 | gettxoutsetinfo 19 | verifychain ( checklevel numblocks ) 20 | verifytxoutproof "proof" 21 | 22 | == Control == 23 | getinfo 24 | help ( "command" ) 25 | stop 26 | 27 | == Generating == 28 | generate numblocks ( maxtries ) 29 | generatetoaddress numblocks address (maxtries) 30 | 31 | == Mining == 32 | getblocktemplate ( TemplateRequest ) 33 | getmininginfo 34 | getnetworkhashps ( blocks height ) 35 | prioritisetransaction 36 | submitblock "hexdata" ( "jsonparametersobject" ) 37 | 38 | == Network == 39 | addnode "node" "add|remove|onetry" 40 | clearbanned 41 | disconnectnode "node" 42 | getaddednodeinfo dummy ( "node" ) 43 | getconnectioncount 44 | getnettotals 45 | getnetworkinfo 46 | getpeerinfo 47 | listbanned 48 | ping 49 | setban "ip(/netmask)" "add|remove" (bantime) (absolute) 50 | 51 | == Omni layer (configuration) == 52 | omni_setautocommit flag 53 | 54 | == Omni layer (data retrieval) == 55 | omni_getactivations 56 | omni_getactivecrowdsales 57 | omni_getactivedexsells ( address ) 58 | omni_getallbalancesforaddress "address" 59 | omni_getallbalancesforid propertyid 60 | omni_getbalance "address" propertyid 61 | omni_getbalanceshash propertyid 62 | omni_getcrowdsale propertyid ( verbose ) 63 | omni_getcurrentconsensushash 64 | omni_getfeecache ( propertyid ) 65 | omni_getfeedistribution distributionid 66 | omni_getfeedistributions propertyid 67 | omni_getfeeshare ( address ecosystem ) 68 | omni_getfeetrigger ( propertyid ) 69 | omni_getgrants propertyid 70 | omni_getinfo 71 | omni_getmetadexhash propertyId 72 | omni_getorderbook propertyid ( propertyid ) 73 | omni_getpayload "txid" 74 | omni_getproperty propertyid 75 | omni_getseedblocks startblock endblock 76 | omni_getsto "txid" "recipientfilter" 77 | omni_gettrade "txid" 78 | omni_gettradehistoryforaddress "address" ( count propertyid ) 79 | omni_gettradehistoryforpair propertyid propertyid ( count ) 80 | omni_gettransaction "txid" 81 | omni_listblocktransactions index 82 | omni_listpendingtransactions ( "address" ) 83 | omni_listproperties 84 | omni_listtransactions ( "address" count skip startblock endblock ) 85 | 86 | == Omni layer (payload creation) == 87 | omni_createpayload_cancelalltrades ecosystem 88 | omni_createpayload_canceltradesbypair propertyidforsale propertiddesired 89 | omni_createpayload_canceltradesbyprice propertyidforsale "amountforsale" propertiddesired "amountdesired" 90 | omni_createpayload_changeissuer propertyid 91 | omni_createpayload_closecrowdsale propertyid 92 | omni_senddexaccept propertyid "amount" 93 | omni_createpayload_dexsell propertyidforsale "amountforsale" "amountdesired" paymentwindow minacceptfee action 94 | omni_createpayload_disablefreezing propertyid 95 | omni_createpayload_enablefreezing propertyid 96 | omni_createpayload_freeze "toaddress" propertyid amount 97 | omni_createpayload_grant propertyid "amount" ( "memo" ) 98 | omni_createpayload_issuancecrowdsale ecosystem type previousid "category" "subcategory" "name" "url" "data" propertyiddesired tokensperunit deadline earlybonus issuerpercentage 99 | omni_createpayload_issuancefixed ecosystem type previousid "category" "subcategory" "name" "url" "data" "amount" 100 | omni_createpayload_issuancemanaged ecosystem type previousid "category" "subcategory" "name" "url" "data" 101 | omni_createpayload_revoke propertyid "amount" ( "memo" ) 102 | omni_createpayload_sendall ecosystem 103 | omni_createpayload_simplesend propertyid "amount" 104 | omni_createpayload_sto propertyid "amount" ( distributionproperty ) 105 | omni_createpayload_trade propertyidforsale "amountforsale" propertiddesired "amountdesired" 106 | omni_createpayload_unfreeze "toaddress" propertyid amount 107 | 108 | == Omni layer (raw transactions) == 109 | omni_createrawtx_change "rawtx" "prevtxs" "destination" fee ( position ) 110 | omni_createrawtx_input "rawtx" "txid" n 111 | omni_createrawtx_multisig "rawtx" "payload" "seed" "redeemkey" 112 | omni_createrawtx_opreturn "rawtx" "payload" 113 | omni_createrawtx_reference "rawtx" "destination" ( amount ) 114 | omni_decodetransaction "rawtx" ( "prevtxs" height ) 115 | 116 | == Omni layer (transaction creation) == 117 | omni_send "fromaddress" "toaddress" propertyid "amount" ( "redeemaddress" "referenceamount" ) 118 | omni_sendall "fromaddress" "toaddress" ecosystem ( "redeemaddress" "referenceamount" ) 119 | omni_sendcancelalltrades "fromaddress" ecosystem 120 | omni_sendcanceltradesbypair "fromaddress" propertyidforsale propertiddesired 121 | omni_sendcanceltradesbyprice "fromaddress" propertyidforsale "amountforsale" propertiddesired "amountdesired" 122 | omni_sendchangeissuer "fromaddress" "toaddress" propertyid 123 | omni_sendclosecrowdsale "fromaddress" propertyid 124 | omni_senddexaccept "fromaddress" "toaddress" propertyid "amount" ( override ) 125 | omni_senddexsell "fromaddress" propertyidforsale "amountforsale" "amountdesired" paymentwindow minacceptfee action 126 | omni_senddisablefreezing "fromaddress" propertyid 127 | omni_sendenablefreezing "fromaddress" propertyid 128 | omni_sendfreeze "fromaddress" "toaddress" propertyid amount 129 | omni_sendgrant "fromaddress" "toaddress" propertyid "amount" ( "memo" ) 130 | omni_sendissuancecrowdsale "fromaddress" ecosystem type previousid "category" "subcategory" "name" "url" "data" propertyiddesired tokensperunit deadline ( earlybonus issuerpercentage ) 131 | omni_sendissuancefixed "fromaddress" ecosystem type previousid "category" "subcategory" "name" "url" "data" "amount" 132 | omni_sendissuancemanaged "fromaddress" ecosystem type previousid "category" "subcategory" "name" "url" "data" 133 | omni_sendrawtx "fromaddress" "rawtransaction" ( "referenceaddress" "redeemaddress" "referenceamount" ) 134 | omni_sendrevoke "fromaddress" propertyid "amount" ( "memo" ) 135 | omni_sendsto "fromaddress" propertyid "amount" ( "redeemaddress" distributionproperty ) 136 | omni_sendtrade "fromaddress" propertyidforsale "amountforsale" propertiddesired "amountdesired" 137 | omni_sendunfreeze "fromaddress" "toaddress" propertyid amount 138 | 139 | == Rawtransactions == 140 | createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime ) 141 | decoderawtransaction "hexstring" 142 | decodescript "hex" 143 | fundrawtransaction "hexstring" ( options ) 144 | getrawtransaction "txid" ( verbose ) 145 | sendrawtransaction "hexstring" ( allowhighfees ) 146 | signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype ) 147 | 148 | == Util == 149 | createmultisig nrequired ["key",...] 150 | estimatefee nblocks 151 | estimatepriority nblocks 152 | estimatesmartfee nblocks 153 | estimatesmartpriority nblocks 154 | signmessagewithprivkey "privkey" "message" 155 | validateaddress "bitcoinaddress" 156 | verifymessage "bitcoinaddress" "signature" "message" 157 | 158 | == Wallet == 159 | abandontransaction "txid" 160 | addmultisigaddress nrequired ["key",...] ( "account" ) 161 | addwitnessaddress "address" 162 | backupwallet "destination" 163 | dumpprivkey "bitcoinaddress" 164 | dumpwallet "filename" 165 | encryptwallet "passphrase" 166 | getaccount "bitcoinaddress" 167 | getaccountaddress "account" 168 | getaddressesbyaccount "account" 169 | getbalance ( "account" minconf includeWatchonly ) 170 | getnewaddress ( "account" ) 171 | getrawchangeaddress 172 | getreceivedbyaccount "account" ( minconf ) 173 | getreceivedbyaddress "bitcoinaddress" ( minconf ) 174 | gettransaction "txid" ( includeWatchonly ) 175 | getunconfirmedbalance 176 | getwalletinfo 177 | importaddress "address" ( "label" rescan p2sh ) 178 | importprivkey "bitcoinprivkey" ( "label" rescan ) 179 | importprunedfunds 180 | importpubkey "pubkey" ( "label" rescan ) 181 | importwallet "filename" 182 | keypoolrefill ( newsize ) 183 | listaccounts ( minconf includeWatchonly) 184 | listaddressgroupings 185 | listlockunspent 186 | listreceivedbyaccount ( minconf includeempty includeWatchonly) 187 | listreceivedbyaddress ( minconf includeempty includeWatchonly) 188 | listsinceblock ( "blockhash" target-confirmations includeWatchonly) 189 | listtransactions ( "account" count from includeWatchonly) 190 | listunspent ( minconf maxconf ["address",...] ) 191 | lockunspent unlock ([{"txid":"txid","vout":n},...]) 192 | move "fromaccount" "toaccount" amount ( minconf "comment" ) 193 | removeprunedfunds "txid" 194 | sendfrom "fromaccount" "tobitcoinaddress" amount ( minconf "comment" "comment-to" ) 195 | sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] ) 196 | sendtoaddress "bitcoinaddress" amount ( "comment" "comment-to" subtractfeefromamount ) 197 | setaccount "bitcoinaddress" "account" 198 | settxfee amount 199 | signmessage "bitcoinaddress" "message" -------------------------------------------------------------------------------- /src/test/java/com/theforceprotocol/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.theforceprotocol; 2 | 3 | import com.theforceprotocol.blockchainrpc.BitcoinClient; 4 | import com.theforceprotocol.blockchainrpc.USDTClient; 5 | import com.theforceprotocol.blockchainrpc.ethclient.EthTransferClient; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | import org.springframework.boot.test.context.SpringBootTest; 10 | import org.springframework.test.context.junit4.SpringRunner; 11 | 12 | @RunWith(SpringRunner.class) 13 | @SpringBootTest 14 | @Slf4j 15 | public class DemoApplicationTests { 16 | @Test 17 | public void withdrawBTCTest(){ 18 | try { 19 | //https://www.blockchain.com/btc/tx/f5baeb37b71a3cf86bd084eb7111a173461350887e27e373f5604e5a98534223 20 | System.out.println(BitcoinClient.BtcInstance().withdrawBtc("3AqGr4neCJkEHZyYVhFk1pEGm3ZkXuQeGH", 0.0000056)); 21 | } catch (Throwable throwable) { 22 | throwable.printStackTrace(); 23 | } 24 | } 25 | 26 | @Test 27 | public void withdrawUsdtTest(){ 28 | try { 29 | //https://api.omniexplorer.info/v1/transaction/tx/e8572a7707afd0ef559e009c9d0e17fbd68a7b38b2bea4753e254e71fdcea42d 30 | System.out.println(USDTClient.UsdtInstance().withdrawUsdt("1F6bC8v7WoRSqNAC4kLotRzQJbRuW31c1s", 0.03)); 31 | } catch (Throwable throwable) { 32 | throwable.printStackTrace(); 33 | } 34 | } 35 | 36 | @Test 37 | public void withdrawEthTest(){ 38 | try { 39 | System.out.println(EthTransferClient.EthInstance().transferETHToAddress("0xa080d9eb48ec8855340dd7a3cfc0e2745ec06960", new Double(0.0001).toString())); 40 | } catch (Throwable throwable) { 41 | throwable.printStackTrace(); 42 | } 43 | } 44 | } 45 | --------------------------------------------------------------------------------