用Crystal写的区块链实现

共有11条评论

SushiChain Address Resolution System (SCARS)
Provide human readable identifiers for blockchain addresses. Similar how a domain name points to an IP address.
So you can send and receive coins/tokens to an address using the human readable name which is also much easier to remember and handle.
A user can register their address to a name - as long as the name is not taken already. To avoid confusion only one name can be registered to an address.
e.g. S0M3SUSH1ADDR3SS => kingsley.sushi
I think this could be implemented as a DAPP on top of SushiChain.
See the Ethereum one for reference: http://ens.readthedocs.io/en/latest/introduction.html

Here are a few node issues which happened when running - not sure why they happened yet. But tracking them here so we can fix.
1. Closed stream and invalid nonce on standalone node (when only running 1 miner with 2 nodes started up (1 standalone, 2 connected to standalone)
<img width="1055" alt="screen shot 2018-02-14 at 05 17 55" src="https://user-images.githubusercontent.com/103770/36189900-e420b346-114c-11e8-96bb-be62e175d042.png">
2. Unhandled exception (I think this happened on the standalone node when a node connected to it was stopped)
<img width="986" alt="screen shot 2018-02-14 at 05 18 47" src="https://user-images.githubusercontent.com/103770/36189935-176c6b46-114d-11e8-96a4-0d96ab22948f.png">

Please discuss what we need for it here.
You can update this comment if you need.
```
> @watzon Personally I'd like to throw everything we have at this. The main page could just be a splash page with information about sushi coin, and then we can have a blog or we post updates, and then we can have a block Explorer and wallet generator
> @kingsleyh
most of the sites have a few things in common - they have
1. whitepaper
2. info about the developers who are building it
3. info about how to get the wallet and get started
4. some contact info
```
References (from slack discussion)
- https://garlicoin.io/
- https://saltlending.com/

Twitter integrated rewards is very effective for the promotion.
- RT our tweet -> 1 SushiCoin
- Send SushiCoins a.k.a. tips.
- Create wallet.
and so on.
These are many things to be discussed. (How to integrate? How to manage secret keys? and so on.)
But I want to keep this open as just one of the idea.

The way the rpc controller works currently all of the commands are stored in one controller. This works of for the small amount of commands that exist currently, but as more methods are added the controller is going to become quite bloated.
I propose that we allow the rpc_controller to be changed into more of an rpc_router which routes commands to the appropriate controller. The controllers would each define the arguments and flags they take, their description, command signature, etc. In this way the cli would only have to have cli specific commands, and if the cli is connected to a node it can list the commands that the node accepts as well.
The following is what I'd imagine an RpcCommand looking like:
```crystal
module ::Sushi::Core::Controllers
abstract class RpcCommand
include ArgParser
abstract def call(json, context, params)
end
class CreateUnsignedTransaction < RpcCommand
command_name "createunsignedtransaction"
argument sample : String,
required: true
flag debug : Bool,
short: "-d"
def call(json, context, params)
action = json["action"].to_s
senders = Models::Senders.from_json(json["senders"].to_s)
recipients = Models::Recipients.from_json(json["recipients"].to_s)
message = json["message"].to_s
transaction = @blockchain.create_unsigned_transaction(
action,
senders,
recipients,
message,
)
fee = transaction.calculate_fee
raise "Invalid fee #{fee} for the action #{action}" if fee <= 0.0
context.response.print transaction.to_json
context
end
end
end
```

Most coins don't require you to enter connection information every time you run the daemon. Instead all of that info is stored in a `~/.coinname/coinname.config` file. I propose that we come up with a configuration file structure that will allow us to list node connection information, privacy settings for our node, default wallet location, etc.