|
@@ -11,10 +11,12 @@ use App\Models\Config;
|
|
|
use App\Models\Contract;
|
|
|
use App\Models\MemberClan;
|
|
|
use App\Models\Region;
|
|
|
+use App\Servers\BroadcastServer;
|
|
|
use App\Servers\CommonServer;
|
|
|
use App\Servers\ContractServer;
|
|
|
use App\Servers\Icon\Address;
|
|
|
use App\Servers\Icon\BanRPC;
|
|
|
+use App\Servers\Icon\Utils;
|
|
|
use App\Servers\PassServer;
|
|
|
use App\Servers\ShopServer;
|
|
|
use App\Servers\SmsServer;
|
|
@@ -43,26 +45,54 @@ class CommonController extends FrontController
|
|
|
|
|
|
function index()
|
|
|
{
|
|
|
+ $bnbServer=BanRPC::creatServer();
|
|
|
+ $from='0x6652548D0783b45FC6D7a92E70B15Cf933A3D775';
|
|
|
+ $data=[
|
|
|
+ 'from'=>$from,
|
|
|
+ 'to'=>'0xB2568EFafA4895236bCf3e34B03856BC48B4E9Ec',
|
|
|
+ 'data'=>'0x0',
|
|
|
+ 'value'=> Utils::dec2hex(Utils::fund2int(0.0001 )),
|
|
|
+ 'chain_id'=>$bnbServer->chainId,
|
|
|
+ ];
|
|
|
+ $nonce = $bnbServer->getTransactionCount($from);
|
|
|
+ $data['nonce'] = $nonce;
|
|
|
+ dd($nonce);
|
|
|
+// $gas_price = $bnbServer->getGasPrice();
|
|
|
+// $data['gas_price'] =$gas_price;
|
|
|
+// $gas_limit =BroadcastServer::creatServer()->getEthGasLimit($data);
|
|
|
+// $data['gas_limit'] = $gas_limit;
|
|
|
+// $sign =BroadcastServer::creatServer()->ethSign($data,"c1c2169a2cd2b82a6ca4e3ab93d04fb02be23f57ee0ee12c3a4875eec1521276");
|
|
|
+// $hash = $bnbServer->sendRawTransaction($sign, $error);//广播交易
|
|
|
+// $receipt = $bnbServer->getTransactionReceipt("0xcd1b28551be1a770908dc0c2bacea12ac9fc3b5fb6ae25cf1d23329bba8fd799");
|
|
|
+ $receipt = $bnbServer->sendBlockByNumber(43679869);
|
|
|
+ dd($receipt);
|
|
|
+ //0x6652548D0783b45FC6D7a92E70B15Cf933A3D775
|
|
|
+ //0xb2568efafa4895236bcf3e34b03856bc48b4e9ec
|
|
|
// $bnb_block = BanRPC::creatServer()->sendBlockNumber();
|
|
|
-// $block_deal = BanRPC::creatServer()->sendBlockByNumber($bnb_block);
|
|
|
+// dd($bnb_block);
|
|
|
+// $block_deal = BanRPC::creatServer()->sendBlockByNumber(43679463);
|
|
|
+// dd($block_deal);
|
|
|
// $deal = BanRPC::creatServer()->getTransactionReceipt("0xd520c1b14e4d49064612c92647e2338547e5864fe1401972e356a658d4aa0972");//交易查询
|
|
|
- $deal = BanRPC::creatServer()->getGasPrice();//交易查询
|
|
|
- dd($deal);
|
|
|
- $random = new Random();
|
|
|
- // 生成随机数(initial entropy)
|
|
|
- $entropy = $random->bytes(Bip39Mnemonic::MIN_ENTROPY_BYTE_LEN);
|
|
|
- $bip39 = MnemonicFactory::bip39();
|
|
|
- // 通过随机数生成助记词
|
|
|
- $mnemonic = $bip39->entropyToMnemonic($entropy);
|
|
|
- dump($mnemonic);
|
|
|
-
|
|
|
+// $deal = BanRPC::creatServer()->getGasPrice();//交易查询
|
|
|
+// dd($deal);
|
|
|
+// $data=Address::generate();
|
|
|
+// dd($data);
|
|
|
+// $random = new Random();
|
|
|
+// // 生成随机数(initial entropy)
|
|
|
+// $entropy = $random->bytes(Bip39Mnemonic::MIN_ENTROPY_BYTE_LEN);
|
|
|
+// $bip39 = MnemonicFactory::bip39();
|
|
|
+// // 通过随机数生成助记词
|
|
|
+// $mnemonic = $bip39->entropyToMnemonic($entropy);
|
|
|
+ $mnemonic = "poem decide already flush ramp unhappy deputy fiscal refuse history step grape";
|
|
|
+// dump($mnemonic);
|
|
|
+//
|
|
|
$seedGenerator = new Bip39SeedGenerator();
|
|
|
- // 通过助记词生成种子,传入可选加密串'hello'
|
|
|
+// // 通过助记词生成种子,传入可选加密串'hello'
|
|
|
$seed = $seedGenerator->getSeed($mnemonic);
|
|
|
dump( "seed: " .$seed->getHex());
|
|
|
$hdFactory = new HierarchicalKeyFactory();
|
|
|
$master = $hdFactory->fromEntropy($seed);
|
|
|
-
|
|
|
+//
|
|
|
$hardened = $master->derivePath("44'/60'/0'/0/0");
|
|
|
dump( 'WIF: ' . $hardened->getPrivateKey()->toWif());
|
|
|
$address = new PayToPubKeyHashAddress($hardened->getPublicKey()->getPubKeyHash());
|