PHP WebShell
Текущая директория: /usr/lib/node_modules/bitgo/node_modules/avalanche/examples/evm
Просмотр файла: createKeypair.ts
import { Avalanche } from "avalanche/dist"
import { EVMAPI, KeyChain, KeyPair } from "avalanche/dist/apis/evm"
import { CreateKeyPairResponse } from "avalanche/dist/apis/evm/interfaces"
const ip: string = "localhost"
const port: number = 9650
const protocol: string = "http"
const networkID: number = 1337
const avalanche: Avalanche = new Avalanche(ip, port, protocol, networkID)
const cchain: EVMAPI = avalanche.CChain()
const main = async (): Promise<any> => {
const keychain: KeyChain = cchain.keyChain()
const keypair: KeyPair = keychain.makeKey()
const address: string = keypair.getAddressString()
const publicKey: string = keypair.getPublicKeyString()
const privateKey: string = keypair.getPrivateKeyString()
const createKeypairResponse: CreateKeyPairResponse = {
address: address,
publicKey: publicKey,
privateKey: privateKey
}
console.log(createKeypairResponse)
}
main()
Выполнить команду
Для локальной разработки. Не используйте в интернете!