# Tutorial: Creating Keys and use them for ethereum-transactions
In this tutorial we will create an ethereum-identity and use it so send transactions to the blockchain.
In this tutorial we will create an ethereum-identity and use it to send transactions to the blockchain.
## Creating a new identity
@ -23,8 +23,8 @@ When we code things in the ethereum ecosystem, it is standard to represent data
The identity consists of:
- The **privateKey** which must never be revealed to anyone. It can be used to sign and decrypt messages and to create it's publicKey.
- The **publicKey** is revealed whenever something is signed with the privateKey. It's also common to send the publicKey to other humans so that they can encrypt data with it, which then can only decrypted by the correct privateKey. It's important to know that there are [two ways to represent](https://github.com/bitpay/bitcore-lib/blob/master/docs/publickey.md) a publicKey compresssed and uncompressed. EthCrypto always creates the uncompressed key which starts with `0x04`. Compressed keys start with `0x03` or `0x02`. To represent the key, we strip the starting `04` away from it and internally add it when doing cryptographic calls.
- The **privateKey** which must never be revealed to anyone. It can be used to sign and decrypt messages and to create its publicKey.
- The **publicKey** is revealed whenever something is signed with the privateKey. It's also common to send the publicKey to other humans so that they can encrypt data with it, which then can only decrypted by the correct privateKey. It's important to know that there are [two ways to represent](https://github.com/bitpay/bitcore-lib/blob/master/docs/publickey.md) a publicKey compressed and uncompressed. EthCrypto always creates the uncompressed key which starts with `0x04`. Compressed keys start with `0x03` or `0x02`. To represent the key, we strip the starting `04` away from it and internally add it when doing cryptographic calls.
- The **address** is calculated from the last 20 bytes of the keccak-256-hash of the publicKey. It is used to represent an identity. Notice that there is no way to calculate the publicKey from an address. This means that whenever we want to encrypt data for someone, we first have to get the publicKey. There are two ways to represent an address. The normal address is lowercase and represents just the 20 bytes of the hash. The checksum-format contains uppercase-letters which the purpose of detecting errors when the address is entered manually.
@ -35,7 +35,7 @@ An ethereum-transaction is basically a json-object with defined values. Lets cre
```javascript
const rawTransaction = {
from: identity.address, // sender address
to: '0x86Fa049857E0209aa7D9e616F7eb3b3B78ECfdb0', // reciever address
to: '0x86Fa049857E0209aa7D9e616F7eb3b3B78ECfdb0', // receiver address
value: new BN('1000000000000000000'), // amount of wei we want to send (= 1 ether)
nonce: 0, // incremental tx-number. Add +1 for every transaction you do
gasPrice: 5000000000,
@ -54,7 +54,7 @@ Before the transaction can be submitted to an ethereum-node, it must be signed w
Now the transaction-string could be submitted to the blockchain. If we really wanted to send the value, we could do this by either send it to a public node like [etherscan](https://etherscan.io/pushTx) or by pushing it to our local node. For testing-purposes it is usual to create a local test-chain and try things out there.
Now the transaction-string could be submitted to the blockchain. If we really wanted to send the value, we could do this by either sending it to a public node like [etherscan](https://etherscan.io/pushTx) or by pushing it to our local node. For testing-purposes it is usual to create a local test-chain and try things out there.