bytes(Bip39Mnemonic::MIN_ENTROPY_BYTE_LEN); $bip39 = MnemonicFactory::bip39(); // 通过随机数生成助记词 $mnemonic = $bip39->entropyToMnemonic($entropy); echo "mnemonic: " . $mnemonic.PHP_EOL.PHP_EOL;// 助记词 $seedGenerator = new Bip39SeedGenerator(); // 通过助记词生成种子,传入可选加密串'hello' $seed = $seedGenerator->getSeed($mnemonic); echo "seed: " . $seed->getHex() . PHP_EOL; $hdFactory = new HierarchicalKeyFactory(); $master = $hdFactory->fromEntropy($seed); $hardened = $master->derivePath("44'/60'/0'/0/0"); echo 'WIF: ' . $hardened->getPrivateKey()->toWif(); echo PHP_EOL; $address = new PayToPubKeyHashAddress($hardened->getPublicKey()->getPubKeyHash()); echo 'address: ' . $address->getAddress(); echo PHP_EOL; echo " - m/44'/60'/0'/0/0 " .PHP_EOL; echo " public key: " . $hardened->getPublicKey()->getHex().PHP_EOL; echo " private key: " . $hardened->getPrivateKey()->getHex().PHP_EOL;// 可以导入到imtoken使用的私钥 $util = new Util(); echo " address: " . $util->publicKeyToAddress($util->privateKeyToPublicKey($hardened->getPrivateKey()->getHex())) . PHP_EOL;// 私钥导入imtoken后一样的地址 dd(1221); // ContractServer::creatServer()->verifyContractCommon(); // dd(12); // $ids=Member::where('id','>',1)->pluck('id')->toArray(); // MemberServer::creatServer()->verificationLevel($ids); $contract=Contract::where('id',33)->first(); $memberTeam=MemberClan::where('m_id',$contract->{'m_id'})->select(['id','m_id','p_ids','one_m_id','two_m_id'])->first(); $pIds=array_reverse(array_filter(explode(',',$memberTeam->{'p_ids'}))); dd($contract,$pIds); ContractServer::creatServer()->teamProportion($contract,$pIds); dd(1221); // $data=Address::generate(); // dd($data); // for ($i=0;$i<=23;++$i){ // $address='0x848da9d7fcbfe80afc47b4383f178184589acfa9'; // $p_member= Member::orderBy('id','desc')->select(['id', 'address'])->first(); // $ret = MemberServer::creatServer()->register($i.$address, $p_member->{'id'}, '', ''); // } // $ret=BanRPC::creatServer()->getTransactionReceipt('0xc47a91e730e44c1beb80182f69c117b74dfdf9e6b2fdbb81def8bc704cd0cb5b'); // dd($ret); } }