Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
MultiSignUser
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
崔大师
MultiSignUser
Commits
08db495f
提交
08db495f
authored
7月 18, 2020
作者:
崔大师
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
d2061c16
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
37 行增加
和
17 行删除
+37
-17
.node-xmlhttprequest-sync-3546
.node-xmlhttprequest-sync-3546
+0
-0
ThkContract.js
ThkContract.js
+14
-3
account
account
+21
-13
config.json
config.json
+2
-1
没有找到文件。
.node-xmlhttprequest-sync-3546
0 → 100644
浏览文件 @
08db495f
ThkContract.js
浏览文件 @
08db495f
...
...
@@ -65,6 +65,17 @@ const toAddress = (THAddress) => {
return
web3
.
Iban
.
toAddress
(
THAddress
).
toString
().
toLowerCase
()
}
const
isAddress
=
(
address
)
=>
{
return
web3
.
isAddress
(
address
)
.
toString
()
return
web3
.
isAddress
(
address
)
}
module
.
exports
=
{
init
,
getTxHash
,
callContract
,
deployContract
,
ether
,
setVal
,
toIban
,
toAddress
,
isIban
,
isAddress
};
\ No newline at end of file
module
.
exports
=
{
init
,
getTxHash
,
callContract
,
deployContract
,
ether
,
setVal
,
toIban
,
toAddress
,
isIban
,
isAddress
};
\ No newline at end of file
account
浏览文件 @
08db495f
#!/usr/bin/env node
const
Web3
=
require
(
'thinkium-web3js
'
);
const
utils
=
require
(
'ethereumjs-util
'
);
const
bip39
=
require
(
'bip39'
);
const
HDWallet
=
require
(
'ethereum-hdwallet'
)
const
utils
=
require
(
'ethereumjs-util
'
);
const
Web3
=
require
(
'thinkium-web3js
'
);
const
fs
=
require
(
'fs'
);
const
web3
=
new
Web3
();
const
rpxUrl
=
"http://rpctest.chainopen.cn"
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
rpxUrl
));
const
{
mnemonic
}
=
JSON
.
parse
(
fs
.
readFileSync
(
"./config.json"
));
const
getPrivateKey
=
async
(
mnemonic
,
n
)
=>
{
const
seed
=
await
bip39
.
mnemonicToSeed
(
mnemonic
.
trim
())
const
hdwallet
=
HDWallet
.
fromSeed
(
seed
)
const
privateKey
=
hdwallet
.
derive
(
'm/44
\'
/60
\'
/0
\'
/0/'
+
n
).
getPrivateKey
();
const
address
=
utils
.
privateToAddress
((
privateKey
))
var
account
=
web3
.
thk
.
GetAccount
(
'1'
,
'0x'
+
address
.
toString
(
'hex'
));
var
balance
=
account
.
balance
;
console
.
log
(
"("
+
n
+
")"
+
"0x"
+
privateKey
.
toString
(
'hex'
),
":"
,
web3
.
Iban
.
toIban
((
"0x"
+
address
.
toString
(
'hex'
))).
toString
(),
"("
+
web3
.
fromWei
(
balance
,
'ether'
)
+
" ether)"
)
const
rpxUrl
=
"http://rpcproxy.thinkium.org"
const
defaultChainId
=
"103"
;
const
toIban
=
(
address
)
=>
{
return
web3
.
Iban
.
toIban
(
address
).
toString
()
}
const
getAccount
=
async
(
mnemonic
,
n
)
=>
{
const
seed
=
await
bip39
.
mnemonicToSeed
(
mnemonic
.
trim
())
const
hdwallet
=
HDWallet
.
fromSeed
(
seed
)
const
privateKey
=
hdwallet
.
derive
(
'm/44
\'
/60
\'
/0
\'
/0/'
+
n
).
getPrivateKey
()
const
address
=
utils
.
privateToAddress
(
privateKey
)
web3
.
setProvider
(
new
web3
.
providers
.
HttpProvider
(
rpxUrl
));
web3
.
thk
.
defaultPrivateKey
=
privateKey
web3
.
thk
.
defaultAddress
=
'0x'
+
address
.
toString
(
'hex'
).
toLowerCase
()
web3
.
thk
.
defaultChainId
=
defaultChainId
var
account
=
web3
.
thk
.
GetAccount
(
defaultChainId
,
'0x'
+
address
.
toString
(
'hex'
));
var
balance
=
account
.
balance
;
console
.
log
(
"("
+
n
+
")"
+
"0x"
+
privateKey
.
toString
(
'hex'
),
":"
,
"0x"
+
address
.
toString
(
'hex'
),
web3
.
Iban
.
toIban
((
"0x"
+
address
.
toString
(
'hex'
))).
toString
(),
"("
+
web3
.
fromWei
(
balance
,
'ether'
)
+
" ether)"
)
}
for
(
var
i
=
0
;
i
<
10
;
i
++
){
get
PrivateKey
(
mnemonic
,
i
);
get
Account
(
mnemonic
,
i
);
}
config.json
浏览文件 @
08db495f
{
"mnemonic"
:
""
,
"mnemonic"
:
"
alley absorb wait alpha teach path pizza people home cloud announce kiwi
"
,
"contractAddress"
:
""
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论