Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
se3000 committed Jan 29, 2017
1 parent 2b9430a commit 77a41b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/).
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
## [0.4.0]

### Added
- Tx#data_bin returns the data field of a transaction in binary.
- Tx#data_hex returns the data field of a transaction as a hexadecimal string.
- Tx#id is an alias of Tx#hash

### Changed
- Tx#data is configurable to return either hex or binary: `config.tx_data_hex = true`.
Expand All @@ -16,3 +18,4 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
- Key#address getter is prepended by '0x'.
- Extract public key to address method into Utils.public_key_to_address.
- Tx#from returns an address instead of a public key.
- Chain ID is updated to the later version of the spec.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ Build a transaction from scratch:
```ruby
tx = Eth::Tx.new({
data: hex_data,
gas_limit: 3_141_592,
gas_price: 20_000_000_000,
gas_limit: 21_000,
gas_price: 3_141_592,
nonce: 1,
to: key.address,
to: key2.address,
value: 1_000_000_000_000,
})
```
Expand All @@ -50,9 +50,9 @@ tx = Eth::Tx.decode hex

### Configure
In order to prevent replay attacks, you must specify which Ethereum chain your transactions are created for. See [EIP 155](https://github.com/ethereum/EIPs/issues/155) for more detail.
```
```ruby
Eth.configure do |config|
config.chain_id = 18 #defaults to 13
config.chain_id = 1 # nil by default, meaning valid on any chain
end
```

Expand All @@ -65,7 +65,19 @@ Get the raw transaction with `tx.hex`, and broadcast it through any Ethereum nod

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/se3000/ethereum-tx.
Bug reports and pull requests are welcome on GitHub at https://github.com/se3000/ethereum-tx. Tests are encouraged.

### Tests

First install the [Ethereum common tests](https://github.com/ethereum/tests):
```shell
git submodule update --init
```

Then run the associated tests:
```shell
rspec
```


## License
Expand Down

0 comments on commit 77a41b6

Please sign in to comment.