Skip to content

Instantly share code, notes, and snippets.

@jcbombardelli
Created June 19, 2019 13:37
Show Gist options
  • Save jcbombardelli/13284d9854b12dfdc750cfeb1aeca305 to your computer and use it in GitHub Desktop.
Save jcbombardelli/13284d9854b12dfdc750cfeb1aeca305 to your computer and use it in GitHub Desktop.
Blockchain Academy
Curso Hyperledger - Prodesp
https://pad.riseup.net/p/bahyperledger201906
Resumo dia anterior
https://gist.github.com/jcbombardelli/f06082a0f983e1d5713617ffadc8c0fb
i3tech --> senha da VM
Abrir terminal, executar:
docker rm -f $(docker ps -aq)
Entrar na pasta Hyperledger através do Terminal ou VSCode (caso não tenha, crie com "mkdir ~/Hyperledger")
git clone https://github.com/jcbombardelli/hyperledger-superstarted.git
Instalar POSTMAN (Tem na software Ubuntu)
https://www.getpostman.com/downloads/
instalação Go no Ubuntu
https://medium.com/@jcbombardelli/instale-o-go-1-12-no-ubuntu-bf0dd6744fdd
sudo tar -xvf go1.11.linux-amd64.tar.gz
sudo mv go /usr/local
Abra o arquivo ~/.profile e adicione as seguintes linha no final do arquivo.
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
source ~/.profile
Matar containers
docker rm -f $(docker ps -aq)
Inclua como exce~çãi no browser o endereço 0.0.0.0
entrar em:
http://0.0.0.0:5984/_utils
Extensões Legais no VSCode
Docker (microsoft)
Hyperledger Composer
// createMisteryBox
{
"serial":"123450",
"size":"Tiny",
"model":"Blue",
"owner":"Caio"
}
Alterar o REquest de Query para Array (Vazio)
const request = {
chaincodeId: "misterybox",
fcn: "queryAllMisteryboxes",
args: []
};
Alterar em Arquivo 02-registeruser.js
ClaroMSP para RubyMSP
EM seguida reconstrua a rede com
/infraestructure/02-start.sh
/infraestructure/03-install.sh
/infraestructure/04-instantiate.sh
volta em /infraestructure/js e execute novamente os scripts node 01 e 02
app.post -> o que falta?
let arr = [];
arr[0] = req.body.serial;
arr[1] = req.body.size;
arr[2] = req.body.model;
arr[3] = req.body.owner;
NOVO PUT de UPDATE
app.put("/api/misterybox/:serial", async (req, res) => {
res.setHeader("Content-Type", "application/json");
let arr = [];
arr[0] = req.param("serial");
arr[1] = req.body.owner;
arr[2] = req.body.newowner;
blockchain.Update(arr).then(queryResult => {
res.status(200).send(queryResult);
})
})
Colocar na excessão do proxy
localhost, 127.0.0.1, ::1, 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment