我正在處理POC,我必須存儲一些數據,例如對象的ID,價格,所有者等等。是否可以使用智能合約將這些內容存儲在區塊鏈中。如果不是,使用區塊鏈實現它的方法是什麼。 (我做了一些研究,人們在SCM行業使用區塊鏈,他們必須存儲這些數據)。在區塊鏈上存儲數據
回答
是的,如果您使用以太坊智能合約,您可以定義您的合約並將其與交易一起存儲。
https://www.ethereum.org/greeter
需要注意的是,如果你不加密存儲在合同中的數據將是每個人都可以訪問。
是的,你可以使用合約來存儲你想要的東西。當然,你必須加密你的記錄。但是,我認爲這不是問題。
您可以定義合同並將其部署到同行。您的合同應該定義如何存儲交易。另外,它應該定義如何驗證它們。
您可以通過使用合同中相應的數據結構,然後進行交易產生的散列,你需要保存訪問時隨時
考慮從Hyperledger面料「Getting Started」頁以下tutorial存儲數據。
基本上您實現要求邏輯上通過利用chaincodes,你將必須實現以下golang接口:
// Chaincode interface must be implemented by all chaincodes. The fabric runs
// the transactions by calling these functions as specified.
type Chaincode interface {
// Init is called during Instantiate transaction after the chaincode container
// has been established for the first time, allowing the chaincode to
// initialize its internal data
Init(stub ChaincodeStubInterface) pb.Response
// Invoke is called to update or query the ledger in a proposal transaction.
// Updated state variables are not committed to the ledger until the
// transaction is committed.
Invoke(stub ChaincodeStubInterface) pb.Response
}
例如一些與此類似:
type myStoreChaincode struct {
}
func (cc *myStoreChaincode) Init(stub ChaincodeStubInterface) pb.Response {
return shim.Success(nil)
}
func (cc *myStoreChaincode) Invoke(stub ChaincodeStubInterface) pb.Response {
action, params = stub.GetFunctionAndParameters()
if action == "storeItem" {
cc.StoreItem(stub, params)
}
// Handle here other cases and possible parameters combinations
return shim.Success(nil)
}
func (cc *myStoreChaincode) StoreItem(stub ChaincodeStubInterface, params []string) {
// Store item on ledger, where params[0] is a key and params[1] actual value
stub.PutState(params[0], params[1])
}
這只是一個簡化版本,而對於更復雜的你可以按照「Writing Your Application」教程。
是的,您可以在Hyperledger Fabric(當前版本爲1.0)中存儲實施區塊鏈中資產的信息。關於資產的信息通過chaincode更新(去基於語言的交易)。通過使用HyperLedger Composer Playground來開始試驗,這相當容易。 HyperLedger Composer使用HyperLedger Fabric V1作爲操作基礎,簡化了新的Blockchain應用程序的編寫過程,特別是原型。
Composer使用建模語言來定義網絡的特徵(成員類型,資產類型,事件和事務定義了核心網絡)。它具有強大的訪問控制語言,可以準確指定誰可以訪問哪些資產和哪些事務。它有一個簡化的查詢語言,在執行查詢時自動調用ACL(這意味着即使您要求提供您不應該看到的信息,您仍然無法看到它),最後,允許您編寫所有的代碼採用單一語言 - 目前使用Javascript - 包括智能交易的鏈式代碼。
是的,可以將數據存儲在智能合約中,您可以使用松露框架來創建智能合約和UI。 您可以在每次存儲東西時創建新的智能合同,並存儲您創建的先前合同的地址。它也容易跟蹤。
- 1. 在區塊鏈中存儲
- 2. 在比特幣區塊鏈中存儲數據
- 3. 存儲常量數據:python模塊與數據存儲區
- 4. 如何在PC上存儲超級結構區塊鏈?
- 5. to_timestamp存儲時區數據
- 6. 在iPad上存儲數據
- 7. 在「雲」上存儲數據
- 8. 在JBoss上存儲數據
- 9. 在數據庫中存儲時區
- 10. Google App Engine在線數據存儲區
- 11. 將數據存儲區遊標存儲在memcache或數據存儲區中的位置?
- 12. 爲什麼沒有權限的區塊鏈將它們的權限存儲在區塊鏈中?
- 13. MySQL主數據存儲區和MongoDB輔助數據存儲區之間的ETL
- 14. 在Google應用引擎數據存儲區中保存數據
- 15. 如何在GAE數據存儲區中正確保存數據?
- 16. 不能在數據存儲區中存儲希臘文
- 17. 生成URL以將圖像存儲在數據存儲區Blob
- 18. 數據存儲在本地主機上,但不在gae數據存儲上?
- 19. 在內存上存儲數據庫
- 20. 如何在GAE上使用數據存儲區遊標與jpa
- 21. Hyperledger將數據從PC上傳到區塊鏈
- 22. 軌道上的區塊鏈分佈式數據庫
- 23. 成本在數據存儲存儲文件VS Blob存儲區的
- 24. 將大塊數據一次性導入Google App Engine數據存儲區
- 25. Corda上的數據存儲
- 26. iOS上的Dropbox數據存儲列表數據存儲
- 27. Google App Engine數據存儲區編碼?
- 28. 異步寫入GAE數據存儲區
- 29. Google App Engine數據存儲區 - 主鍵
- 30. Google數據存儲區限制