Skip to content

Instantly share code, notes, and snippets.

var Wallet = require('ethereumjs-wallet');
// 新たなウォレットを生成
const wallet = Wallet.generate();
// ウォレットの秘密鍵を取得
const privateKey = wallet.getPrivateKeyString();
console.log(privateKey);
// ウォレットの公開鍵を取得
npm install ethereumjs-wallet --save
chmod 755 install_node.sh
./install_node.sh
cat > install_node.sh <<EOF
#!/bin/sh
sudo apt-get install -y nodejs npm
sudo npm cache clean
sudo npm install n -g
sudo n stable
sudo ln -sf /usr/local/bin/node /usr/bin/node
sudo ln -sf /usr/local/bin/npm /usr/bin/npm
sudo apt-get purge -y nodejs npm
EOF
ssh pi@raspberrypi.local
cat > /Volumes/boot/wpa_supplicant.conf <<EOF
country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="SSID"
psk=YOUR_PSK
}
EOF
node -e "console.log(require('crypto').pbkdf2Sync('PASSWORD','SSID',4096,32,'sha1').toString('hex'))"
touch /Volumes/boot/ssh
// npm install eth-crypto --save
const EthCrypto = require('eth-crypto');
const privateKey = '0x61ce8b95ca5fd6f55cd97ac60817777bdf64f1670e903758ce53efc32c3dffeb';
const encryptedMessage = {
iv: '3c12aa4bdbb6219479eb0ebe62ee908f',
ephemPublicKey: '04f70ca0c9e6741c8709de1cfec75f980823dd753b9c1a87cc4afbfdf44707b1830c0385b0fa808fa18f55a5f7551370242d95cd61546823fda2f73d26e1906a81',
ciphertext: 'a21abfac3a44ca4c22bdfb23a97a115f',
mac: 'b4d282d05422672689bd1027c948b2189dc52e7f9101e753be6fb3df844572c4'
{ iv: '3c12aa4bdbb6219479eb0ebe62ee908f',
ephemPublicKey: '04f70ca0c9e6741c8709de1cfec75f980823dd753b9c1a87cc4afbfdf44707b1830c0385b0fa808fa18f55a5f7551370242d95cd61546823fda2f73d26e1906a81',
ciphertext: 'a21abfac3a44ca4c22bdfb23a97a115f',
mac: 'b4d282d05422672689bd1027c948b2189dc52e7f9101e753be6fb3df844572c4' }