Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzushioh authored Feb 11, 2018
1 parent 13741e7 commit 8bb2a89
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,22 @@ Architectures are highly inspired by [WalletKit](https://github.com/yuzushioh/Wa
- Generate seed and convert it to mnemonic sentence.

```swift
let entropy = "000102030405060708090a0b0c0d0e0f"
let entropy = Data(hex: "000102030405060708090a0b0c0d0e0f")
let mnemonic = Mnemonic.create(entropy: entropy)
print(mnemonic)
// abandon amount liar amount expire adjust cage candy arch gather drum buyer

let seed = Mnemonic.createSeed(mnemonic: mnemonic)
print(seed)
print(seed.toHexString())
```

- Create your wallet.
- PrivateKey and key derivation (BIP32)

```swift
// It generates master key pair from the seed provided.
let wallet = Wallet(seed: seed, network: .main)
```

- Derive private keys at any index from its master private key.
let masterPrivateKey = PrivateKey(seed: seed, network: .main)

```swift
// BIP44 key derivation
// m/44'
let purpose = wallet.privateKey.derived(at: 44, hardens: true)
let purpose = masterPrivateKey.derived(at: 44, hardens: true)

// m/44'/60'
let coinType = purpose.derived(at: 60, hardens: true)
Expand All @@ -51,5 +45,22 @@ let firstPrivateKey = change.derived(at: 0)
print(firstPrivateKey.publicKey.address)
```


- Create your wallet and generate addresse

```swift
// It generates master key pair from the seed provided.
let wallet = Wallet(seed: seed, network: .main)

let firstAddress = wallet.generateAddress(at: 0)
print(firstAddress)

let secondAddress = wallet.generateAddress(at: 1)
print(secondAddress)

let thirdAddress = wallet.generateAddress(at: 2)
print(thirdAddress)
```

## License
EthereumKit is released under the [MIT License](LICENSE.md).

0 comments on commit 8bb2a89

Please sign in to comment.