| 1234567891011121314151617181920 |
- <?php
- namespace App\Module\UrausSys\Services;
- class AddressService
- {
- /**
- * 生成符合BNB Chain规范的地址(模拟实现)
- * 规范说明:
- * - 以"0x"开头
- * - 后接40位小写十六进制字符(0-9, a-f)
- * - 总长度42字符
- *
- * @return string 符合规范的BNB Chain地址
- */
- public static function generateBnbAddress(): string
- {
- return '0x' . bin2hex(random_bytes(20)); // 20字节随机数生成40位十六进制
- }
- }
|