Ethereum Asked on November 22, 2021
I am testing truffle now and I want to know more about what it deploys and how. It seems to use two txns. I have some results –
Running migration: 2_deploy_contracts.js
Deploying CA12...
... 0x2d0f35d5802958bb5d96f162f3d2e0b0354946081cf6119b9b13d40994e1c054
CA12: 0x7abf846141964365f2f817238e4038ab70d419ea
Saving successful migration to network...
... 0x910576d8c200629f0b684ba903962a52e662d58eb8b41ec5c9c9618bb9583c46
Saving artifacts...
> eth.getTransaction("0x2d0f35d5802958bb5d96f162f3d2e0b0354946081cf6119b9b13d40994e1c054")
{
blockHash: "0x66ee27a4beec501915e955b0db170f2f1f807bea07ea1bb484e71c7c080d0fd5",
blockNumber: 115386,
from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305",
gas: 4712388,
gasPrice: 100000000000,
hash: "0x2d0f35d5802958bb5d96f162f3d2e0b0354946081cf6119b9b13d40994e1c054",
input: "0x606060405260156000806101000a81548160ff021916908360ff160217905550613a98600060016101000a81548161ffff021916908361ffff1602179055506004600060036101000a81548160ff021916908360ff1602179055506060600060046101000a81548160ff021916908360ff160217905550341561008157600080fd5b33600060056101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610271806100d16000396000f300606060405260043610610078576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806311bc0d071461007d5780635b0c8d70146100ae5780638da5cb5b146100d4578063a0a628d614610129578063a918b85614610158578063f4ea2d9914610187575b600080fd5b341561008857600080fd5b6100906101b6565b604051808261ffff1661ffff16815260200191505060405180910390f35b34156100b957600080fd5b6100d2600480803560ff169060200190919050506101ca565b005b34156100df57600080fd5b6100e76101e7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561013457600080fd5b61013c61020d565b604051808260ff1660ff16815260200191505060405180910390f35b341561016357600080fd5b61016b610220565b604051808260ff1660ff16815260200191505060405180910390f35b341561019257600080fd5b61019a610232565b604051808260ff1660ff16815260200191505060405180910390f35b600060019054906101000a900461ffff1681565b806000806101000a81548160ff021916908360ff16021790555050565b600060059054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060049054906101000a900460ff1681565b6000809054906101000a900460ff1681565b600060039054906101000a900460ff16815600a165627a7a7230582016096264cb3c5b951f9de56c6d945d91d3e4a41772c3c9f2975b0751aad5643d0029",
nonce: 283,
r: "0xb82dc037511e4ee7b8c709d21c5cb4be8520513b3d8d188245db22116ee961e5",
s: "0x25909e9a3c182d50c6ef447be88f0e98d30c449b7ffd4e02d8b17091290f9215",
to: null,
transactionIndex: 0,
v: "0x2b694",
value: 0
}
> eth.getTransaction("0x910576d8c200629f0b684ba903962a52e662d58eb8b41ec5c9c9618bb9583c46")
{
blockHash: "0xc1061ec3764d723254ce30707898ead8f48b0c177dc758a3b2cb98cb26bb03c3",
blockNumber: 115388,
from: "0x46fb9a22689c4a4bfb494baeafbb8b2993725305",
gas: 4712388,
gasPrice: 100000000000,
hash: "0x910576d8c200629f0b684ba903962a52e662d58eb8b41ec5c9c9618bb9583c46",
input: "0xfdacd5760000000000000000000000000000000000000000000000000000000000000002",
nonce: 284,
r: "0xc67dc71c347361464738a87fa0de75e1ce4a334350a1ced6ea10abea50563b4a",
s: "0x1cacb3bf0a873f8d0ba5565932fc121ae9323d00d25a63c1636e260b4fd233ba",
to: "0xa3c4c30d50fdc6824a8a612c65d6e97dfd4d2a0e",
transactionIndex: 0,
v: "0x2b693",
value: 0
}
>
The input to the first hash is I assume byte code from the compile. It has a lot of FFFF which looks like inefficiency to me. But what is the second input (in the second txn) –
0xfdacd5760000000000000000000000000000000000000000000000000000000000000002
That is the migration part I think.
To understand the second transaction, you have to take a look at Migrations.sol
which comes with truffle. It's used to store checkpoints for migrations. In the case of error you can restart your migration at this step.
The relevant function from Migrations.sol
is this one:
function setCompleted(uint completed) restricted {
last_completed_migration = completed;
}
First four bytes (fdacd576) of the transaction are the signature of the method and 0...02 is the parameter, which is step 2 of your migration process.
0xfdacd5760000000000000000000000000000000000000000000000000000000000000002
Answered by ivicaa on November 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP